mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
add synchronous ota
This commit is contained in:
parent
e7b7d6d8b7
commit
b605ab316e
Binary file not shown.
@ -114,8 +114,12 @@ bool UpdaterClass::end(bool evenIfRemaining){
|
|||||||
bool UpdaterClass::_writeBuffer(){
|
bool UpdaterClass::_writeBuffer(){
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
|
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
|
||||||
if (!rc) {
|
interrupts();
|
||||||
|
yield();
|
||||||
|
if(!rc){
|
||||||
|
noInterrupts();
|
||||||
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
||||||
|
interrupts();
|
||||||
}
|
}
|
||||||
interrupts();
|
interrupts();
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
@ -48,12 +48,14 @@ def serve(remoteAddr, remotePort, filename):
|
|||||||
sys.stderr.write('Uploading')
|
sys.stderr.write('Uploading')
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
while True:
|
while True:
|
||||||
chunk = f.read(4096)
|
chunk = f.read(1460)
|
||||||
if not chunk: break
|
if not chunk: break
|
||||||
sys.stderr.write('.')
|
sys.stderr.write('.')
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
connection.settimeout(10)
|
||||||
try:
|
try:
|
||||||
connection.sendall(chunk)
|
connection.sendall(chunk)
|
||||||
|
res = connection.recv(4)
|
||||||
except:
|
except:
|
||||||
print('\nError Uploading', file=sys.stderr)
|
print('\nError Uploading', file=sys.stderr)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
@ -15,12 +15,6 @@ struct ip_info {
|
|||||||
struct ip_addr gw;
|
struct ip_addr gw;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IP4_ADDR(ipaddr, a,b,c,d) \
|
|
||||||
(ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \
|
|
||||||
((uint32)((c) & 0xff) << 16) | \
|
|
||||||
((uint32)((b) & 0xff) << 8) | \
|
|
||||||
(uint32)((a) & 0xff)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if two address are on the same network.
|
* Determine if two address are on the same network.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user