Skip to content

Commit ea95f2e

Browse files
committed
Merge remote-tracking branch 'remotes/esp8266/master'
2 parents 0404470 + 8a26750 commit ea95f2e

10 files changed

+141
-36
lines changed

boards.txt

+54-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ thing.name=SparkFun ESP8266 Thing
554554

555555
thing.upload.tool=esptool
556556
thing.upload.speed=921600
557-
thing.upload.resetmethod=nodemcu
557+
thing.upload.resetmethod=ck
558558
thing.upload.maximum_size=434160
559559
thing.upload.maximum_data_size=81920
560560
thing.upload.wait_for_upload_port=true
@@ -606,6 +606,59 @@ thing.menu.UploadSpeed.512000.upload.speed=512000
606606
thing.menu.UploadSpeed.921600=921600
607607
thing.menu.UploadSpeed.921600.upload.speed=921600
608608

609+
##############################################################
610+
thingdev.name=SparkFun ESP8266 Thing Dev
611+
612+
thingdev.upload.tool=esptool
613+
thingdev.upload.speed=921600
614+
thingdev.upload.resetmethod=nodemcu
615+
thingdev.upload.maximum_size=434160
616+
thingdev.upload.maximum_data_size=81920
617+
thingdev.upload.wait_for_upload_port=true
618+
thingdev.serial.disableDTR=true
619+
thingdev.serial.disableRTS=true
620+
621+
thingdev.build.mcu=esp8266
622+
thingdev.build.f_cpu=80000000L
623+
thingdev.build.board=ESP8266_THING_DEV
624+
thingdev.build.core=esp8266
625+
thingdev.build.variant=thing
626+
thingdev.build.flash_mode=dio
627+
# flash chip: AT25SF041 (512 kbyte, 4Mbit)
628+
thingdev.build.flash_size=512K
629+
thingdev.build.flash_ld=eagle.flash.512k64.ld
630+
thingdev.build.flash_freq=40
631+
thingdev.build.debug_port=
632+
thingdev.build.debug_level=
633+
634+
thingdev.menu.CpuFrequency.80=80 MHz
635+
thingdev.menu.CpuFrequency.80.build.f_cpu=80000000L
636+
thingdev.menu.CpuFrequency.160=160 MHz
637+
thingdev.menu.CpuFrequency.160.build.f_cpu=160000000L
638+
639+
thingdev.menu.UploadTool.esptool=Serial
640+
thingdev.menu.UploadTool.esptool.upload.tool=esptool
641+
thingdev.menu.UploadTool.esptool.upload.verbose=-vv
642+
643+
thingdev.menu.UploadSpeed.115200=115200
644+
thingdev.menu.UploadSpeed.115200.upload.speed=115200
645+
thingdev.menu.UploadSpeed.9600=9600
646+
thingdev.menu.UploadSpeed.9600.upload.speed=9600
647+
thingdev.menu.UploadSpeed.57600=57600
648+
thingdev.menu.UploadSpeed.57600.upload.speed=57600
649+
thingdev.menu.UploadSpeed.256000.windows=256000
650+
thingdev.menu.UploadSpeed.256000.upload.speed=256000
651+
thingdev.menu.UploadSpeed.230400.linux=230400
652+
thingdev.menu.UploadSpeed.230400.macosx=230400
653+
thingdev.menu.UploadSpeed.230400.upload.speed=230400
654+
thingdev.menu.UploadSpeed.460800.linux=460800
655+
thingdev.menu.UploadSpeed.460800.macosx=460800
656+
thingdev.menu.UploadSpeed.460800.upload.speed=460800
657+
thingdev.menu.UploadSpeed.512000.windows=512000
658+
thingdev.menu.UploadSpeed.512000.upload.speed=512000
659+
thingdev.menu.UploadSpeed.921600=921600
660+
thingdev.menu.UploadSpeed.921600.upload.speed=921600
661+
609662
##############################################################
610663
esp210.name=SweetPea ESP-210
611664

cores/esp8266/MD5Builder.cpp

+32-33
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,42 @@ void MD5Builder::addHexString(const char * data){
2424
}
2525

2626
bool MD5Builder::addStream(Stream & stream, const size_t total_len) {
27-
const int buf_size = 512;
28-
int bytesleft = total_len;
29-
uint8_t * buf = (uint8_t*) malloc(buf_size);
30-
if(buf) {
31-
while((stream.available() > -1) && (bytesleft > 0)) {
27+
const int buf_size = 512;
28+
int bytesleft = total_len;
29+
uint8_t * buf = (uint8_t*) malloc(buf_size);
30+
if(buf) {
31+
while((stream.available() > -1) && (bytesleft > 0)) {
32+
// get available data size
33+
int sizeAvailable = stream.available();
34+
if(sizeAvailable) {
35+
int readBytes = sizeAvailable;
3236

33-
// get available data size
34-
int sizeAvailable = stream.available();
35-
if(sizeAvailable) {
36-
int readBytes = sizeAvailable;
37-
38-
// read only the asked bytes
39-
if(readBytes > bytesleft) {
40-
readBytes = bytesleft ;
41-
}
37+
// read only the asked bytes
38+
if(readBytes > bytesleft) {
39+
readBytes = bytesleft ;
40+
}
4241

43-
// not read more the buffer can handle
44-
if(readBytes > buf_size) {
45-
readBytes = buf_size;
46-
}
42+
// not read more the buffer can handle
43+
if(readBytes > buf_size) {
44+
readBytes = buf_size;
45+
}
4746

48-
// read data
49-
int bytesread = stream.readBytes(buf, readBytes);
50-
bytesleft -= bytesread;
51-
if(bytesread > 0) {
52-
MD5Update(&_ctx, buf, bytesread);
53-
}
54-
}
55-
// time for network streams
56-
delay(0);
47+
// read data
48+
int bytesread = stream.readBytes(buf, readBytes);
49+
bytesleft -= bytesread;
50+
if(bytesread > 0) {
51+
MD5Update(&_ctx, buf, bytesread);
5752
}
58-
// not free null ptr
59-
free(buf);
60-
return (bytesleft == 0);
61-
} else {
62-
return false;
53+
}
54+
// time for network streams
55+
delay(0);
6356
}
57+
// guaranteed not null
58+
free(buf);
59+
return (bytesleft == 0);
60+
} else {
61+
return false;
62+
}
6463
}
6564

6665
void MD5Builder::calculate(void){
@@ -77,7 +76,7 @@ void MD5Builder::getChars(char * output){
7776
}
7877

7978
String MD5Builder::toString(void){
80-
char out[32];
79+
char out[33];
8180
getChars(out);
8281
return String(out);
8382
}

doc/boards.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ title: Supported Hardware
99
* [NodeMCU 1\.0](#nodemcu-10)
1010
* [Olimex MOD\-WIFI\-ESP8266\-DEV](#olimex-mod-wifi-esp8266-dev)
1111
* [Olimex MOD\-WIFI\-ESP8266](#olimex-mod-wifi-esp8266)
12+
* [Olimex ESP8266\-EVB](#olimex-esp8266-evb)
1213
* [SparkFun ESP8266 Thing](#sparkfun-esp8266-thing)
1314
* [SweetPea ESP\-210](#sweetpea-esp-210)
1415
* [ESPino](#espino)
@@ -77,12 +78,28 @@ Since jumper IO0JP is tied to GPIO0, which is PIN 21, you'll have to ground it b
7778

7879
UART pins for programming and serial I/O are GPIO1 (TXD, pin 3) and GPIO3 (RXD, pin 4).
7980

80-
Get the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/MOD-WIFI-ESP8266-DEV/MOD-WIFI-ESP8266-DEV_schematic.pdf)
81+
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)
8182

8283
## Olimex MOD-WIFI-ESP8266
8384

8485
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.
8586

87+
## Olimex ESP8266-EVB
88+
89+
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).
90+
91+
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.
92+
93+
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.
94+
95+
You can find the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/ESP8266-EVB/ESP8266-EVB_Rev_A.pdf).
96+
97+
[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.
98+
99+
Board variants include:
100+
* ESP8266-EVB-BAT: comes with built-in LiPo charger and step-up converter
101+
* ESP8266-EVB-BAT-BOX: as above, but enclosd in a plastic box (non-weatherproof)
102+
86103
## SparkFun ESP8266 Thing ###
87104

88105
Product page: https://www.sparkfun.com/products/13231

doc/libraries.md

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Libraries that don't rely on low-level access to AVR registers should work well.
142142
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
143143
- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git)
144144
- [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)`
145+
- [Encoder](https://github.com/PaulStoffregen/Encoder) - Arduino library for rotary encoders. Version 1.4 supports ESP8266.
145146
- [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).
146147
- [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.
147148
- [PubSubClient](https://github.com/Imroy/pubsubclient) - MQTT library by @Imroy.
Loading
Loading
Loading
95.7 KB
Loading

doc/ota_updates/ota_updates.md

+35
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ title: OTA Update
1212
* [Application Example](#application-example)
1313
* [Classic OTA](#classic-ota)
1414
* [ArduinoOTA](#arduinoota)
15+
* [Password Protection](#password-protection)
1516
* [Troubleshooting](#troubleshooting)
1617
* [Web Browser](#web-browser)
1718
* [Requirements](#requirements-1)
@@ -228,6 +229,40 @@ IP address: 192.168.1.100
228229
**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.
229230

230231

232+
#### Password Protection
233+
234+
Protecting your OTA uploads with password is really straightforward. All you need to do, is to include the following statement in your code:
235+
236+
```cpp
237+
ArduinoOTA.setPassword((const char *)"123");
238+
239+
```
240+
241+
Where ``` 123 ``` is a sample password that you should replace with your own.
242+
243+
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:
244+
245+
![Password prompt for OTA upload](a-ota-upload-password-prompt.png)
246+
247+
Enter the password and upload should be initiated as usual with the only difference being ``` Authenticating...OK ``` message visible in upload log.
248+
249+
![ Authenticating...OK during OTA upload](a-ota-upload-password-authenticating-ok.png)
250+
251+
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.
252+
253+
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.
254+
255+
![Verbose upload output with password passing in plan text](a-ota-upload-password-passing-upload-ok.png)
256+
257+
The picture above shows that the password is visible in log as it is passed to *espota.py* upload script.
258+
259+
Another example below shows situation when password is changed between uploads.
260+
261+
![Verbose output when OTA password has been changed between uploads](a-ota-upload-password-passing-again-upload-ok.png)
262+
263+
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.
264+
265+
231266
#### Troubleshooting
232267

233268
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:

doc/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ESP8266 has a single ADC channel available to users. It may be used either to re
3636

3737
To read external voltage applied to ADC pin, use `analogRead(A0)`. Input voltage range is 0 — 1.0V.
3838

39-
To read VCC voltage, ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
39+
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:
4040

4141
```c++
4242
ADC_MODE(ADC_VCC);

0 commit comments

Comments
 (0)