Heltec WiFi32 LoRa V3 problem with onewire library

using Arduino IDE 2.3.9 with ESP32 core 3.3.10 attempting to use the <OneWire.h> library with “LoRaWan_APP.h” gives compilation errors
simplified code

#include "LoRaWan_APP.h"
#include <OneWire.h>
void setup() {
}

void loop() {
}

gives compilation error

c:\Users\drbri\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeInput(uint32_t)':
C:\Users\drbri\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.10\cores\esp32/esp32-hal-gpio.h:68:34: error: 'GPIO_IS_VALID_GPIO' was not declared in this scope; did you mean 'RTC_GPIO_IS_VALID_GPIO'?
   68 | #define digitalPinIsValid(pin)   GPIO_IS_VALID_GPIO(pin)
      |                                  ^~~~~~~~~~~~~~~~~~
c:\Users\drbri\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:214:10: note: in expansion of macro 'digitalPinIsValid'
  214 |     if ( digitalPinIsValid(pin) )
      |          ^~~~~~~~~~~~~~~~~
c:\Users\drbri\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeOutput(uint32_t)':
C:\Users\drbri\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.10\cores\esp32/esp32-hal-gpio.h:68:34: error: 'GPIO_IS_VALID_GPIO' was not declared in this scope; did you mean 'RTC_GPIO_IS_VALID_GPIO'?
   68 | #define digitalPinIsValid(pin)   GPIO_IS_VALID_GPIO(pin)
      |                                  ^~~~~~~~~~~~~~~~~~
c:\Users\drbri\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:240:10: note: in expansion of macro 'digitalPinIsValid'
  240 |     if ( digitalPinIsValid(pin) && pin <= 33 ) // pins above 33 can be only inputs
      |          ^~~~~~~~~~~~~~~~~

just using #include <OneWire.h> compiles OK

The following are the notes I made to myself in relation to this problem (Arduino IDE on macOS). I hope they help.

esp32-hal-gpio.h (Documents/Arduino/hardware/heltec/esp32/cores/esp32/esp32-hal-gpio.h)

There’s a problem with the OneWire library, or more correctly the Heltec ESP32 support software that impacts the OneWire library when using the Heltec WiFi LoRa 32 V3 (or V4) board with the LoRaWan_APP library. If left to its own devices, sketches that use both the LoRaWan_APP and OneWire libraries fail to compile, complaining that the GPIO_IS_VALID_GPIO() function was not declared.

To rectify this problem:

  1. Create the directory Arduino/hardware/heltec/esp32/cores/esp32/driver
  2. Copy the file Arduino/hardware/heltec/esp32/tools/esp32-arduino-libs/esp32s3/include/driver/gpio/include/driver/gpio.h to that directory
  3. Edit the file Arduino/hardware/heltec/esp32/cores/esp32/esp32-hal-gpio.h and add the line

#include "driver/gpio.h"

with the other #include statements near the top of the file.

looking at file
C:\Users\drbri\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.10\cores\esp32\esp32-hal-gpio.h it already included “driver/gpio.h”, e.g.

#include "pins_arduino.h"
#include "esp32-hal.h"
#include "soc/soc_caps.h"
#include "driver/gpio.h"

in the end I fixed the problem by hacking the definition so it returns true

#define digitalPinIsValid(pin)   1   //GPIO_IS_VALID_GPIO(pin)

not a good long term solution!

Yes, but there would also appear to have been a problem with the search path that needs to be resolved by either adding the necessary directory to the search path, which had the potential to create more problems (but which was beyond my talent level in any case), or simply copying the required file to a directory that was already in the search path, as suggested.