Skip to content

Commit d0316a1

Browse files
Merge branch 'master' into pr-eboot-cs-fix
2 parents fe7faf7 + 63b73bf commit d0316a1

File tree

4 files changed

+584
-18
lines changed

4 files changed

+584
-18
lines changed

cores/esp8266/Esp.cpp

+18-17
Original file line numberDiff line numberDiff line change
@@ -468,23 +468,24 @@ bool EspClass::checkFlashCRC() {
468468

469469

470470
String EspClass::getResetReason(void) {
471-
char buff[32];
472-
if (resetInfo.reason == REASON_DEFAULT_RST) { // normal startup by power on
473-
strcpy_P(buff, PSTR("Power on"));
474-
} else if (resetInfo.reason == REASON_WDT_RST) { // hardware watch dog reset
475-
strcpy_P(buff, PSTR("Hardware Watchdog"));
476-
} else if (resetInfo.reason == REASON_EXCEPTION_RST) { // exception reset, GPIO status won’t change
477-
strcpy_P(buff, PSTR("Exception"));
478-
} else if (resetInfo.reason == REASON_SOFT_WDT_RST) { // software watch dog reset, GPIO status won’t change
479-
strcpy_P(buff, PSTR("Software Watchdog"));
480-
} else if (resetInfo.reason == REASON_SOFT_RESTART) { // software restart ,system_restart , GPIO status won’t change
481-
strcpy_P(buff, PSTR("Software/System restart"));
482-
} else if (resetInfo.reason == REASON_DEEP_SLEEP_AWAKE) { // wake up from deep-sleep
483-
strcpy_P(buff, PSTR("Deep-Sleep Wake"));
484-
} else if (resetInfo.reason == REASON_EXT_SYS_RST) { // external system reset
485-
strcpy_P(buff, PSTR("External System"));
486-
} else {
487-
strcpy_P(buff, PSTR("Unknown"));
471+
const __FlashStringHelper* buff;
472+
473+
switch(resetInfo.reason) {
474+
// normal startup by power on
475+
case REASON_DEFAULT_RST: buff = F("Power On"); break;
476+
// hardware watch dog reset
477+
case REASON_WDT_RST: buff = F("Hardware Watchdog"); break;
478+
// exception reset, GPIO status won’t change
479+
case REASON_EXCEPTION_RST: buff = F("Exception"); break;
480+
// software watch dog reset, GPIO status won’t change
481+
case REASON_SOFT_WDT_RST: buff = F("Software Watchdog"); break;
482+
// software restart ,system_restart , GPIO status won’t change
483+
case REASON_SOFT_RESTART: buff = F("Software/System restart"); break;
484+
// wake up from deep-sleep
485+
case REASON_DEEP_SLEEP_AWAKE: buff = F("Deep-Sleep Wake"); break;
486+
// // external system reset
487+
case REASON_EXT_SYS_RST: buff = F("External System"); break;
488+
default: buff = F("Unknown"); break;
488489
}
489490
return String(buff);
490491
}

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,8 @@ int HTTPClient::sendRequest(const char * type, const uint8_t * payload, size_t s
681681
if (payload && size > 0) {
682682
size_t bytesWritten = 0;
683683
const uint8_t *p = payload;
684-
while (bytesWritten < size) {
684+
size_t originalSize = size;
685+
while (bytesWritten < originalSize) {
685686
int written;
686687
int towrite = std::min((int)size, (int)HTTP_TCP_BUFFER_SIZE);
687688
written = _client->write(p + bytesWritten, towrite);

0 commit comments

Comments
 (0)