Skip to content

Commit 0b6e56e

Browse files
authored
Merge branch 'master' into pr-305-rf-cal-phy-data
2 parents d42bbdb + d3c8d27 commit 0b6e56e

File tree

7 files changed

+35
-9
lines changed

7 files changed

+35
-9
lines changed

doc/ota_updates/readme.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ In case OTA update fails dead after entering modifications in your sketch, you c
501501
HTTP Server
502502
-----------
503503

504-
``ESPhttpUpdate`` class can check for updates and download a binary file from HTTP web server. It is possible to download updates from every IP or domain address on the network or Internet.
504+
``ESP8266HTTPUpdate`` class can check for updates and download a binary file from HTTP web server. It is possible to download updates from every IP or domain address on the network or Internet.
505505

506506
Note that by default this class closes all other connections except the one used by the update, this is because the update method blocks. This means that if there's another application receiving data then TCP packets will build up in the buffer leading to out of memory errors causing the OTA update to fail. There's also a limited number of receive buffers available and all may be used up by other applications.
507507

@@ -523,6 +523,8 @@ Simple updater downloads the file every time the function is called.
523523

524524
.. code:: cpp
525525
526+
#include <ESP8266httpUpdate.h>
527+
526528
WiFiClient client;
527529
ESPhttpUpdate.update(client, "192.168.0.2", 80, "/arduino.bin");
528530
@@ -535,6 +537,8 @@ The server-side script can respond as follows: - response code 200, and send the
535537

536538
.. code:: cpp
537539
540+
#include <ESP8266httpUpdate.h>
541+
538542
WiFiClient client;
539543
t_httpUpdate_return ret = ESPhttpUpdate.update(client, "192.168.0.2", 80, "/esp/update/arduino.php", "optional current version string here");
540544
switch(ret) {

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,32 @@ bool ESP8266WiFiSTAClass::reconnect() {
353353
}
354354

355355
/**
356-
* Disconnect from the network
357-
* @param wifioff
356+
* Disconnect from the network with clearing saved credentials
357+
* @param wifioff Bool indicating whether STA should be disabled.
358358
* @return one value of wl_status_t enum
359359
*/
360360
bool ESP8266WiFiSTAClass::disconnect(bool wifioff) {
361+
// Disconnect with clearing saved credentials.
362+
return disconnect(wifioff, true);
363+
}
364+
365+
/**
366+
* Disconnect from the network
367+
* @param wifioff Bool indicating whether STA should be disabled.
368+
* @param eraseCredentials Bool indicating whether saved credentials should be erased.
369+
* @return one value of wl_status_t enum
370+
*/
371+
bool ESP8266WiFiSTAClass::disconnect(bool wifioff, bool eraseCredentials) {
361372
bool ret = false;
373+
374+
// Read current config.
362375
struct station_config conf;
363-
*conf.ssid = 0;
364-
*conf.password = 0;
376+
wifi_station_get_config(&conf);
377+
378+
if (eraseCredentials) {
379+
memset(&conf.ssid, 0, sizeof(conf.ssid));
380+
memset(&conf.password, 0, sizeof(conf.password));
381+
}
365382

366383
// API Reference: wifi_station_disconnect() need to be called after system initializes and the ESP8266 Station mode is enabled.
367384
if (WiFi.getMode() & WIFI_STA)

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class ESP8266WiFiSTAClass: public LwipIntf {
4848
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);
4949

5050
bool reconnect();
51+
5152
bool disconnect(bool wifioff = false);
53+
bool disconnect(bool wifioff, bool eraseCredentials);
5254

5355
bool isConnected();
5456

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
208208
DEBUG_HTTP_UPDATE("[httpUpdate] Server header:\n");
209209
DEBUG_HTTP_UPDATE("[httpUpdate] - code: %d\n", code);
210210
DEBUG_HTTP_UPDATE("[httpUpdate] - len: %d\n", len);
211+
if(code != HTTP_CODE_OK) {
212+
DEBUG_HTTP_UPDATE("[httpUpdate] - payload: %s\n", http.getString().c_str());
213+
}
211214

212215
String md5;
213216
if (_md5Sum.length()) {

libraries/Servo/src/Servo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Servo::~Servo() {
5858

5959
uint8_t Servo::attach(int pin)
6060
{
61-
return attach(pin, DEFAULT_MIN_PULSE_WIDTH, DEFAULT_MAX_PULSE_WIDTH);
61+
return attach(pin, _minUs, _maxUs);
6262
}
6363

6464
uint8_t Servo::attach(int pin, uint16_t minUs, uint16_t maxUs)
@@ -94,7 +94,6 @@ void Servo::detach()
9494
delay(REFRESH_INTERVAL / 1000); // long enough to complete active period under all circumstances.
9595
stopWaveform(_pin);
9696
_attached = false;
97-
_valueUs = DEFAULT_NEUTRAL_PULSE_WIDTH;
9897
}
9998
}
10099

libraries/Servo/src/Servo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
//
3030
// attach(pin) - Attaches a servo motor to an i/o pin.
3131
// attach(pin, min, max) - Attaches to a pin setting min and max values in microseconds
32-
// default min is 1000, max is 2000
32+
// attach(pin, min, max, value) - Attaches to a pin setting min, max, and current values in microseconds
33+
// default min is 1000, max is 2000, and value is 1500.
3334
//
3435
// write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
3536
// writeMicroseconds() - Sets the servo pulse width in microseconds

0 commit comments

Comments
 (0)