Platform IO - problem with SX126x v2.0

Hi,
I am trying to compile the LPWAN Tracker on Platform IO.

I’m hitting the same problem I had a while back with the Arduino IDE.:

Building in release mode
Compiling .pio/build/rak4631/src/acc.cpp.o
Compiling .pio/build/rak4631/src/bat.cpp.o
Compiling .pio/build/rak4631/src/ble.cpp.o
Compiling .pio/build/rak4631/src/display.cpp.o
Compiling .pio/build/rak4631/src/gps.cpp.o
Compiling .pio/build/rak4631/src/loraHandler.cpp.o
Compiling .pio/build/rak4631/src/main.cpp.o
In file included from .pio/libdeps/rak4631/SX126x-Arduino/src/mac/LoRaMacHelper.h:26:0,
                 from .pio/libdeps/rak4631/SX126x-Arduino/src/LoRaWan-Arduino.h:17,
                 from .pio/libdeps/rak4631/SX126x-Arduino/src/LoRaWan-RAK4630.h:4,
                 from src/loraHandler.cpp:12:
.pio/libdeps/rak4631/SX126x-Arduino/src/mac/Commissioning.h:42:2: error: #error "SX126x-Arduino V2.0 does support all LoRaWAN regions without definition of 'REGION_XXYYY.\n\nPlease read detailed information how to use it on https://github.com/beegee-tokyo/SX126x-Arduino/blob/master/README_V2.md"
 #error "SX126x-Arduino V2.0 does support all LoRaWAN regions without definition of 'REGION_XXYYY.\n\nPlease read detailed information how to use it on https://github.com/beegee-tokyo/SX126x-Arduino/blob/master/README_V2.md"
  ^~~~~
.pio/libdeps/rak4631/SX126x-Arduino/src/mac/Commissioning.h:50:0: warning: "REGION_EU868" redefined
 #define REGION_EU868

Obviously I have the wrong version of something, but I have no idea how to determine what it is.

Thanks
Alan

Thanks for bringing this up. I see that I forgot to mention changes for PlatformIO in my WHAT’S NEW IN V2.

You need to remove the entry for the region from platformio.ini file

build_flags =  -DREGION_US915

is no longer allowed. Delete the entry and it will compile.
Make sure you select the correct region as explained here: lmh_init()