Skip to content

Commit ff7da0a

Browse files
committed
Merge pull request #532 from me-no-dev/esp8266
add synchronous ota
2 parents ec5df30 + d4ef286 commit ff7da0a

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed
Binary file not shown.

hardware/esp8266com/esp8266/cores/esp8266/Updater.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ bool UpdaterClass::end(bool evenIfRemaining){
114114
bool UpdaterClass::_writeBuffer(){
115115
noInterrupts();
116116
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
117-
if (!rc) {
117+
interrupts();
118+
yield();
119+
if(!rc){
120+
noInterrupts();
118121
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
122+
interrupts();
119123
}
120124
interrupts();
121125
if (rc) {

hardware/esp8266com/esp8266/libraries/ESP8266mDNS/examples/DNS_SD_Arduino_OTA/DNS_SD_Arduino_OTA.ino

+5-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ void loop() {
5454
WiFiClient client;
5555
if (client.connect(remote, port)) {
5656

57-
Serial.setDebugOutput(true);
58-
while(!Update.isFinished()) Update.write(client);
57+
uint32_t written;
58+
while(!Update.isFinished()){
59+
written = Update.write(client);
60+
if(written > 0) client.print(written, DEC);
61+
}
5962
Serial.setDebugOutput(false);
6063

6164
if(Update.end()){

hardware/esp8266com/esp8266/tools/espota.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ def serve(remoteAddr, remotePort, filename):
4848
sys.stderr.write('Uploading')
4949
sys.stderr.flush()
5050
while True:
51-
chunk = f.read(4096)
51+
chunk = f.read(1460)
5252
if not chunk: break
5353
sys.stderr.write('.')
5454
sys.stderr.flush()
55+
connection.settimeout(10)
5556
try:
5657
connection.sendall(chunk)
58+
res = connection.recv(4)
5759
except:
5860
print('\nError Uploading', file=sys.stderr)
5961
connection.close()

hardware/esp8266com/esp8266/tools/sdk/include/ip_addr.h

-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ struct ip_info {
1515
struct ip_addr gw;
1616
};
1717

18-
#define IP4_ADDR(ipaddr, a,b,c,d) \
19-
(ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \
20-
((uint32)((c) & 0xff) << 16) | \
21-
((uint32)((b) & 0xff) << 8) | \
22-
(uint32)((a) & 0xff)
23-
2418
/**
2519
* Determine if two address are on the same network.
2620
*

0 commit comments

Comments
 (0)