jeroenvermeulen / JeVe_EasyOTA

Making ESP8266 OTA Updates easy to include in your project
GNU General Public License v3.0
24 stars 11 forks source link

Problems compiling for ESP32 (works great for ESP8266) #13

Open DAKarp opened 4 years ago

DAKarp commented 4 years ago

I've been using this library for a while with an ESP8266 - works great. But when I compile it against the ESP32 platform (using PlatformIO), I get a bunch of errors, such as:

/.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp: In member function 'int EasyOTA::scanWifi(long unsigned int)': /.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp:247:5: error: 'uint8' was not declared in this scope uint8 bestBSSID[6]; ^ /.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp:261:96: error: no matching function for call to 'WiFiClass::getNetworkInfo(int8_t&, String&, uint8_t&, int32_t&, uint8_t*&, int32_t&, bool&)' WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan, hidden_scan); ^ /.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp:279:25: error: 'ENC_TYPE_NONE' was not declared in this scope if ((sec_scan == ENC_TYPE_NONE && _allowOpen && exhausted) || cap) { ^ ^ /.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp: In member function 'void EasyOTA::loop(long unsigned int)': /.platformio/lib/EasyOTA_ID1975/src/JeVe_EasyOTA.cpp:327:31: error: no matching function for call to 'WiFiClass::setHostname(String&)' WiFi.setHostname(_hostname); ^ /.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiSTA.h:76:10: note: no known conversion for argument 1 from 'String' to 'const char*'

Any suggestions?

jeroenvermeulen commented 4 years ago

Can you try it in the Arduino IDE with the ESP32 add-on? You are welcome to propose a PR to make this library also compatible for PlatformIO.

DAKarp commented 4 years ago

Thanks for the reply. Didn’t try on Arduino ide because I don’t have that set up. But ArduinoOTA worked just fine, so I’m using that.

I suspect there’s a dependency of easyota that’s included in the esp8266 platform (and not esp32) but that isn’t explicitly required by the easyota lib.

KissInno commented 4 years ago

Your lib looks short & I'd like to try it. However, I cannot compile your example from PlatformIO with Arduino framework, neither with ESP32 nor ESP8266 MCU:

ESP8266: no matching function for call to 'EasyOTA::onMessage(setup()::__lambda0)'

ESP32: invalid user-defined conversion from 'setup()::<lambda(char*, int)>' to 'int' [-fpermissive]

And once you enjoyed PlatformIO, it is hard to get back to Arduino IDE.

jeroenvermeulen commented 4 years ago

Can you fix it? A pull request would be welcome.

On 3 Jan 2020, at 15:19, KissInno notifications@github.com wrote:

 Your lib looks short & I'd like to try it. However, I cannot compile your example from PlatformIO with Arduino framework, neither with ESP32 nor ESP8266 MCU:

ESP8266: no matching function for call to 'EasyOTA::onMessage(setup()::__lambda0)'

ESP32: invalid user-defined conversion from 'setup()::<lambda(char*, int)>' to 'int' [-fpermissive]

And once you enjoyed PlatformIO, it is hard to get back to Arduino IDE.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

dervomsee commented 4 years ago

Hi @KissInno and @jeroenvermeulen, i am using the lib currently in Platformio. For ESP8266 it works great. The onMessage callback function needs to be configured in the following way:

void displayLine(const String &message, int line_nr)
{
  Serial.println(message);
}

This function needs to be declared before the setup function. With the library you can connect it in the following way:

OTA.onMessage(&displayLine); 

The following short version does work for me either. It generates the error error: no matching function for call to 'EasyOTA::onMessage(setup()::<lambda(char*, int)>)

OTA.onMessage([](char *message, int line) {
    Serial.println(message);
  });

With a version for ESP32 i'm also struggling. When i have a result for that, i will post it here.

BR, Cornelius