ESP32-wroom-32 Az Delivry error compil

Morning alls,
I am beginer with platformio and code.
I try to compil this code for ESP32-wroom-32, and impossible, there are many errors, and I don’t inderstand, I am enought strong.
Normally the code is correctly operationnal, but not me :wink:

'void ServerTemplate<TServer, TClient>::flush() [with TServer = WiFiServer; TClient = WiFiClient]' marked 'override', but does not override
'dataLedPin' was not declared in this scope
'powerLedPin' was not declared in this scope

Someone help me please?
https://github.com/xmow49/MQTT-MailBox

thank’s

This project is horrible and you should not use it. It has multiple problems.

The first error is

In file included from .pio\libdeps\esp32dev\NetApiHelpers\src/ArduinoWiFiServer.h:50:0,
from .pio\libdeps\esp32dev\TelnetStream\src/NetTypes.h:38,
from .pio\libdeps\esp32dev\TelnetStream\src/TelnetStream.h:22,
from src\main.cpp:12:
.pio\libdeps\esp32dev\NetApiHelpers\src/ServerTemplate.h: In instantiation of ‘class ServerTemplate<WiFiServer, WiFiClient>’:
.pio\libdeps\esp32dev\TelnetStream\src/TelnetStream.h:27:13: required from here
.pio\libdeps\esp32dev\NetApiHelpers\src/ServerTemplate.h:118:16: error: ‘void ServerTemplate<TServer, TClient>::flush() [with TServer = WiFiServer; TClient = WiFiClient]’ marked ‘override’, but does not override

Which comes from the TelnetStream library. You see that in the platformio.ini,

[env:esp32dev]
platform = espressif32@3.5.0
board = esp32dev
framework = arduino
lib_deps = 
	adafruit/DHT sensor library@^1.4.2
	adafruit/Adafruit Unified Sensor@^1.1.4
	lbernstone/Tone32@^1.0.0
	adafruit/Adafruit INA219@^1.2.0
	adafruit/Adafruit NeoPixel@^1.10.5
	fbiego/ESP32Time@^2.0.0
	arduino-libraries/NTPClient@^3.2.1
	jandrassy/TelnetStream@^1.2.2

which we note:

  1. espressif32@3.5.0 is outdated by now, from two years ago; it runs under Arduino-ESP32 core 1.0.6.
  2. The wanted version of the TelnetStream was 1.2.2. The SemVer expression ^1.2.2 will make it select the latest 1.x.x version though, which is 1.3.0.

The problem is that the TelnetStream 1.3.0 library is not compatible with the 1.0.6 core anymore. Fruther, the 1.2.2 version was removed from the registry (https://registry.platformio.org/libraries/jandrassy/TelnetStream/versions), the oldest 1.2.x version is 1.2.4. We can of course still download the 1.2.2 version from their github. The 1.2.4 version is good enough, so we use

	jandrassy/TelnetStream@1.2.4

instead of jandrassy/TelnetStream@^1.2.2. That will make that error go away.

Next, and this shows that the project was not well made, are countless errors about undeclared variables, e.g.,

src\main.cpp:27:32: error: 'dataLedPin' was not declared in this scope
 Adafruit_NeoPixel ledMerci(34, dataLedPin, NEO_GRB + NEO_KHZ800);
                                ^
src\main.cpp: In function 'void turnOFFLedMerci()':
src\main.cpp:65:16: error: 'powerLedPin' was not declared in this scope
   digitalWrite(powerLedPin, LOW);
                ^
src\main.cpp:66:16: error: 'dataLedPin' was not declared in this scope
   digitalWrite(dataLedPin, LOW);

Even after renaming src/config_sample.h into src/config.h, these variables / macros just don’t exist in there. There is no e.g. dataLedPin macro in that config file. Only

On the other hand, some declared macros are not used at all. E.g., the main.cpp code does not use ledPin. It only uses dataLedPin. So, we can only guess here what the config_sample.h should be to make the code compile. The given file is just incorrect.

The project will artificially compile if you use the platformio.ini

[env:esp32dev]
platform = espressif32@3.5.0
board = esp32dev
framework = arduino
lib_deps = 
	adafruit/DHT sensor library@^1.4.2
	adafruit/Adafruit Unified Sensor@^1.1.4
	lbernstone/Tone32@^1.0.0
	adafruit/Adafruit INA219@^1.2.0
	adafruit/Adafruit NeoPixel@^1.10.5
	fbiego/ESP32Time@^2.0.0
	arduino-libraries/NTPClient@^3.2.1
	jandrassy/TelnetStream@1.2.4
monitor_speed = 115200
upload_speed = 921600

and as src/config.h (example)

#define batteryPin 33
#define ledPin 5
#define dhtPin 13
#define buzzer 18

#define DHTTYPE DHT22

#define BUTTON_PIN_BITMASK 0x8004 // GPIOs 2 and 15 (2^2 + 2^15)

#define wifi_ssid "WIFI"
#define wifi_password "PASSWORD"

#define mqtt_server "192.168.XX.XX"
#define mqtt_user "admin"
#define mqtt_password "password"

#define letter_topic "mailBox/letter"
#define parcel_topic "mailBox/parcel"
#define battery_topic "mailBox/battery"
#define temp_topic "mailBox/temperature"
#define hum_topic "mailBox/humidity"
#define wifi_topic "mailBox/wifi"

#define dataLedPin ledPin // probably just misnamed
#define powerLedPin 3  // pin to activate power for the neopixels (example)
#define loopState_topic "mailBox/loop"
#define powerINA219 4 // power / enable / shutdown pin for the INA219 (example)
/* bit mask of GPIO numbers which will cause wakeup. Only GPIOs which are have RTC functionality can be used in this bit map: 0,2,4,12-15,25-27,32-39. */
// Example: Button IO15, PIR sensor IO25
#define BUTTON_AND_PIR_BITMASK  ((1 << 15) | (1 << 25)) 
#define BUTTON_BITMASK (1 << 15)
#define buzzerPin buzzer // probably just misnamed
#define parcelStatusPin 17 // LED pin to indicate parcel status (example)
#define parcelPin 20 // input pin to get the parcel state (example)
#define letterStatusPin 21 // LED pin  to indicate letter status (example)
#define letterPin 22 // input pin to get the parcel state (example)
#define battery_voltage_topic "mailBox/batteryVoltage"
#define battery_current_topic "mailBox/batteryCurrent"
#define battery_power_topic "mailBox/batteryPower"
#define battery_energy_topic "mailBox/batteryEnergy"
#define battery_charge_topic "mailBox/batteryCharge"
#define solar_voltage_topic "mailBox/solarVoltage"
#define solar_current_topic "mailBox/solarCurrent"
#define solar_power_topic "mailBox/solarPower"
#define solar_energy_topic "mailBox/solarEnergy"
#define config_deepsleep_topic "mailBox/configDeepSleep"
#define config_avoidMultipleBoot_topic "mailBox/configAvoidMultipleBoot"
#define config_brightness_topic "mailBox/configBrightness"
#define config_charge_topic "mailBox/configCharge"
#define config_pir_topic "mailBox/configPIR"
#define OTA_password "MYOTAPASSWORD"
#define pirPin 23 // PIR sensor pin
#define pir_topic "mailbox/PIR"
#define bootCount_topic "mailbox/bootCount"
#define IP_topic "mailBox/IP"

@maxgerhardt thank you for return.
Well I think the verdict is in, even though I’m a newbie I could see there was something wrong.
Thanks, that will save me time, I’ve been on it for a week.

I have tested your modifications, compilation is ok now, your are my savior.
I try to do running and understant all your comments.
thank you again

@maxgerhardt I try to upload code in ESP, connect is ok, code upload, but 2 errors, what do you think about this ? thk’s

initialization from incompatible pointer type [-Wincompatible-pointer-types]
initialization from incompatible pointer type [-Wincompatible-pointer-types]```

Those are warnings in the core code, not errors. They exist in that version of the Arduino-ESP32 core (1.0.6), they’re normal there. They won’t affect the workings of the code.

Of course, if you upgrade the platform = espressif32@3.5.0 in the platformio.ini to a more recent version, like platform = espressif32@6.9.0 (releases), then that will be using Arduino-ESP32 core 2.0.17, in which these warnings are long resolved. (But maybe other libraries will need a version upgrade too, then).

2 Likes

Sorry Ok for update Espressif , I try fonctionnality tomorrow morning , no error now ,see you later

@maxgerhardt hello,
I tested the operation this morning, the code works.
I can see the topics in mqtt explorer of my home automation box, I continue to work on it.
Thank you very much for your precious help.