madhephaestus / ESP32Servo

Arduino-compatible servo library for the ESP32
139 stars 55 forks source link

Arduino compile error: void value not ignored as it ought to be #58

Closed abstractBoyd closed 5 months ago

abstractBoyd commented 5 months ago

We have an educational robotics application that relies on this library, and it hasn't compiled with any version from 3.0 up.

I didn't think we were doing anything too crazy, but the current error is: Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:312:42: error: void value not ignored as it ought to be success=ledcAttachPin(pin, getChannel());

Using library ESP32Servo at version 3.0.4 in folder:

-Boyd

abstractBoyd commented 5 months ago

More info about the board driver version: FQBN: esp32-bluepad32:esp32:esp32 Using board 'esp32' from platform in folder: C:\Users**\AppData\Local\Arduino15\packages\esp32-bluepad32\hardware\esp32\4.1.0 Using core 'esp32' from platform in folder: C:\Users**\AppData\Local\Arduino15\packages\esp32-bluepad32\hardware\esp32\4.1.0

CrazyLegoMind commented 5 months ago

Hi, same issue here, with this error code compili fromn vscode and platformio: Compiling .pio\build\robot_maresciallo\lib7f6\ESP32Servo\ESP32PWM.cpp.o .pio/libdeps/robot_maresciallo/ESP32Servo/src/ESP32PWM.cpp: In member function 'void ESP32PWM::attachPin(uint8_t)': .pio/libdeps/robot_maresciallo/ESP32Servo/src/ESP32PWM.cpp:312:42: error: void value not ignored as it ought to be success=ledcAttachPin(pin, getChannel()); ^ *** [.pio\build\robot_maresciallo\lib7f6\ESP32Servo\ESP32PWM.cpp.o] Error 1

Apparently the issue line was changed in commit #4684ebf.

Reverting success=ledcAttachPin(pin, getChannel()); to ledcAttachPin(pin, getChannel()); fixed the issue for me as in the new version ledcattachpin no longer returns a bool

You can find that line at ESP32PWM.cpp:312

Uising board = esp32-c3-devkitm-1

update: from me that i was using platformio i have ESP_ARDUINO_VERSION 2.0.9 this and older version uses void ledcAttachPin(uint8_t pin, uint8_t chan), while 3.0.0 version and newer have bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution); so the succes check is valid only for 3.0.0 and newer

alx-1 commented 5 months ago

Hi all, same issue here, thank you for pointing it out :). Also, @abstractBoyd, I'm working with a couple of Unis on a sensor and robotics platform, maybe we should share examples / code / ideas ! The repo is here : https://gitlab.com/darknessdesigner/cajitaabierta at the moment, the examples are in French and Spanish but it would be great to add English examples. It's using ESPparam as a configuration and communication wifi. As a final note, there's a wiki that explains some of our design choices : https://wiki.eavmuqam.ca/manifeste_pour_une_approche_ecologique_de_la_pratique_des_arts_numeriques#manifesto_for_an_eco-responsible_approach_to_digital_arts_practice ++ Alexandre

madhephaestus commented 5 months ago

this should be fixed as of 3.0.5