cotestatnt / esp-fs-webserver

ESP32/ESP8266 webserver, WiFi manager and web editor Arduino library
MIT License
105 stars 27 forks source link

ESP32 could not convert '{"input", "INPUT 2", 2, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' #13

Closed StefanL38 closed 1 year ago

StefanL38 commented 2 years ago

I tried to compile the gpio_list-example for ESP32 and got this error exit status 1 could not convert '{"input", "INPUT 2", 2, 0}' from '' to 'gpio_type'

first I thought this might be because the declaring of the array

gpio_type gpios[NUM_GPIOS] = {
  {"input", "INPUT 2", 2 },
  {"input", "INPUT 4", 4},
  {"input", "INPUT 5", 5},
  {"output", "OUTPUT 6", 6},
  {"output", "OUTPUT 7", 7},
  {"output", "LED BUILTIN", 3} // Led ON with signal HIGH (ESP32-C3)
};

is missing the fourth parameter bool level = LOW;

// Define a struct for store all info about each gpio
struct gpio_type {
  const char* type;
  const char* label;
  int pin;
  bool level = LOW;
};

but this was mot the problem I got the same compiler-error-message after adding the fourth parameter

gpio_type gpios[NUM_GPIOS] = {
  {"input", "INPUT 2", 2, LOW},
  {"input", "INPUT 4", 4, LOW},
  {"input", "INPUT 5", 5, LOW},
  {"output", "OUTPUT 6", 6, LOW},
  {"output", "OUTPUT 7", 7, LOW},
  {"output", "LED BUILTIN", 3, LOW} // Led ON with signal HIGH (ESP32-C3)
};

the astonishing thing is if I compile for an ESP8266 it does compile and the serial monitor shows how the ESP8266 connects to my WiFi but then the IP-adress is unavailable

Here is the compilerlog

gpio_list-ESP32-004:49:1: error: could not convert '{"input", "INPUT 2", 2, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' }; ^ gpio_list-ESP32-004:49:1: error: could not convert '{"input", "INPUT 4", 4, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' gpio_list-ESP32-004:49:1: error: could not convert '{"input", "INPUT 5", 5, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' gpio_list-ESP32-004:49:1: error: could not convert '{"output", "OUTPUT 6", 6, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' gpio_list-ESP32-004:49:1: error: could not convert '{"output", "OUTPUT 7", 7, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' gpio_list-ESP32-004:49:1: error: could not convert '{"output", "LED BUILTIN", 3, 0}' from '<brace-enclosed initializer list>' to 'gpio_type' Mehrere Bibliotheken wurden für "WiFi.h" gefunden Benutzt: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\WiFi Mehrere Bibliotheken wurden für "ArduinoJson.h" gefunden Benutzt: F:\myData\Arduino\libraries\ArduinoJson Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\ArduinoJson Mehrere Bibliotheken wurden für "WebSocketsServer.h" gefunden Benutzt: F:\myData\Arduino\libraries\WebSockets Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\WebSockets Bibliothek WebSockets in Version 2.3.6 im Ordner: F:\myData\Arduino\libraries\WebSockets wird verwendet Bibliothek WiFi in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi wird verwendet Bibliothek WiFiClientSecure in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFiClientSecure wird verwendet Bibliothek esp-fs-webserver in Version 1.1.3 im Ordner: F:\myData\Arduino\libraries\esp-fs-webserver wird verwendet Bibliothek FS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\FS wird verwendet Bibliothek ArduinoJson in Version 6.19.4 im Ordner: F:\myData\Arduino\libraries\ArduinoJson wird verwendet Bibliothek WebServer in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WebServer wird verwendet Bibliothek ESPmDNS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\ESPmDNS wird verwendet Bibliothek HTTPUpdateServer in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\HTTPUpdateServer wird verwendet Bibliothek SPIFFS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\SPIFFS wird verwendet Bibliothek Update in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\Update wird verwendet Bibliothek DNSServer in Version 1.1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\DNSServer wird verwendet Bibliothek LittleFS_esp32 in Version 1.0.6 im Ordner: F:\myData\Arduino\libraries\LittleFS_esp32 wird verwendet exit status 1 could not convert '{"input", "INPUT 2", 2, 0}' from '<brace-enclosed initializer list>' to 'gpio_type'

best regards Stefan

cotestatnt commented 2 years ago

Thanks for the tip! The example gpio_list.ino needs to be updated for ESP32...

Now it should work as expected.

StefanL38 commented 2 years ago

Hi cotestatnt,

I tried your new version of gpio_list.ino

first I had LittleFs.h installed under libraries and got the error fatal error: flash_utils.h: No such file or directory compiler-log `Mehrere Bibliotheken wurden für "WebSocketsServer.h" gefunden

Benutzt: F:\myData\Arduino\libraries\WebSockets

Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\WebSockets

Mehrere Bibliotheken wurden für "WiFi.h" gefunden

Benutzt: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi

Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\WiFi

Mehrere Bibliotheken wurden für "ArduinoJson.h" gefunden

Benutzt: F:\myData\Arduino\libraries\ArduinoJson

Nicht benutzt: E:\Arduino-funktioniert\arduino-1.8.19-windows-2022-01-30\arduino-1.8.19\libraries\ArduinoJson

Bibliothek WebSockets in Version 2.3.6 im Ordner: F:\myData\Arduino\libraries\WebSockets wird verwendet

Bibliothek WiFi in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi wird verwendet

Bibliothek WiFiClientSecure in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFiClientSecure wird verwendet

Bibliothek esp-fs-webserver in Version 1.1.3 im Ordner: F:\myData\Arduino\libraries\esp-fs-webserver wird verwendet

Bibliothek FS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\FS wird verwendet

Bibliothek ArduinoJson in Version 6.19.4 im Ordner: F:\myData\Arduino\libraries\ArduinoJson wird verwendet

Bibliothek WebServer in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WebServer wird verwendet

Bibliothek ESPmDNS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\ESPmDNS wird verwendet

Bibliothek HTTPUpdateServer in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\HTTPUpdateServer wird verwendet

Bibliothek SPIFFS in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\SPIFFS wird verwendet

Bibliothek Update in Version 1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\Update wird verwendet

Bibliothek DNSServer in Version 1.1.0 im Ordner: C:\Users\dipl-\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\DNSServer wird verwendet

exit status 1

LittleFS.h: No such file or directory ` now I'm stumped and don't know what I did wrong

StefanL38 commented 2 years ago

Addition I do have installed the actual board-versions grafik

cotestatnt commented 2 years ago

As written in the other post, the reason you can't compile the example is due to the very old version of ESP32 Arduino Core.