diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index b61071007..1aff0d07c 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -16,5 +16,5 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 + jgromes/RadioLib@5.4.1 build_flags = ${arduino_base.build_flags} -Isrc/platform/portduino diff --git a/platformio.ini b/platformio.ini index 618c7cddb..2d7c8209c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,12 +37,24 @@ extra_scripts = bin/platformio-custom.py ; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important. We don't use custom fields and somewhere in that pile ; of code is a heap corruption bug! ; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc +; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need. build_flags = -Wno-missing-field-initializers -Wno-format -Isrc -Isrc/mesh -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map -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_SI443X + -DRADIOLIB_EXCLUDE_RFM2X + -DRADIOLIB_EXCLUDE_AFSK + -DRADIOLIB_EXCLUDE_HELLSCHREIBER + -DRADIOLIB_EXCLUDE_MORSE + -DRADIOLIB_EXCLUDE_RTTY + -DRADIOLIB_EXCLUDE_SSTV monitor_speed = 115200 diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index ccef2df23..9602525b5 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -8,6 +8,6 @@ template class SX126xInterface; template class SX126xInterface; template class SX126xInterface; -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) template class SX128xInterface; #endif \ No newline at end of file diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index c08220555..567215600 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -11,17 +11,6 @@ // FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0); -#ifdef ARCH_PORTDUINO - -void LockingModule::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) -{ - concurrency::LockGuard g(spiLock); - - Module::SPItransfer(cmd, reg, dataOut, dataIn, numBytes); -} - -#else - void LockingModule::SPIbeginTransaction() { spiLock->lock(); @@ -36,8 +25,6 @@ void LockingModule::SPIendTransaction() Module::SPIendTransaction(); } -#endif - RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi, PhysicalLayer *_iface) : NotifiedWorkerThread("RadioIf"), module(cs, irq, rst, busy, spi, spiSettings), iface(_iface) diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index fbad830cd..f368cf83e 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -41,12 +41,8 @@ class LockingModule : public Module { } -#ifdef ARCH_PORTDUINO - void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override; -#else void SPIbeginTransaction() override; void SPIendTransaction() override; -#endif }; class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread diff --git a/src/mesh/SX1280Interface.cpp b/src/mesh/SX1280Interface.cpp index 37aad1d40..97a3febe3 100644 --- a/src/mesh/SX1280Interface.cpp +++ b/src/mesh/SX1280Interface.cpp @@ -2,7 +2,7 @@ #include "SX1280Interface.h" #include "error.h" -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi) diff --git a/src/mesh/SX1280Interface.h b/src/mesh/SX1280Interface.h index 1c2e24900..a9661501a 100644 --- a/src/mesh/SX1280Interface.h +++ b/src/mesh/SX1280Interface.h @@ -6,7 +6,7 @@ * Our adapter for SX1280 radios */ -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) class SX1280Interface : public SX128xInterface { diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index ab513cece..36eb0bb94 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -2,7 +2,7 @@ #include "SX128xInterface.h" #include "error.h" -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) // Particular boards might define a different max power based on what their hardware can do #ifndef SX128X_MAX_POWER @@ -107,7 +107,7 @@ bool SX128xInterface::reconfigure() if (power > SX128X_MAX_POWER) // This chip has lower power limits than some power = SX128X_MAX_POWER; - + err = lora.setOutputPower(power); assert(err == RADIOLIB_ERR_NONE); diff --git a/src/mesh/SX128xInterface.h b/src/mesh/SX128xInterface.h index f712b8bc4..9994ce850 100644 --- a/src/mesh/SX128xInterface.h +++ b/src/mesh/SX128xInterface.h @@ -1,6 +1,6 @@ #pragma once -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) #include "RadioLibInterface.h" diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 328afaf19..76696b7af 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -23,16 +23,3 @@ // HOPE RFM90 does not have a TCXO therefore not SX126X_E22 #endif -// Temporary shim for radio lib macros until we upgrade to upstream for portduino -#define RADIOLIB_PREAMBLE_DETECTED PREAMBLE_DETECTED - -#define RADIOLIB_ERR_NONE ERR_NONE -#define RADIOLIB_ERR_WRONG_MODEM ERR_WRONG_MODEM - -#define RADIOLIB_SX126X_IRQ_HEADER_VALID SX126X_IRQ_HEADER_VALID -#define RADIOLIB_SX126X_LORA_CRC_ON SX126X_LORA_CRC_ON - -#define RADIOLIB_SX127X_REG_TCXO SX127X_REG_TCXO -#define RADIOLIB_SX127X_REG_MODEM_STAT SX127X_REG_MODEM_STAT -#define RADIOLIB_SX127X_SYNC_WORD SX127X_SYNC_WORD -#define RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER SX127X_MASK_IRQ_FLAG_VALID_HEADER