pstolarz / OneWireNg

Arduino 1-wire service library. OneWire compatible. Dallas thermometers support.
BSD 2-Clause "Simplified" License
89 stars 20 forks source link

Fix build when using latest version of Arduino ESP32 (v3.0.0 and IDF v5.1) #60

Closed blackhack closed 1 year ago

blackhack commented 1 year ago

On the latest version of Arduino ESP32, those headers are not included by default, causing compilation errors, this doesn't cause problems in older versions.

Tested on both Arduino ESP32 and Arduino As Component of IDF 5.1.1.

d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp:59:3: error: #error "GPIO_PIN_COUNT not defined for this version of SDK"
   59 | # error "GPIO_PIN_COUNT not defined for this version of SDK"

d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp: In member function 'void OneWireNg_ArduinoIdfESP32::initDtaGpio(unsigned int, bool)':
d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp:161:12: error: 'GPIO_IS_VALID_GPIO' was not declared in this scope
  161 |     assert(GPIO_IS_VALID_GPIO((int)pin) && GPIO_IS_VALID_OUTPUT_GPIO((int)pin));
      |            ^~~~~~~~~~~~~~~~~~
d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp:161:44: error: 'GPIO_IS_VALID_OUTPUT_GPIO' was not declared in this scope
  161 |     assert(GPIO_IS_VALID_GPIO((int)pin) && GPIO_IS_VALID_OUTPUT_GPIO((int)pin));
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp:63:25: error: 'GPIO' was not declared in this scope; did you mean 'PI'?
   63 | # define REG_GPIO_IN_LO GPIO.in.val
      |                         ^~~~
d:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master\src\platform\OneWireNg_ArduinoIdfESP32.cpp:170:27: note: in expansion of macro 'REG_GPIO_IN_LO'
  170 |         _dtaGpio.inReg = &REG_GPIO_IN_LO;
      |                           ^~~~~~~~~~~~~~
"D:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++" -MMD -c "@D:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/esp32-arduino-libs/esp32/flags/cpp_flags" -w -Os -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ARDUINO-ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"windows\"" "-DARDUINO_FQBN=\"espressif:arduino-esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=debug,PSRAM=disabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default\"" -DESP32 -DCORE_DEBUG_LEVEL=4 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DARDUINO_USB_CDC_ON_BOOT=0 "@D:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/esp32-arduino-libs/esp32/flags/defines" "-IC:\\Users\\david\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2023917-5960-1sbg54u.xbywf\\DallasTemperature" -iprefix "D:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/esp32-arduino-libs/esp32/include/" "@D:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/esp32-arduino-libs/esp32/flags/includes" "-ID:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32/tools/esp32-arduino-libs/esp32/qio_qspi/include" "-ID:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32\\cores\\esp32" "-ID:\\JDavid\\Development\\Arduino\\Sketch\\hardware\\espressif\\arduino-esp32\\variants\\esp32" "-Id:\\JDavid\\Development\\Arduino\\Sketch\\libraries\\OneWireNg-master\\src" "@C:\\Users\\david\\AppData\\Local\\Temp\\arduino\\sketches\\364C1B05CE87BB2EF11E96D015E13B20/build_opt.h" "d:\\JDavid\\Development\\Arduino\\Sketch\\libraries\\OneWireNg-master\\src\\platform\\Platform_Delay.cpp" -o "C:\\Users\\david\\AppData\\Local\\Temp\\arduino\\sketches\\364C1B05CE87BB2EF11E96D015E13B20\\libraries\\OneWireNg-master\\platform\\Platform_Delay.cpp.o"

Using library OneWireNg at version 0.13.1 in folder: D:\JDavid\Development\Arduino\Sketch\libraries\OneWireNg-master 
brentru commented 1 year ago

@pstolarz Please consider merging in and re-releasing.

related: https://github.com/espressif/arduino-esp32/issues/8776

pstolarz commented 1 year ago

Thanks for this. I'll need to fix CI/CD environment. I'm a little bit busy now, so give me a while...

pstolarz commented 1 year ago

v0.13.2 just released.