1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-05-09 16:41:02 +03:00

Merge remote-tracking branch 'remotes/esp8266/master'

This commit is contained in:
Markus Sattler 2016-02-02 17:51:07 +01:00
commit ea95f2e8fa
10 changed files with 143 additions and 38 deletions

@ -554,7 +554,7 @@ thing.name=SparkFun ESP8266 Thing
thing.upload.tool=esptool
thing.upload.speed=921600
thing.upload.resetmethod=nodemcu
thing.upload.resetmethod=ck
thing.upload.maximum_size=434160
thing.upload.maximum_data_size=81920
thing.upload.wait_for_upload_port=true
@ -606,6 +606,59 @@ thing.menu.UploadSpeed.512000.upload.speed=512000
thing.menu.UploadSpeed.921600=921600
thing.menu.UploadSpeed.921600.upload.speed=921600
##############################################################
thingdev.name=SparkFun ESP8266 Thing Dev
thingdev.upload.tool=esptool
thingdev.upload.speed=921600
thingdev.upload.resetmethod=nodemcu
thingdev.upload.maximum_size=434160
thingdev.upload.maximum_data_size=81920
thingdev.upload.wait_for_upload_port=true
thingdev.serial.disableDTR=true
thingdev.serial.disableRTS=true
thingdev.build.mcu=esp8266
thingdev.build.f_cpu=80000000L
thingdev.build.board=ESP8266_THING_DEV
thingdev.build.core=esp8266
thingdev.build.variant=thing
thingdev.build.flash_mode=dio
# flash chip: AT25SF041 (512 kbyte, 4Mbit)
thingdev.build.flash_size=512K
thingdev.build.flash_ld=eagle.flash.512k64.ld
thingdev.build.flash_freq=40
thingdev.build.debug_port=
thingdev.build.debug_level=
thingdev.menu.CpuFrequency.80=80 MHz
thingdev.menu.CpuFrequency.80.build.f_cpu=80000000L
thingdev.menu.CpuFrequency.160=160 MHz
thingdev.menu.CpuFrequency.160.build.f_cpu=160000000L
thingdev.menu.UploadTool.esptool=Serial
thingdev.menu.UploadTool.esptool.upload.tool=esptool
thingdev.menu.UploadTool.esptool.upload.verbose=-vv
thingdev.menu.UploadSpeed.115200=115200
thingdev.menu.UploadSpeed.115200.upload.speed=115200
thingdev.menu.UploadSpeed.9600=9600
thingdev.menu.UploadSpeed.9600.upload.speed=9600
thingdev.menu.UploadSpeed.57600=57600
thingdev.menu.UploadSpeed.57600.upload.speed=57600
thingdev.menu.UploadSpeed.256000.windows=256000
thingdev.menu.UploadSpeed.256000.upload.speed=256000
thingdev.menu.UploadSpeed.230400.linux=230400
thingdev.menu.UploadSpeed.230400.macosx=230400
thingdev.menu.UploadSpeed.230400.upload.speed=230400
thingdev.menu.UploadSpeed.460800.linux=460800
thingdev.menu.UploadSpeed.460800.macosx=460800
thingdev.menu.UploadSpeed.460800.upload.speed=460800
thingdev.menu.UploadSpeed.512000.windows=512000
thingdev.menu.UploadSpeed.512000.upload.speed=512000
thingdev.menu.UploadSpeed.921600=921600
thingdev.menu.UploadSpeed.921600.upload.speed=921600
##############################################################
esp210.name=SweetPea ESP-210

@ -24,43 +24,42 @@ void MD5Builder::addHexString(const char * data){
}
bool MD5Builder::addStream(Stream & stream, const size_t total_len) {
const int buf_size = 512;
int bytesleft = total_len;
uint8_t * buf = (uint8_t*) malloc(buf_size);
if(buf) {
while((stream.available() > -1) && (bytesleft > 0)) {
const int buf_size = 512;
int bytesleft = total_len;
uint8_t * buf = (uint8_t*) malloc(buf_size);
if(buf) {
while((stream.available() > -1) && (bytesleft > 0)) {
// get available data size
int sizeAvailable = stream.available();
if(sizeAvailable) {
int readBytes = sizeAvailable;
// get available data size
int sizeAvailable = stream.available();
if(sizeAvailable) {
int readBytes = sizeAvailable;
// read only the asked bytes
if(readBytes > bytesleft) {
readBytes = bytesleft ;
}
// not read more the buffer can handle
if(readBytes > buf_size) {
readBytes = buf_size;
}
// read data
int bytesread = stream.readBytes(buf, readBytes);
bytesleft -= bytesread;
if(bytesread > 0) {
MD5Update(&_ctx, buf, bytesread);
}
}
// time for network streams
delay(0);
// read only the asked bytes
if(readBytes > bytesleft) {
readBytes = bytesleft ;
}
// not free null ptr
free(buf);
return (bytesleft == 0);
} else {
return false;
// not read more the buffer can handle
if(readBytes > buf_size) {
readBytes = buf_size;
}
// read data
int bytesread = stream.readBytes(buf, readBytes);
bytesleft -= bytesread;
if(bytesread > 0) {
MD5Update(&_ctx, buf, bytesread);
}
}
// time for network streams
delay(0);
}
// guaranteed not null
free(buf);
return (bytesleft == 0);
} else {
return false;
}
}
void MD5Builder::calculate(void){
@ -77,7 +76,7 @@ void MD5Builder::getChars(char * output){
}
String MD5Builder::toString(void){
char out[32];
char out[33];
getChars(out);
return String(out);
}

@ -9,6 +9,7 @@ title: Supported Hardware
* [NodeMCU 1\.0](#nodemcu-10)
* [Olimex MOD\-WIFI\-ESP8266\-DEV](#olimex-mod-wifi-esp8266-dev)
* [Olimex MOD\-WIFI\-ESP8266](#olimex-mod-wifi-esp8266)
* [Olimex ESP8266\-EVB](#olimex-esp8266-evb)
* [SparkFun ESP8266 Thing](#sparkfun-esp8266-thing)
* [SweetPea ESP\-210](#sweetpea-esp-210)
* [ESPino](#espino)
@ -77,12 +78,28 @@ Since jumper IO0JP is tied to GPIO0, which is PIN 21, you'll have to ground it b
UART pins for programming and serial I/O are GPIO1 (TXD, pin 3) and GPIO3 (RXD, pin 4).
Get the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/MOD-WIFI-ESP8266-DEV/MOD-WIFI-ESP8266-DEV_schematic.pdf)
You can find the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/MOD-WIFI-ESP8266-DEV/MOD-WIFI-ESP8266-DEV_schematic.pdf)
## Olimex MOD-WIFI-ESP8266
This is a stripped down version of the above. Behaves identically in terms of jumpers but has less pins readily available for I/O. Still 2 MB of SPI flash.
## Olimex ESP8266-EVB
It's a Olimex MOD-WIFI-ESP8266-DEV module installed on the headers of a development board which features some breakout connectors, a button (GPIO0) and a relay (GPIO5).
Programming is pretty straightforward: the board is supported in the Arduino IDE after [installing it via the Board Manager](https://github.com/esp8266/Arduino#installing-with-boards-manager). To download a program you just have to connect GND/RX/TX from a serial/USB adapter to the UEXT connector and press the only button before applying power to enter UART mode.
Don't connect 5V from the serial/USB adapter to the board or you won't be able to power cycle it for UART mode.
You can find the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/ESP8266-EVB/ESP8266-EVB_Rev_A.pdf).
[This guide](https://www.olimex.com/Products/IoT/ESP8266-EVB/resources/ESP8266-EVB-how-to-use-Arduino.pdf) is also useful for the first setup, since it contains the UEXT connector pinout.
Board variants include:
* ESP8266-EVB-BAT: comes with built-in LiPo charger and step-up converter
* ESP8266-EVB-BAT-BOX: as above, but enclosd in a plastic box (non-weatherproof)
## SparkFun ESP8266 Thing ###
Product page: https://www.sparkfun.com/products/13231

@ -142,6 +142,7 @@ Libraries that don't rely on low-level access to AVR registers should work well.
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git)
- [DHT-sensor-library](https://github.com/adafruit/DHT-sensor-library) - Arduino library for the DHT11/DHT22 temperature and humidity sensors. Download latest v1.1.1 library and no changes are necessary. Older versions should initialize DHT as follows: `DHT dht(DHTPIN, DHTTYPE, 15)`
- [Encoder](https://github.com/PaulStoffregen/Encoder) - Arduino library for rotary encoders. Version 1.4 supports ESP8266.
- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with ESP8266. Use the "DmaDriven" or "UartDriven" branches for ESP8266. Includes HSL color support and more.
- [PubSubClient](https://github.com/Imroy/pubsubclient) - MQTT library by @Imroy.

Binary file not shown.

After

(image error) Size: 62 KiB

Binary file not shown.

After

(image error) Size: 94 KiB

Binary file not shown.

After

(image error) Size: 83 KiB

Binary file not shown.

After

(image error) Size: 96 KiB

@ -12,6 +12,7 @@ title: OTA Update
* [Application Example](#application-example)
* [Classic OTA](#classic-ota)
* [ArduinoOTA](#arduinoota)
* [Password Protection](#password-protection)
* [Troubleshooting](#troubleshooting)
* [Web Browser](#web-browser)
* [Requirements](#requirements-1)
@ -228,6 +229,40 @@ IP address: 192.168.1.100
**Note:** To be able to upload your sketch over and over again using OTA, you need to embed OTA routines inside. Please use BasicOTA.ino as an example.
#### Password Protection
Protecting your OTA uploads with password is really straightforward. All you need to do, is to include the following statement in your code:
```cpp
ArduinoOTA.setPassword((const char *)"123");
```
Where ``` 123 ``` is a sample password that you should replace with your own.
Before implementing it in your sketch, it is a good idea to check how it works using *BasicOTA.ino* sketch available under *File > Examples > ArduinoOTA*. Go ahead, open *BasicOTA.ino*, uncomment the above statement that is already there, and upload the sketch. To make troubleshooting easier, do not modify example sketch besides what is absolutely required. This is including original simple ``` 123 ``` OTA password. Then attempt to upload sketch again (using OTA). After compilation is complete, once upload is about to begin, you should see prompt for password as follows:
![Password prompt for OTA upload](a-ota-upload-password-prompt.png)
Enter the password and upload should be initiated as usual with the only difference being ``` Authenticating...OK ``` message visible in upload log.
![ Authenticating...OK during OTA upload](a-ota-upload-password-authenticating-ok.png)
You will not be prompted for a reentering the same password next time. Arduino IDE will remember it for you. You will see prompt for password only after reopening IDE, or if you change it in your sketch, upload the sketch and then try to upload it again.
Please note, it is possible to reveal password entered previously in Arduino IDE, if IDE has not been closed since last upload. This can be done by enabling *Show verbose output during: upload* in *File > Preferences* and attempting to upload the module.
![Verbose upload output with password passing in plan text](a-ota-upload-password-passing-upload-ok.png)
The picture above shows that the password is visible in log as it is passed to *espota.py* upload script.
Another example below shows situation when password is changed between uploads.
![Verbose output when OTA password has been changed between uploads](a-ota-upload-password-passing-again-upload-ok.png)
When uploading, Arduino IDE used previously entered password, so the upload failed and that has been clearly reported by IDE. Only then IDE prompted for a new password. That was entered correctly and second attempt to upload has been successful.
#### Troubleshooting
If OTA update fails, first step is to check for error messages that may be shown in upload window of Arduino IDE. If this is not providing any useful hints try to upload again while checking what is shown by ESP on serial port. Serial Monitor from IDE will not be useful in that case. When attempting to open it, you will likely see the following:

@ -36,7 +36,7 @@ ESP8266 has a single ADC channel available to users. It may be used either to re
To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V.
To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
To read VCC voltage, use `ESP.getVcc()` and ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
```c++
ADC_MODE(ADC_VCC);