diff --git a/platformio.ini b/platformio.ini index 6f2a13865..4c85e2dd7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -60,26 +60,26 @@ build_flags = -Wno-missing-field-initializers -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DPB_ENABLE_MALLOC=1 - -DRADIOLIB_EXCLUDE_CC1101 - -DRADIOLIB_EXCLUDE_NRF24 - -DRADIOLIB_EXCLUDE_RF69 - -DRADIOLIB_EXCLUDE_SX1231 - -DRADIOLIB_EXCLUDE_SX1233 - -DRADIOLIB_EXCLUDE_SI443X - -DRADIOLIB_EXCLUDE_RFM2X - -DRADIOLIB_EXCLUDE_AFSK - -DRADIOLIB_EXCLUDE_BELL - -DRADIOLIB_EXCLUDE_HELLSCHREIBER - -DRADIOLIB_EXCLUDE_MORSE - -DRADIOLIB_EXCLUDE_RTTY - -DRADIOLIB_EXCLUDE_SSTV - -DRADIOLIB_EXCLUDE_AX25 - -DRADIOLIB_EXCLUDE_DIRECT_RECEIVE - -DRADIOLIB_EXCLUDE_BELL - -DRADIOLIB_EXCLUDE_PAGER - -DRADIOLIB_EXCLUDE_FSK4 - -DRADIOLIB_EXCLUDE_APRS - -DRADIOLIB_EXCLUDE_LORAWAN + -DRADIOLIB_EXCLUDE_CC1101=1 + -DRADIOLIB_EXCLUDE_NRF24=1 + -DRADIOLIB_EXCLUDE_RF69=1 + -DRADIOLIB_EXCLUDE_SX1231=1 + -DRADIOLIB_EXCLUDE_SX1233=1 + -DRADIOLIB_EXCLUDE_SI443X=1 + -DRADIOLIB_EXCLUDE_RFM2X=1 + -DRADIOLIB_EXCLUDE_AFSK=1 + -DRADIOLIB_EXCLUDE_BELL=1 + -DRADIOLIB_EXCLUDE_HELLSCHREIBER=1 + -DRADIOLIB_EXCLUDE_MORSE=1 + -DRADIOLIB_EXCLUDE_RTTY=1 + -DRADIOLIB_EXCLUDE_SSTV=1 + -DRADIOLIB_EXCLUDE_AX25=1 + -DRADIOLIB_EXCLUDE_DIRECT_RECEIVE=1 + -DRADIOLIB_EXCLUDE_BELL=1 + -DRADIOLIB_EXCLUDE_PAGER=1 + -DRADIOLIB_EXCLUDE_FSK4=1 + -DRADIOLIB_EXCLUDE_APRS=1 + -DRADIOLIB_EXCLUDE_LORAWAN=1 -DMESHTASTIC_EXCLUDE_DROPZONE=1 -DMESHTASTIC_EXCLUDE_REMOTEHARDWARE=1 -DBUILD_EPOCH=$UNIX_TIME diff --git a/src/main.cpp b/src/main.cpp index dfad9efbf..c11995837 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -885,7 +885,7 @@ void setup() } #endif -#if defined(RF95_IRQ) +#if defined(RF95_IRQ) && RADIOLIB_EXCLUDE_SX127X != 1 if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { rIf = new RF95Interface(RadioLibHAL, LORA_CS, RF95_IRQ, RF95_RESET, RF95_DIO1); if (!rIf->init()) { @@ -899,7 +899,7 @@ void setup() } #endif -#if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && !defined(TCXO_OPTIONAL) +#if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && !defined(TCXO_OPTIONAL) && RADIOLIB_EXCLUDE_SX126X != 1 if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); if (!rIf->init()) { @@ -975,7 +975,7 @@ void setup() } #endif -#if defined(USE_LR1110) +#if defined(USE_LR1110) && RADIOLIB_EXCLUDE_LR11X0 != 1 if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { rIf = new LR1110Interface(RadioLibHAL, LR1110_SPI_NSS_PIN, LR1110_IRQ_PIN, LR1110_NRESET_PIN, LR1110_BUSY_PIN); if (!rIf->init()) { @@ -989,7 +989,7 @@ void setup() } #endif -#if defined(USE_LR1120) +#if defined(USE_LR1120) && RADIOLIB_EXCLUDE_LR11X0 != 1 if (!rIf) { rIf = new LR1120Interface(RadioLibHAL, LR1120_SPI_NSS_PIN, LR1120_IRQ_PIN, LR1120_NRESET_PIN, LR1120_BUSY_PIN); if (!rIf->init()) { @@ -1003,7 +1003,7 @@ void setup() } #endif -#if defined(USE_LR1121) +#if defined(USE_LR1121) && RADIOLIB_EXCLUDE_LR11X0 != 1 if (!rIf) { rIf = new LR1121Interface(RadioLibHAL, LR1121_SPI_NSS_PIN, LR1121_IRQ_PIN, LR1121_NRESET_PIN, LR1121_BUSY_PIN); if (!rIf->init()) { @@ -1017,7 +1017,7 @@ void setup() } #endif -#if defined(USE_SX1280) +#if defined(USE_SX1280) && RADIOLIB_EXCLUDE_SX128X != 1 if (!rIf) { rIf = new SX1280Interface(RadioLibHAL, SX128X_CS, SX128X_DIO1, SX128X_RESET, SX128X_BUSY); if (!rIf->init()) { @@ -1032,7 +1032,6 @@ void setup() #endif // check if the radio chip matches the selected region - if ((config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) { LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n"); config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index 329f0b48e..2720e8525 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -8,13 +8,19 @@ #include "api/ServerAPI.h" // We need this declaration for proper linking in derived classes +#if RADIOLIB_EXCLUDE_SX126X != 1 template class SX126xInterface; template class SX126xInterface; template class SX126xInterface; +#endif +#if RADIOLIB_EXCLUDE_SX128X != 1 template class SX128xInterface; +#endif +#if RADIOLIB_EXCLUDE_LR11X0 != 1 template class LR11x0Interface; template class LR11x0Interface; template class LR11x0Interface; +#endif #ifdef ARCH_STM32WL template class SX126xInterface; #endif diff --git a/src/mesh/LLCC68Interface.cpp b/src/mesh/LLCC68Interface.cpp index 8109765a6..d92ea5450 100644 --- a/src/mesh/LLCC68Interface.cpp +++ b/src/mesh/LLCC68Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "LLCC68Interface.h" #include "configuration.h" #include "error.h" @@ -6,4 +7,5 @@ LLCC68Interface::LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R RADIOLIB_PIN_TYPE busy) : SX126xInterface(hal, cs, irq, rst, busy) { -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/LLCC68Interface.h b/src/mesh/LLCC68Interface.h index 7e0fa1439..1cd23e92b 100644 --- a/src/mesh/LLCC68Interface.h +++ b/src/mesh/LLCC68Interface.h @@ -1,5 +1,5 @@ #pragma once - +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "SX126xInterface.h" /** @@ -15,4 +15,5 @@ class LLCC68Interface : public SX126xInterface public: LLCC68Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/mesh/LR1110Interface.cpp b/src/mesh/LR1110Interface.cpp index c000bd838..5dbd3ff38 100644 --- a/src/mesh/LR1110Interface.cpp +++ b/src/mesh/LR1110Interface.cpp @@ -1,3 +1,5 @@ +#if RADIOLIB_EXCLUDE_LR11X0 != 1 + #include "LR1110Interface.h" #include "configuration.h" #include "error.h" @@ -6,4 +8,5 @@ LR1110Interface::LR1110Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R RADIOLIB_PIN_TYPE busy) : LR11x0Interface(hal, cs, irq, rst, busy) { -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/LR1110Interface.h b/src/mesh/LR1110Interface.h index 79e7c36ca..2a2e6e861 100644 --- a/src/mesh/LR1110Interface.h +++ b/src/mesh/LR1110Interface.h @@ -1,5 +1,5 @@ #pragma once - +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "LR11x0Interface.h" /** @@ -10,4 +10,5 @@ class LR1110Interface : public LR11x0Interface public: LR1110Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/mesh/LR1120Interface.cpp b/src/mesh/LR1120Interface.cpp index 07e9e508d..a17ac87ef 100644 --- a/src/mesh/LR1120Interface.cpp +++ b/src/mesh/LR1120Interface.cpp @@ -1,3 +1,5 @@ +#if RADIOLIB_EXCLUDE_LR11X0 != 1 + #include "LR1120Interface.h" #include "configuration.h" #include "error.h" @@ -11,4 +13,5 @@ LR1120Interface::LR1120Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R bool LR1120Interface::wideLora() { return true; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/LR1120Interface.h b/src/mesh/LR1120Interface.h index a03fa0b20..d81a480a9 100644 --- a/src/mesh/LR1120Interface.h +++ b/src/mesh/LR1120Interface.h @@ -1,7 +1,7 @@ #pragma once +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "LR11x0Interface.h" - /** * Our adapter for LR1120 wideband radios */ @@ -11,4 +11,5 @@ class LR1120Interface : public LR11x0Interface LR1120Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); bool wideLora() override; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/mesh/LR1121Interface.cpp b/src/mesh/LR1121Interface.cpp index 0d6bba6ea..29bd07d08 100644 --- a/src/mesh/LR1121Interface.cpp +++ b/src/mesh/LR1121Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "LR1121Interface.h" #include "configuration.h" #include "error.h" @@ -11,4 +12,5 @@ LR1121Interface::LR1121Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R bool LR1121Interface::wideLora() { return true; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/LR1121Interface.h b/src/mesh/LR1121Interface.h index 32a6f9492..ebc5b59a9 100644 --- a/src/mesh/LR1121Interface.h +++ b/src/mesh/LR1121Interface.h @@ -1,4 +1,5 @@ #pragma once +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "LR11x0Interface.h" @@ -11,4 +12,5 @@ class LR1121Interface : public LR11x0Interface LR1121Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); bool wideLora() override; -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index f0f9119ea..6641634c4 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "LR11x0Interface.h" #include "Throttle.h" #include "configuration.h" @@ -284,4 +285,5 @@ template bool LR11x0Interface::sleep() #endif return true; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/LR11x0Interface.h b/src/mesh/LR11x0Interface.h index 5711b1f7f..4829ddc1d 100644 --- a/src/mesh/LR11x0Interface.h +++ b/src/mesh/LR11x0Interface.h @@ -1,5 +1,5 @@ #pragma once - +#if RADIOLIB_EXCLUDE_LR11X0 != 1 #include "RadioLibInterface.h" /** @@ -66,3 +66,4 @@ template class LR11x0Interface : public RadioLibInterface virtual void setStandby() override; }; +#endif \ No newline at end of file diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 25df3258f..3cb6bfdda 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX127X != 1 #include "RF95Interface.h" #include "MeshRadio.h" // kinda yucky, but we need to know which region we are in #include "RadioLibRF95.h" @@ -336,3 +337,4 @@ bool RF95Interface::sleep() return true; } +#endif \ No newline at end of file diff --git a/src/mesh/RF95Interface.h b/src/mesh/RF95Interface.h index a50cf93a2..327e57900 100644 --- a/src/mesh/RF95Interface.h +++ b/src/mesh/RF95Interface.h @@ -1,5 +1,5 @@ #pragma once - +#if RADIOLIB_EXCLUDE_SX127X != 1 #include "MeshRadio.h" // kinda yucky, but we need to know which region we are in #include "RadioLibInterface.h" #include "RadioLibRF95.h" @@ -69,3 +69,4 @@ class RF95Interface : public RadioLibInterface /** Some boards require GPIO control of tx vs rx paths */ void setTransmitEnable(bool txon); }; +#endif \ No newline at end of file diff --git a/src/mesh/RadioLibRF95.cpp b/src/mesh/RadioLibRF95.cpp index a202d4f4d..fe9bbdc93 100644 --- a/src/mesh/RadioLibRF95.cpp +++ b/src/mesh/RadioLibRF95.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX127X != 1 #include "RadioLibRF95.h" #include "configuration.h" @@ -81,4 +82,5 @@ uint8_t RadioLibRF95::readReg(uint8_t addr) { Module *mod = this->getMod(); return mod->SPIreadRegister(addr); -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/RadioLibRF95.h b/src/mesh/RadioLibRF95.h index 3bdb794f2..916a33234 100644 --- a/src/mesh/RadioLibRF95.h +++ b/src/mesh/RadioLibRF95.h @@ -1,4 +1,5 @@ #pragma once +#if RADIOLIB_EXCLUDE_SX127X != 1 #include /*! @@ -69,3 +70,4 @@ class RadioLibRF95 : public SX1278 // use the previous value float currentLimit = 100; }; +#endif \ No newline at end of file diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index e96e72b71..4c0dea00b 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "SX1262Interface.h" #include "configuration.h" #include "error.h" @@ -6,4 +7,5 @@ SX1262Interface::SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R RADIOLIB_PIN_TYPE busy) : SX126xInterface(hal, cs, irq, rst, busy) { -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/SX1262Interface.h b/src/mesh/SX1262Interface.h index 31a12ae90..6e4616c8b 100644 --- a/src/mesh/SX1262Interface.h +++ b/src/mesh/SX1262Interface.h @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX126X != 1 #pragma once #include "SX126xInterface.h" @@ -10,4 +11,5 @@ class SX1262Interface : public SX126xInterface public: SX1262Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/src/mesh/SX1268Interface.cpp b/src/mesh/SX1268Interface.cpp index ea299fce5..fe6e9af89 100644 --- a/src/mesh/SX1268Interface.cpp +++ b/src/mesh/SX1268Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "SX1268Interface.h" #include "configuration.h" #include "error.h" @@ -15,4 +16,5 @@ float SX1268Interface::getFreq() return 433.125f; else return savedFreq; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/SX1268Interface.h b/src/mesh/SX1268Interface.h index c8bcf20a7..cc6dd3534 100644 --- a/src/mesh/SX1268Interface.h +++ b/src/mesh/SX1268Interface.h @@ -1,4 +1,5 @@ #pragma once +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "SX126xInterface.h" @@ -13,3 +14,4 @@ class SX1268Interface : public SX126xInterface SX1268Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); }; +#endif \ No newline at end of file diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 30024daf0..a23c1e457 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "SX126xInterface.h" #include "configuration.h" #include "error.h" @@ -341,4 +342,5 @@ template bool SX126xInterface::sleep() #endif return true; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/SX126xInterface.h b/src/mesh/SX126xInterface.h index c437080c4..45b39a68a 100644 --- a/src/mesh/SX126xInterface.h +++ b/src/mesh/SX126xInterface.h @@ -1,4 +1,5 @@ #pragma once +#if RADIOLIB_EXCLUDE_SX126X != 1 #include "RadioLibInterface.h" @@ -68,3 +69,4 @@ template class SX126xInterface : public RadioLibInterface virtual void setStandby() override; }; +#endif \ No newline at end of file diff --git a/src/mesh/SX1280Interface.cpp b/src/mesh/SX1280Interface.cpp index 3287f141f..9e0d42122 100644 --- a/src/mesh/SX1280Interface.cpp +++ b/src/mesh/SX1280Interface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX128X != 1 #include "SX1280Interface.h" #include "configuration.h" #include "error.h" @@ -7,3 +8,4 @@ SX1280Interface::SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, R : SX128xInterface(hal, cs, irq, rst, busy) { } +#endif \ No newline at end of file diff --git a/src/mesh/SX1280Interface.h b/src/mesh/SX1280Interface.h index 8f2c4ec2e..534dd8084 100644 --- a/src/mesh/SX1280Interface.h +++ b/src/mesh/SX1280Interface.h @@ -1,5 +1,5 @@ #pragma once - +#if RADIOLIB_EXCLUDE_SX128X != 1 #include "SX128xInterface.h" /** @@ -12,3 +12,4 @@ class SX1280Interface : public SX128xInterface SX1280Interface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy); }; +#endif diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 5c740099c..2a1bb4e41 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -1,3 +1,4 @@ +#if RADIOLIB_EXCLUDE_SX128X != 1 #include "SX128xInterface.h" #include "Throttle.h" #include "configuration.h" @@ -313,4 +314,5 @@ template bool SX128xInterface::sleep() #endif return true; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 8f1006eca..77b5e975c 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -9,6 +9,9 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 -DEINK_DISPLAY_MODEL=GxEPD2_213_BN -DEINK_WIDTH=250 -DEINK_HEIGHT=122 + -DRADIOLIB_EXCLUDE_SX128X=1 + -DRADIOLIB_EXCLUDE_SX127X=1 + -DRADIOLIB_EXCLUDE_LR11X0=1 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + lib_deps = ${nrf52840_base.lib_deps}