CoogleIOT icon indicating copy to clipboard operation
CoogleIOT copied to clipboard

CoogleIOT issues with newer esp8266 Arduino cores (3.0.x)

Open mikeofqyn opened this issue 4 years ago • 0 comments

Changes needed to make CoogleIOT compile and run on current esp8266 cores

1) Function removed from ESP8222 core API

From ESP8266 Arduino core 3.0.0 version onwards the following prototype (previously deprecated) has been removed:

HTTPUpdateResult ESPhttpUpdate::update(const char* host, int& port, const char* uri, const char * currentVersion);

This methotd is used in CoogleIOT::checkForFirmwareUpdate() at CoogleIOT.cpp line 987 (library version 1.3.1).

Od call:

firmwareUpdateStatus = ESPhttpUpdate.update(URL.m_Host.c_str(), port, URL.m_Path.c_str(), COOGLEIOT_VERSION);

The current prototype is

HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient & client, const String & host, uint16_t port, const String & uri, const String & currentVersion) 

The call sholud be replaced with something like (it worked for me):

const String ver_str = COOGLEIOT_VERSION;
const String uri_str = URL.m_Path.c_str();
const String host_str = URL.m_Host.c_str();
firmwareUpdateStatus = ESPhttpUpdate.update(espClient, host_str, port, uri_str, ver_str);  

**2) Missing return value in CoogleIOT::verifyFlashConfiguration();**

The memeber function bool CoogleIOT::verifyFlashConfiguration() lacks a 'return ` statement. Quite puzzingly (for me) the compiler does not complain, but the code crashes on return of this function. The ESP exception decoder does not help too much, by the way, as it locates the fault elsewhere.

Just adding

return true;

at the end of the function (line 367) solves the problem and the initialization proceeds normally.

mikeofqyn avatar Sep 18 '21 17:09 mikeofqyn