mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Updater.cpp:
- use new AutoInterruptLock - add delay to give the RTOS some time to handle TCP WiFiClient.cpp - add stopAllexcepted to cancel all TCP excepted one ClientContext.h - add getLocalPort() ESP8266HTTPUpdate.cpp - close all not needed TCP and UDP osapi.h - missing commit from SDK
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#include "Updater.h"
|
||||
#include "Arduino.h"
|
||||
#include "eboot_command.h"
|
||||
#include "interrupts.h"
|
||||
|
||||
//#define DEBUG_UPDATER Serial
|
||||
|
||||
@ -111,28 +112,36 @@ bool UpdaterClass::end(bool evenIfRemaining){
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UpdaterClass::_writeBuffer(){
|
||||
noInterrupts();
|
||||
int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
|
||||
interrupts();
|
||||
yield();
|
||||
if(!rc){
|
||||
noInterrupts();
|
||||
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
||||
interrupts();
|
||||
}
|
||||
interrupts();
|
||||
if (rc) {
|
||||
_error = UPDATE_ERROR_WRITE;
|
||||
_currentAddress = (_startAddress + _size);
|
||||
bool UpdaterClass::_writeBuffer() {
|
||||
int rc = 0;
|
||||
delay(2); // give the rtos some time to handle TCP
|
||||
{
|
||||
AutoInterruptLock(15);
|
||||
rc = SPIEraseSector(_currentAddress / FLASH_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
delay(2); // give the rtos some time to handle TCP
|
||||
|
||||
if(!rc) {
|
||||
{
|
||||
AutoInterruptLock(15);
|
||||
rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
|
||||
}
|
||||
}
|
||||
|
||||
delay(2); // give the rtos some time to handle TCP
|
||||
|
||||
if(rc) {
|
||||
_error = UPDATE_ERROR_WRITE;
|
||||
_currentAddress = (_startAddress + _size);
|
||||
#ifdef DEBUG_UPDATER
|
||||
printError(DEBUG_UPDATER);
|
||||
printError(DEBUG_UPDATER);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
_currentAddress += _bufferLen;
|
||||
_bufferLen = 0;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
_currentAddress += _bufferLen;
|
||||
_bufferLen = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t UpdaterClass::write(uint8_t *data, size_t len) {
|
||||
|
@ -11,6 +11,8 @@
|
||||
#define UPDATE_ERROR_SIZE 4
|
||||
#define UPDATE_ERROR_STREAM 5
|
||||
|
||||
#define DEBUG_UPDATER Serial1
|
||||
|
||||
class UpdaterClass {
|
||||
public:
|
||||
UpdaterClass();
|
||||
|
@ -2,8 +2,11 @@
|
||||
#define ARD_DEBUG_H
|
||||
|
||||
#include <stddef.h>
|
||||
// #define DEBUGV(...) ets_printf(__VA_ARGS__)
|
||||
//#define DEBUGV(...) ets_printf(__VA_ARGS__)
|
||||
|
||||
#ifndef DEBUGV
|
||||
#define DEBUGV(...)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
void hexdump(uint8_t *mem, uint32_t len, uint8_t cols = 16);
|
||||
|
Reference in New Issue
Block a user