PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
606 stars 391 forks source link

Bug in release 2.3.8: extra tokens at end of #undef directive #133

Open pixelfriese opened 11 months ago

pixelfriese commented 11 months ago

Description

Since the new version 2.3.8, error messages are displayed during the build process. No error messages appear in version 2.3.7.

Steps To Reproduce Problem

The error occurs directly in the build process of the library. Platformio is used with an ESP32 DevKit V1. OneWire is used as a dependency for the milesburton/DallasTemperature @ 3.11.0 library.

Hardware & Software

Board ESP32 DevKitV1 Shields / modules used no Arduino IDE version PlatformIO 6.1.11 Teensyduino version (if using Teensy) no Version info & package name (from Tools > Boards > Board Manager) paulstoffregen/OneWire @ 2.3.8 Operating system & version Windows 11 Any other software or hardware? no

Arduino Sketch

OneWire\OneWire.cpp

// undef defines for no particular reason
#ifdef ARDUINO_ARCH_ESP32
#  undef noInterrupts() {portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;portENTER_CRITICAL(&mux)
#  undef interrupts() portEXIT_CRITICAL(&mux);}
#endif
// for info on this, search "IRAM_ATTR" at https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/general-notes.html 
#undef CRIT_TIMING 

Errors or Incorrect Output

.pio/libdeps/myproject/OneWire/OneWire.cpp:599:22: warning: extra tokens at end of #undef directive
 #  undef noInterrupts() {portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;portENTER_CRITICAL(&mux)
                      ^
.pio/libdeps/myproject/OneWire/OneWire.cpp:600:20: warning: extra tokens at end of #undef directive
 #  undef interrupts() portEXIT_CRITICAL(&mux);}
Finnitio commented 10 months ago

That happens to me too when building. I use a a esp32doit-devkit-v1 board. I use Platformio 3.3.2 with vscode. Going back to version 2.3.7 fixed the issue. Interestingly on another machine with vscode and platformio 3.3.2 the error does not occur.

Nik-mayak commented 10 months ago

The problem is solved like this: after # undef noInterrupts and # undef Interrupts nothing else is needed in file OneWire.cpp.

ifdef ARDUINO_ARCH_ESP32

undef noInterrupts // () {portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;portENTER_CRITICAL(&mux)

undef interrupts // () portEXIT_CRITICAL(&mux);}

endif

LoQue90 commented 9 months ago

@Nik-mayak are you going to open a PR on this?

mathieucarbou commented 8 months ago

@PaulStoffregen : would it be possible to merge this PR and issue a new release and deploy in platformio registry ? Thanks!