Skip to content

add synchronous ota #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified hardware/esp8266com/esp8266/bootloaders/eboot/eboot.elf
Binary file not shown.
6 changes: 5 additions & 1 deletion hardware/esp8266com/esp8266/cores/esp8266/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ bool UpdaterClass::end(bool evenIfRemaining){
bool UpdaterClass::_writeBuffer(){
noInterrupts();
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
if (!rc) {
interrupts();
yield();
if(!rc){
noInterrupts();
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
interrupts();
}
interrupts();
if (rc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ void loop() {
WiFiClient client;
if (client.connect(remote, port)) {

Serial.setDebugOutput(true);
while(!Update.isFinished()) Update.write(client);
uint32_t written;
while(!Update.isFinished()){
written = Update.write(client);
if(written > 0) client.print(written, DEC);
}
Serial.setDebugOutput(false);

if(Update.end()){
Expand Down
4 changes: 3 additions & 1 deletion hardware/esp8266com/esp8266/tools/espota.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ def serve(remoteAddr, remotePort, filename):
sys.stderr.write('Uploading')
sys.stderr.flush()
while True:
chunk = f.read(4096)
chunk = f.read(1460)
if not chunk: break
sys.stderr.write('.')
sys.stderr.flush()
connection.settimeout(10)
try:
connection.sendall(chunk)
res = connection.recv(4)
except:
print('\nError Uploading', file=sys.stderr)
connection.close()
Expand Down
6 changes: 0 additions & 6 deletions hardware/esp8266com/esp8266/tools/sdk/include/ip_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ struct ip_info {
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.
*
Expand Down