From 0411401184fe7abebfd14f6bba00c0a2a8e9bdb5 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 25 May 2022 20:47:48 -0700 Subject: [PATCH 1/7] Bump to .11 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index ed0a18ce..3c1104c9 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 3 -build = 10 +build = 11 From 1b8830e7df4189028085e9f1937cae3edd5b2ce5 Mon Sep 17 00:00:00 2001 From: mc-hamster Date: Fri, 27 May 2022 19:19:57 +0000 Subject: [PATCH 2/7] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/config.pb.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protobufs b/protobufs index 40b82242..e7791c33 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 40b822424221f4f7704e291d2b422c9dcca84c83 +Subproject commit e7791c33fd1c88506cc5e40f50669043d550b9e6 diff --git a/src/mesh/generated/config.pb.h b/src/mesh/generated/config.pb.h index 39d51d3d..c48d38e6 100644 --- a/src/mesh/generated/config.pb.h +++ b/src/mesh/generated/config.pb.h @@ -75,9 +75,9 @@ typedef enum _Config_LoRaConfig_RegionCode { } Config_LoRaConfig_RegionCode; typedef enum _Config_LoRaConfig_ModemPreset { - Config_LoRaConfig_ModemPreset_VLongSlow = 0, + Config_LoRaConfig_ModemPreset_LongFast = 0, Config_LoRaConfig_ModemPreset_LongSlow = 1, - Config_LoRaConfig_ModemPreset_LongFast = 2, + Config_LoRaConfig_ModemPreset_VLongSlow = 2, Config_LoRaConfig_ModemPreset_MidSlow = 3, Config_LoRaConfig_ModemPreset_MidFast = 4, Config_LoRaConfig_ModemPreset_ShortSlow = 5, @@ -182,7 +182,7 @@ typedef struct _Config { #define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_TH #define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_TH+1)) -#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_VLongSlow +#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LongFast #define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_ShortFast #define _Config_LoRaConfig_ModemPreset_ARRAYSIZE ((Config_LoRaConfig_ModemPreset)(Config_LoRaConfig_ModemPreset_ShortFast+1)) From 6306c53bfe51644ab78980b50279d96a0551caad Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Fri, 27 May 2022 12:21:59 -0700 Subject: [PATCH 3/7] Bump to .12 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 3c1104c9..562db32e 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 3 -build = 11 +build = 12 From b88e75cf2a3f4b136c73143be4e216edf25ab932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 29 May 2022 16:31:30 +0200 Subject: [PATCH 4/7] Fixed Typo in get Config --- src/modules/AdminModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 9f6f55fe..222f1bcd 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -58,7 +58,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) case AdminMessage_get_config_request_tag: DEBUG_MSG("Client is getting config\n"); - handleGetConfig(mp, r->get_channel_request); + handleGetConfig(mp, r->get_config_request); break; case AdminMessage_get_module_config_request_tag: From 0767c0b0e8fecdf46e88be95fb7965f96fc8c8d1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 29 May 2022 19:30:20 -0500 Subject: [PATCH 5/7] Converted to jgromes/RadioLib upstream and pegged to latest ref (#1472) * Converted to jgromes/RadioLib upstream and pegged to latest ref --- .github/workflows/main.yml | 146 ------------------------------ platformio.ini | 24 +++-- src/mesh/RF95Interface.cpp | 35 ++++--- src/mesh/RF95Interface.h | 5 +- src/mesh/RadioLibInterface.cpp | 4 +- src/mesh/RadioLibInterface.h | 2 +- src/mesh/RadioLibRF95.cpp | 6 +- src/mesh/RadioLibRF95.h | 2 +- src/mesh/SX126xInterface.cpp | 49 +++++----- variants/portduino/platformio.ini | 30 +++--- variants/portduino/variant.h | 16 +++- 11 files changed, 96 insertions(+), 223 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 46911d88..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Continuous Integration (Legacy serial build) -on: - # Triggers the workflow on push or pull request events but only for the master branch - workflow_dispatch: - -jobs: - ci-check: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: "recursive" - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Install cppcheck - run: | - sudo apt-get install -y cppcheck - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v1 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - - name: Upgrade python tools and install platformio - run: | - python -m pip install --upgrade pip - pip install -U platformio - - - name: Upgrade platformio - run: | - pio upgrade - - - name: Check everything - run: bin/check-all.sh - - ci-build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: "recursive" - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v1 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - - name: Upgrade python tools - # We actually want to run this every time - # if: steps.cache-pip.outputs.cache-hit != 'true' - run: | - python -m pip install --upgrade pip - pip install -U platformio meshtastic adafruit-nrfutil - - # - name: Cache platformio - # uses: actions/cache@v1 - # id: cache-platformio # needed in if test - # with: - # path: ~/.platformio - # key: ${{ runner.os }}-platformio - - - name: Upgrade platformio - run: | - pio upgrade - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/meshtastic-web" - file: "build.tar" - target: "build.tar" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - # We now run integration test before other build steps (to quickly see runtime failures) - - name: Build for native - run: platformio run -e native - - name: Integration test - run: | - .pio/build/native/program & - sleep 20 # 5 seconds was not enough - echo "Simulator started, launching python test..." - python3 -c 'from meshtastic.test import testSimulator; testSimulator()' - - - name: Cat bin/build-all.sh - run: | - cat bin/build-all.sh - - - name: Build everything - run: bin/build-all.sh - - - name: Get release version string - run: echo "::set-output name=version::$(./bin/buildinfo.py long)" - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v2 - with: - name: firmware-${{ steps.version.outputs.version }}.zip - path: release/archive/firmware-${{ steps.version.outputs.version }}.zip - retention-days: 90 - - - name: Store debugging elf files as an artifact - uses: actions/upload-artifact@v2 - with: - name: debug-elfs - path: release/archive/elfs-*.zip - retention-days: 7 - - - name: Download firmware.zip - uses: actions/download-artifact@master - with: - name: firmware-${{ steps.version.outputs.version }}.zip - path: ./ - - - name: Pull request artifacts - if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' }} - uses: gavv/pull-request-artifacts@v1.0.0 - with: - commit: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }} - repo-token: ${{ secrets.GITHUB_TOKEN }} - artifacts-branch: artifacts - artifacts: ./firmware-${{ steps.version.outputs.version }}.zip diff --git a/platformio.ini b/platformio.ini index 392f996e..1ff5e92c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -44,15 +44,11 @@ lib_deps = mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce 1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib https://github.com/meshtastic/arduino-fsm.git - https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 https://github.com/meshtastic/TinyGPSPlus.git - https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460 Wire ; explicitly needed here because the AXP202 library forgets to add it SPI https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3 - PubSubClient nanopb/Nanopb@^0.4.6 - meshtastic/json11@^1.0.2 ; Used for the code analysis in PIO Home / Inspect check_tool = cppcheck @@ -63,12 +59,21 @@ check_skip_packages = yes framework = arduino lib_deps = ${env.lib_deps} + ; Portduino is using meshtastic fork for now + https://github.com/jgromes/RadioLib.git#3df3b092ebf412bd0b26524e7b296733bd6a62f7 build_flags = ${env.build_flags} -Os # -DRADIOLIB_GODMODE build_src_filter = ${env.build_src_filter} - -; Common libs for environmental measurements (not included in native / portduino) -[environmental] +; Common libs for communicating over TCP/IP networks such as MQTT +[networking_base] +lib_deps = + PubSubClient + meshtastic/json11@^1.0.2 + +; Common libs for environmental measurements in telemetry module +; (not included in native / portduino) +[environmental_base] lib_deps = adafruit/Adafruit BusIO@^1.11.4 adafruit/DHT sensor library@^1.4.1 @@ -97,11 +102,14 @@ build_flags = -DAXP_DEBUG_PORT=Serial -DUSE_NEW_ESP32_BLUETOOTH lib_deps = ${arduino_base.lib_deps} - ${environmental.lib_deps} + ${networking_base.lib_deps} + ${environmental_base.lib_deps} https://github.com/meshtastic/esp32_https_server.git h2zero/NimBLE-Arduino@1.3.7 arduino-libraries/NTPClient@^3.1.0 lorol/LittleFS_esp32@^1.0.6 + https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460 + lib_ignore = segger_rtt ESP32 BLE Arduino @@ -141,7 +149,7 @@ extends = nrf52_base build_flags = ${nrf52_base.build_flags} lib_deps = ${arduino_base.lib_deps} - ${environmental.lib_deps} + ${environmental_base.lib_deps} https://github.com/Kongduino/Adafruit_nRFCrypto.git ; Note: By default no lora device is created for this build - it uses a simulated interface diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index a96b9510..2a0789df 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -76,13 +76,13 @@ bool RF95Interface::init() DEBUG_MSG("Current limit set to %f\n", currentLimit); DEBUG_MSG("Current limit set result %d\n", res); - if (res == ERR_NONE) - res = lora->setCRC(SX126X_LORA_CRC_ON); + if (res == RADIOLIB_ERR_NONE) + res = lora->setCRC(RADIOLIB_SX126X_LORA_CRC_ON); - if (res == ERR_NONE) + if (res == RADIOLIB_ERR_NONE) startReceive(); // start receiving - return res == ERR_NONE; + return res == RADIOLIB_ERR_NONE; } void INTERRUPT_ATTR RF95Interface::disableInterrupt() @@ -99,39 +99,39 @@ bool RF95Interface::reconfigure() // configure publicly accessible settings int err = lora->setSpreadingFactor(sf); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); err = lora->setBandwidth(bw); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); err = lora->setCodingRate(cr); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); err = lora->setSyncWord(syncWord); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora->setCurrentLimit(currentLimit); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora->setPreambleLength(preambleLength); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora->setFrequency(getFreq()); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); if (power > MAX_POWER) // This chip has lower power limits than some power = MAX_POWER; err = lora->setOutputPower(power); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); startReceive(); // restart receiving - return ERR_NONE; + return RADIOLIB_ERR_NONE; } /** @@ -147,7 +147,7 @@ void RF95Interface::addReceiveMetadata(MeshPacket *mp) void RF95Interface::setStandby() { int err = lora->standby(); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); isReceiving = false; // If we were receiving, not any more disableInterrupt(); @@ -168,7 +168,7 @@ void RF95Interface::startReceive() setTransmitEnable(false); setStandby(); int err = lora->startReceive(); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); isReceiving = true; @@ -184,12 +184,11 @@ bool RF95Interface::isChannelActive() setStandby(); // needed for smooth transition result = lora->scanChannel(); - if (result == PREAMBLE_DETECTED) { + if (result == RADIOLIB_PREAMBLE_DETECTED) { // DEBUG_MSG("Channel is busy!\n"); return true; } - - assert(result != ERR_WRONG_MODEM); + assert(result != RADIOLIB_ERR_WRONG_MODEM); // DEBUG_MSG("Channel is free!\n"); return false; diff --git a/src/mesh/RF95Interface.h b/src/mesh/RF95Interface.h index 5e666ae8..575786a7 100644 --- a/src/mesh/RF95Interface.h +++ b/src/mesh/RF95Interface.h @@ -13,8 +13,9 @@ class RF95Interface : public RadioLibInterface public: RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi); - - bool isIRQPending() override { return lora->getPendingIRQ(); } + + //TODO: Verify that this irq flag works with RFM95 / SX1276 radios the way it used to + bool isIRQPending() override { return lora->getIRQFlags() & RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER; } /// Initialise the Driver transport hardware and software. /// Make sure the Driver is properly configured before calling init(). diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index c665ea35..5d049a29 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -308,7 +308,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) xmitMsec = getPacketTime(length); int state = iface->readData(radiobuf, length); - if (state != ERR_NONE) { + if (state != RADIOLIB_ERR_NONE) { DEBUG_MSG("ignoring received packet due to error=%d\n", state); rxBad++; @@ -374,7 +374,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) size_t numbytes = beginSending(txp); int res = iface->startTransmit(radiobuf, numbytes); - if (res != ERR_NONE) { + if (res != RADIOLIB_ERR_NONE) { RECORD_CRITICALERROR(CriticalErrorCode_RadioSpiBug); // This send failed, but make sure to 'complete' it properly diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 0f59c1fa..35abcc74 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -54,7 +54,7 @@ class LockingModule : public Module \param numBytes Number of bytes to transfer. */ - virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override; + virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes); }; class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread diff --git a/src/mesh/RadioLibRF95.cpp b/src/mesh/RadioLibRF95.cpp index dcb987d1..93f07891 100644 --- a/src/mesh/RadioLibRF95.cpp +++ b/src/mesh/RadioLibRF95.cpp @@ -15,7 +15,7 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_ { // execute common part int16_t state = SX127x::begin(RF95_CHIP_VERSION, syncWord, preambleLength); - if (state != ERR_NONE) + if (state != RADIOLIB_ERR_NONE) state = SX127x::begin(RF95_ALT_VERSION, syncWord, preambleLength); RADIOLIB_ASSERT(state); @@ -30,7 +30,7 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_ RADIOLIB_ASSERT(state); #ifdef RF95_TCXO - state = _mod->SPIsetRegValue(SX127X_REG_TCXO, 0x10 | _mod->SPIgetRegValue(SX127X_REG_TCXO)); + state = _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_TCXO, 0x10 | _mod->SPIgetRegValue(RADIOLIB_SX127X_REG_TCXO)); RADIOLIB_ASSERT(state); #endif @@ -72,7 +72,7 @@ int16_t RadioLibRF95::setFrequency(float freq) bool RadioLibRF95::isReceiving() { // 0x0b == Look for header info valid, signal synchronized or signal detected - uint8_t reg = readReg(SX127X_REG_MODEM_STAT); + uint8_t reg = readReg(RADIOLIB_SX127X_REG_MODEM_STAT); // Serial.printf("reg %x\n", reg); return (reg & (RH_RF95_MODEM_STATUS_SIGNAL_DETECTED | RH_RF95_MODEM_STATUS_SIGNAL_SYNCHRONIZED | RH_RF95_MODEM_STATUS_HEADER_INFO_VALID)) != 0; diff --git a/src/mesh/RadioLibRF95.h b/src/mesh/RadioLibRF95.h index 51955430..ff8164ef 100644 --- a/src/mesh/RadioLibRF95.h +++ b/src/mesh/RadioLibRF95.h @@ -43,7 +43,7 @@ class RadioLibRF95: public SX1278 { \returns \ref status_codes */ - int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = SX127X_SYNC_WORD, int8_t power = 17, uint16_t preambleLength = 8, uint8_t gain = 0); + int16_t begin(float freq = 915.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 17, uint16_t preambleLength = 8, uint8_t gain = 0); // configuration methods diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index c051a193..61f93931 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -64,7 +64,7 @@ bool SX126xInterface::init() #ifdef SX126X_TXEN // lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX - if (res == ERR_NONE) + if (res == RADIOLIB_ERR_NONE) res = lora.setDio2AsRfSwitch(true); #endif @@ -72,7 +72,7 @@ bool SX126xInterface::init() // Read/write a register we are not using (only used for FSK mode) to test SPI comms uint8_t crcLSB = 0; int err = lora.readRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1); - if(err != ERR_NONE) + if(err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure); //if(crcLSB != 0x0f) @@ -80,11 +80,11 @@ bool SX126xInterface::init() crcLSB = 0x5a; err = lora.writeRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1); - if(err != ERR_NONE) + if(err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure); err = lora.readRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1); - if(err != ERR_NONE) + if(err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure); if(crcLSB != 0x5a) @@ -92,13 +92,13 @@ bool SX126xInterface::init() // If we got this far register accesses (and therefore SPI comms) are good #endif - if (res == ERR_NONE) - res = lora.setCRC(SX126X_LORA_CRC_ON); + if (res == RADIOLIB_ERR_NONE) + res = lora.setCRC(RADIOLIB_SX126X_LORA_CRC_ON); - if (res == ERR_NONE) + if (res == RADIOLIB_ERR_NONE) startReceive(); // start receiving - return res == ERR_NONE; + return res == RADIOLIB_ERR_NONE; } template @@ -111,42 +111,43 @@ bool SX126xInterface::reconfigure() // configure publicly accessible settings int err = lora.setSpreadingFactor(sf); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); err = lora.setBandwidth(bw); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); err = lora.setCodingRate(cr); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); // Hmm - seems to lower SNR when the signal levels are high. Leaving off for now... - err = lora.setRxGain(true); - assert(err == ERR_NONE); + // TODO: Confirm gain registers are okay now + // err = lora.setRxGain(true); + // assert(err == RADIOLIB_ERR_NONE); err = lora.setSyncWord(syncWord); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora.setCurrentLimit(currentLimit); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora.setPreambleLength(preambleLength); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); err = lora.setFrequency(getFreq()); - if (err != ERR_NONE) + if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting); if (power > 22) // This chip has lower power limits than some power = 22; err = lora.setOutputPower(power); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); startReceive(); // restart receiving - return ERR_NONE; + return RADIOLIB_ERR_NONE; } template @@ -161,7 +162,7 @@ void SX126xInterface::setStandby() checkNotification(); // handle any pending interrupts before we force standby int err = lora.standby(); - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); #ifdef SX126X_RXEN // we have RXEN/TXEN control - turn off RX and TX power digitalWrite(SX126X_RXEN, LOW); @@ -223,7 +224,7 @@ void SX126xInterface::startReceive() // int err = lora.startReceive(); int err = lora.startReceiveDutyCycleAuto(); // We use a 32 bit preamble so this should save some power by letting radio sit in // standby mostly. - assert(err == ERR_NONE); + assert(err == RADIOLIB_ERR_NONE); isReceiving = true; @@ -241,10 +242,10 @@ bool SX126xInterface::isChannelActive() setStandby(); result = lora.scanChannel(); - if (result == PREAMBLE_DETECTED) + if (result == RADIOLIB_PREAMBLE_DETECTED) return true; - assert(result != ERR_WRONG_MODEM); + assert(result != RADIOLIB_ERR_WRONG_MODEM); return false; } @@ -259,7 +260,7 @@ bool SX126xInterface::isActivelyReceiving() // never even get a valid header, so we don't want preamble to get set and stay set due to noise on the network. uint16_t irq = lora.getIrqStatus(); - bool hasPreamble = (irq & SX126X_IRQ_HEADER_VALID); + bool hasPreamble = (irq & RADIOLIB_SX126X_IRQ_HEADER_VALID); // this is not correct - often always true - need to add an extra conditional // size_t bytesPending = lora.getPacketLength(); diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 375c2c45..0030ae4b 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,6 +1,5 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated -[env:native] -platform = https://github.com/meshtastic/platform-native.git +[portduino_base] build_src_filter = ${env.build_src_filter} - @@ -10,28 +9,25 @@ build_src_filter = - - +<../variants/portduino> +lib_deps = + ${env.lib_deps} + ${networking_base.lib_deps} + rweather/Crypto + https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 + +[env:native] +platform = https://github.com/meshtastic/platform-native.git build_flags = ${arduino_base.build_flags} -O0 -I variants/portduino framework = arduino board = cross_platform -lib_deps = - ${arduino_base.lib_deps} - rweather/Crypto +lib_deps = ${portduino_base.lib_deps} +build_src_filter = ${portduino_base.build_src_filter} ; The Portduino based sim environment on top of a linux OS and touching linux hardware devices [env:linux] platform = https://github.com/meshtastic/platform-native.git -build_src_filter = - ${env.build_src_filter} - - - - - - - - - - - - - +<../variants/portduino> build_flags = ${arduino_base.build_flags} -O0 -lgpiod -I variants/portduino framework = arduino board = linux_hardware -lib_deps = - ${arduino_base.lib_deps} - rweather/Crypto +lib_deps = ${portduino_base.lib_deps} +build_src_filter = ${portduino_base.build_src_filter} \ No newline at end of file diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 18758cb0..ea827868 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -23,4 +23,18 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET // HOPE RFM90 does not have a TCXO therefore not SX126X_E22 -#endif \ No newline at end of file +#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 \ No newline at end of file From 03bbc5eff407a5f5ebb7409322aa189eec96619d Mon Sep 17 00:00:00 2001 From: caveman99 Date: Mon, 30 May 2022 19:00:01 +0000 Subject: [PATCH 6/7] [create-pull-request] automated change --- protobufs | 2 +- src/mesh/generated/apponly.pb.h | 17 ++-- src/mesh/generated/deviceonly.pb.c | 6 -- src/mesh/generated/deviceonly.pb.h | 104 ---------------------- src/mesh/generated/localonly.pb.c | 15 ++++ src/mesh/generated/localonly.pb.h | 136 +++++++++++++++++++++++++++++ 6 files changed, 164 insertions(+), 116 deletions(-) create mode 100644 src/mesh/generated/localonly.pb.c create mode 100644 src/mesh/generated/localonly.pb.h diff --git a/protobufs b/protobufs index e7791c33..695b2421 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit e7791c33fd1c88506cc5e40f50669043d550b9e6 +Subproject commit 695b2421130a6efd9ad7cdecfe2d4420404f0f97 diff --git a/src/mesh/generated/apponly.pb.h b/src/mesh/generated/apponly.pb.h index 2a908c96..ad2e605a 100644 --- a/src/mesh/generated/apponly.pb.h +++ b/src/mesh/generated/apponly.pb.h @@ -5,6 +5,7 @@ #define PB_APPONLY_PB_H_INCLUDED #include #include "channel.pb.h" +#include "config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -17,9 +18,12 @@ No DISABLED channels are included. This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL */ typedef struct _ChannelSet { - /* TODO: REPLACE */ + /* Channel list with settings */ pb_size_t settings_count; ChannelSettings settings[8]; + /* LoRa config */ + bool has_lora_config; + Config_LoRaConfig lora_config; } ChannelSet; @@ -28,18 +32,21 @@ extern "C" { #endif /* Initializer values for message structs */ -#define ChannelSet_init_default {0, {ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default}} -#define ChannelSet_init_zero {0, {ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero}} +#define ChannelSet_init_default {0, {ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default}, false, Config_LoRaConfig_init_default} +#define ChannelSet_init_zero {0, {ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero}, false, Config_LoRaConfig_init_zero} /* Field tags (for use in manual encoding/decoding) */ #define ChannelSet_settings_tag 1 +#define ChannelSet_lora_config_tag 2 /* Struct field encoding specification for nanopb */ #define ChannelSet_FIELDLIST(X, a) \ -X(a, STATIC, REPEATED, MESSAGE, settings, 1) +X(a, STATIC, REPEATED, MESSAGE, settings, 1) \ +X(a, STATIC, OPTIONAL, MESSAGE, lora_config, 2) #define ChannelSet_CALLBACK NULL #define ChannelSet_DEFAULT NULL #define ChannelSet_settings_MSGTYPE ChannelSettings +#define ChannelSet_lora_config_MSGTYPE Config_LoRaConfig extern const pb_msgdesc_t ChannelSet_msg; @@ -47,7 +54,7 @@ extern const pb_msgdesc_t ChannelSet_msg; #define ChannelSet_fields &ChannelSet_msg /* Maximum encoded size of messages (where known) */ -#define ChannelSet_size 504 +#define ChannelSet_size 573 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/deviceonly.pb.c b/src/mesh/generated/deviceonly.pb.c index 33a2ee79..76aba1ae 100644 --- a/src/mesh/generated/deviceonly.pb.c +++ b/src/mesh/generated/deviceonly.pb.c @@ -15,11 +15,5 @@ PB_BIND(ChannelFile, ChannelFile, 2) PB_BIND(OEMStore, OEMStore, 2) -PB_BIND(LocalConfig, LocalConfig, 2) - - -PB_BIND(LocalModuleConfig, LocalModuleConfig, 2) - - diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 7fc35424..95e298fa 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -5,9 +5,7 @@ #define PB_DEVICEONLY_PB_H_INCLUDED #include #include "channel.pb.h" -#include "config.pb.h" #include "mesh.pb.h" -#include "module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -66,51 +64,6 @@ typedef struct _DeviceState { bool did_gps_reset; } DeviceState; -typedef struct _LocalConfig { - /* TODO: REPLACE */ - bool has_device; - Config_DeviceConfig device; - /* TODO: REPLACE */ - bool has_position; - Config_PositionConfig position; - /* TODO: REPLACE */ - bool has_power; - Config_PowerConfig power; - /* TODO: REPLACE */ - bool has_wifi; - Config_WiFiConfig wifi; - /* TODO: REPLACE */ - bool has_display; - Config_DisplayConfig display; - /* TODO: REPLACE */ - bool has_lora; - Config_LoRaConfig lora; -} LocalConfig; - -typedef struct _LocalModuleConfig { - /* TODO: REPLACE */ - bool has_mqtt; - ModuleConfig_MQTTConfig mqtt; - /* TODO: REPLACE */ - bool has_serial; - ModuleConfig_SerialConfig serial; - /* TODO: REPLACE */ - bool has_external_notification; - ModuleConfig_ExternalNotificationConfig external_notification; - /* TODO: REPLACE */ - bool has_store_forward; - ModuleConfig_StoreForwardConfig store_forward; - /* TODO: REPLACE */ - bool has_range_test; - ModuleConfig_RangeTestConfig range_test; - /* TODO: REPLACE */ - bool has_telemetry; - ModuleConfig_TelemetryConfig telemetry; - /* TODO: REPLACE */ - bool has_canned_message; - ModuleConfig_CannedMessageConfig canned_message; -} LocalModuleConfig; - typedef PB_BYTES_ARRAY_T(2048) OEMStore_oem_icon_bits_t; /* This can be used for customizing the firmware distribution. If populated, show a secondary bootup screen with cuatom logo and text for 2.5 seconds. */ @@ -142,13 +95,9 @@ extern "C" { #define DeviceState_init_default {false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default}, false, MeshPacket_init_default, 0, 0, 0} #define ChannelFile_init_default {0, {Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default}} #define OEMStore_init_default {0, 0, {0, {0}}, _ScreenFonts_MIN, ""} -#define LocalConfig_init_default {false, Config_DeviceConfig_init_default, false, Config_PositionConfig_init_default, false, Config_PowerConfig_init_default, false, Config_WiFiConfig_init_default, false, Config_DisplayConfig_init_default, false, Config_LoRaConfig_init_default} -#define LocalModuleConfig_init_default {false, ModuleConfig_MQTTConfig_init_default, false, ModuleConfig_SerialConfig_init_default, false, ModuleConfig_ExternalNotificationConfig_init_default, false, ModuleConfig_StoreForwardConfig_init_default, false, ModuleConfig_RangeTestConfig_init_default, false, ModuleConfig_TelemetryConfig_init_default, false, ModuleConfig_CannedMessageConfig_init_default} #define DeviceState_init_zero {false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero}, false, MeshPacket_init_zero, 0, 0, 0} #define ChannelFile_init_zero {0, {Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero}} #define OEMStore_init_zero {0, 0, {0, {0}}, _ScreenFonts_MIN, ""} -#define LocalConfig_init_zero {false, Config_DeviceConfig_init_zero, false, Config_PositionConfig_init_zero, false, Config_PowerConfig_init_zero, false, Config_WiFiConfig_init_zero, false, Config_DisplayConfig_init_zero, false, Config_LoRaConfig_init_zero} -#define LocalModuleConfig_init_zero {false, ModuleConfig_MQTTConfig_init_zero, false, ModuleConfig_SerialConfig_init_zero, false, ModuleConfig_ExternalNotificationConfig_init_zero, false, ModuleConfig_StoreForwardConfig_init_zero, false, ModuleConfig_RangeTestConfig_init_zero, false, ModuleConfig_TelemetryConfig_init_zero, false, ModuleConfig_CannedMessageConfig_init_zero} /* Field tags (for use in manual encoding/decoding) */ #define ChannelFile_channels_tag 1 @@ -160,19 +109,6 @@ extern "C" { #define DeviceState_version_tag 8 #define DeviceState_no_save_tag 9 #define DeviceState_did_gps_reset_tag 11 -#define LocalConfig_device_tag 1 -#define LocalConfig_position_tag 2 -#define LocalConfig_power_tag 3 -#define LocalConfig_wifi_tag 4 -#define LocalConfig_display_tag 5 -#define LocalConfig_lora_tag 6 -#define LocalModuleConfig_mqtt_tag 1 -#define LocalModuleConfig_serial_tag 2 -#define LocalModuleConfig_external_notification_tag 3 -#define LocalModuleConfig_store_forward_tag 4 -#define LocalModuleConfig_range_test_tag 5 -#define LocalModuleConfig_telemetry_tag 6 -#define LocalModuleConfig_canned_message_tag 7 #define OEMStore_oem_icon_width_tag 1 #define OEMStore_oem_icon_height_tag 2 #define OEMStore_oem_icon_bits_tag 3 @@ -212,58 +148,18 @@ X(a, STATIC, SINGULAR, STRING, oem_text, 5) #define OEMStore_CALLBACK NULL #define OEMStore_DEFAULT NULL -#define LocalConfig_FIELDLIST(X, a) \ -X(a, STATIC, OPTIONAL, MESSAGE, device, 1) \ -X(a, STATIC, OPTIONAL, MESSAGE, position, 2) \ -X(a, STATIC, OPTIONAL, MESSAGE, power, 3) \ -X(a, STATIC, OPTIONAL, MESSAGE, wifi, 4) \ -X(a, STATIC, OPTIONAL, MESSAGE, display, 5) \ -X(a, STATIC, OPTIONAL, MESSAGE, lora, 6) -#define LocalConfig_CALLBACK NULL -#define LocalConfig_DEFAULT NULL -#define LocalConfig_device_MSGTYPE Config_DeviceConfig -#define LocalConfig_position_MSGTYPE Config_PositionConfig -#define LocalConfig_power_MSGTYPE Config_PowerConfig -#define LocalConfig_wifi_MSGTYPE Config_WiFiConfig -#define LocalConfig_display_MSGTYPE Config_DisplayConfig -#define LocalConfig_lora_MSGTYPE Config_LoRaConfig - -#define LocalModuleConfig_FIELDLIST(X, a) \ -X(a, STATIC, OPTIONAL, MESSAGE, mqtt, 1) \ -X(a, STATIC, OPTIONAL, MESSAGE, serial, 2) \ -X(a, STATIC, OPTIONAL, MESSAGE, external_notification, 3) \ -X(a, STATIC, OPTIONAL, MESSAGE, store_forward, 4) \ -X(a, STATIC, OPTIONAL, MESSAGE, range_test, 5) \ -X(a, STATIC, OPTIONAL, MESSAGE, telemetry, 6) \ -X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) -#define LocalModuleConfig_CALLBACK NULL -#define LocalModuleConfig_DEFAULT NULL -#define LocalModuleConfig_mqtt_MSGTYPE ModuleConfig_MQTTConfig -#define LocalModuleConfig_serial_MSGTYPE ModuleConfig_SerialConfig -#define LocalModuleConfig_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig -#define LocalModuleConfig_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig -#define LocalModuleConfig_range_test_MSGTYPE ModuleConfig_RangeTestConfig -#define LocalModuleConfig_telemetry_MSGTYPE ModuleConfig_TelemetryConfig -#define LocalModuleConfig_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig - extern const pb_msgdesc_t DeviceState_msg; extern const pb_msgdesc_t ChannelFile_msg; extern const pb_msgdesc_t OEMStore_msg; -extern const pb_msgdesc_t LocalConfig_msg; -extern const pb_msgdesc_t LocalModuleConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define DeviceState_fields &DeviceState_msg #define ChannelFile_fields &ChannelFile_msg #define OEMStore_fields &OEMStore_msg -#define LocalConfig_fields &LocalConfig_msg -#define LocalModuleConfig_fields &LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ #define ChannelFile_size 624 #define DeviceState_size 19184 -#define LocalConfig_size 331 -#define LocalModuleConfig_size 282 #define OEMStore_size 2106 #ifdef __cplusplus diff --git a/src/mesh/generated/localonly.pb.c b/src/mesh/generated/localonly.pb.c new file mode 100644 index 00000000..9d89765a --- /dev/null +++ b/src/mesh/generated/localonly.pb.c @@ -0,0 +1,15 @@ +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.4.5 */ + +#include "localonly.pb.h" +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +PB_BIND(LocalConfig, LocalConfig, 2) + + +PB_BIND(LocalModuleConfig, LocalModuleConfig, 2) + + + diff --git a/src/mesh/generated/localonly.pb.h b/src/mesh/generated/localonly.pb.h new file mode 100644 index 00000000..c03d9761 --- /dev/null +++ b/src/mesh/generated/localonly.pb.h @@ -0,0 +1,136 @@ +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.4.5 */ + +#ifndef PB_LOCALONLY_PB_H_INCLUDED +#define PB_LOCALONLY_PB_H_INCLUDED +#include +#include "config.pb.h" +#include "module_config.pb.h" + +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +/* Struct definitions */ +typedef struct _LocalConfig { + /* TODO: REPLACE */ + bool has_device; + Config_DeviceConfig device; + /* TODO: REPLACE */ + bool has_position; + Config_PositionConfig position; + /* TODO: REPLACE */ + bool has_power; + Config_PowerConfig power; + /* TODO: REPLACE */ + bool has_wifi; + Config_WiFiConfig wifi; + /* TODO: REPLACE */ + bool has_display; + Config_DisplayConfig display; + /* TODO: REPLACE */ + bool has_lora; + Config_LoRaConfig lora; +} LocalConfig; + +typedef struct _LocalModuleConfig { + /* TODO: REPLACE */ + bool has_mqtt; + ModuleConfig_MQTTConfig mqtt; + /* TODO: REPLACE */ + bool has_serial; + ModuleConfig_SerialConfig serial; + /* TODO: REPLACE */ + bool has_external_notification; + ModuleConfig_ExternalNotificationConfig external_notification; + /* TODO: REPLACE */ + bool has_store_forward; + ModuleConfig_StoreForwardConfig store_forward; + /* TODO: REPLACE */ + bool has_range_test; + ModuleConfig_RangeTestConfig range_test; + /* TODO: REPLACE */ + bool has_telemetry; + ModuleConfig_TelemetryConfig telemetry; + /* TODO: REPLACE */ + bool has_canned_message; + ModuleConfig_CannedMessageConfig canned_message; +} LocalModuleConfig; + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Initializer values for message structs */ +#define LocalConfig_init_default {false, Config_DeviceConfig_init_default, false, Config_PositionConfig_init_default, false, Config_PowerConfig_init_default, false, Config_WiFiConfig_init_default, false, Config_DisplayConfig_init_default, false, Config_LoRaConfig_init_default} +#define LocalModuleConfig_init_default {false, ModuleConfig_MQTTConfig_init_default, false, ModuleConfig_SerialConfig_init_default, false, ModuleConfig_ExternalNotificationConfig_init_default, false, ModuleConfig_StoreForwardConfig_init_default, false, ModuleConfig_RangeTestConfig_init_default, false, ModuleConfig_TelemetryConfig_init_default, false, ModuleConfig_CannedMessageConfig_init_default} +#define LocalConfig_init_zero {false, Config_DeviceConfig_init_zero, false, Config_PositionConfig_init_zero, false, Config_PowerConfig_init_zero, false, Config_WiFiConfig_init_zero, false, Config_DisplayConfig_init_zero, false, Config_LoRaConfig_init_zero} +#define LocalModuleConfig_init_zero {false, ModuleConfig_MQTTConfig_init_zero, false, ModuleConfig_SerialConfig_init_zero, false, ModuleConfig_ExternalNotificationConfig_init_zero, false, ModuleConfig_StoreForwardConfig_init_zero, false, ModuleConfig_RangeTestConfig_init_zero, false, ModuleConfig_TelemetryConfig_init_zero, false, ModuleConfig_CannedMessageConfig_init_zero} + +/* Field tags (for use in manual encoding/decoding) */ +#define LocalConfig_device_tag 1 +#define LocalConfig_position_tag 2 +#define LocalConfig_power_tag 3 +#define LocalConfig_wifi_tag 4 +#define LocalConfig_display_tag 5 +#define LocalConfig_lora_tag 6 +#define LocalModuleConfig_mqtt_tag 1 +#define LocalModuleConfig_serial_tag 2 +#define LocalModuleConfig_external_notification_tag 3 +#define LocalModuleConfig_store_forward_tag 4 +#define LocalModuleConfig_range_test_tag 5 +#define LocalModuleConfig_telemetry_tag 6 +#define LocalModuleConfig_canned_message_tag 7 + +/* Struct field encoding specification for nanopb */ +#define LocalConfig_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, MESSAGE, device, 1) \ +X(a, STATIC, OPTIONAL, MESSAGE, position, 2) \ +X(a, STATIC, OPTIONAL, MESSAGE, power, 3) \ +X(a, STATIC, OPTIONAL, MESSAGE, wifi, 4) \ +X(a, STATIC, OPTIONAL, MESSAGE, display, 5) \ +X(a, STATIC, OPTIONAL, MESSAGE, lora, 6) +#define LocalConfig_CALLBACK NULL +#define LocalConfig_DEFAULT NULL +#define LocalConfig_device_MSGTYPE Config_DeviceConfig +#define LocalConfig_position_MSGTYPE Config_PositionConfig +#define LocalConfig_power_MSGTYPE Config_PowerConfig +#define LocalConfig_wifi_MSGTYPE Config_WiFiConfig +#define LocalConfig_display_MSGTYPE Config_DisplayConfig +#define LocalConfig_lora_MSGTYPE Config_LoRaConfig + +#define LocalModuleConfig_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, MESSAGE, mqtt, 1) \ +X(a, STATIC, OPTIONAL, MESSAGE, serial, 2) \ +X(a, STATIC, OPTIONAL, MESSAGE, external_notification, 3) \ +X(a, STATIC, OPTIONAL, MESSAGE, store_forward, 4) \ +X(a, STATIC, OPTIONAL, MESSAGE, range_test, 5) \ +X(a, STATIC, OPTIONAL, MESSAGE, telemetry, 6) \ +X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) +#define LocalModuleConfig_CALLBACK NULL +#define LocalModuleConfig_DEFAULT NULL +#define LocalModuleConfig_mqtt_MSGTYPE ModuleConfig_MQTTConfig +#define LocalModuleConfig_serial_MSGTYPE ModuleConfig_SerialConfig +#define LocalModuleConfig_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig +#define LocalModuleConfig_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig +#define LocalModuleConfig_range_test_MSGTYPE ModuleConfig_RangeTestConfig +#define LocalModuleConfig_telemetry_MSGTYPE ModuleConfig_TelemetryConfig +#define LocalModuleConfig_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig + +extern const pb_msgdesc_t LocalConfig_msg; +extern const pb_msgdesc_t LocalModuleConfig_msg; + +/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ +#define LocalConfig_fields &LocalConfig_msg +#define LocalModuleConfig_fields &LocalModuleConfig_msg + +/* Maximum encoded size of messages (where known) */ +#define LocalConfig_size 331 +#define LocalModuleConfig_size 282 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif From f6982ca726cb54477a2d2c7b2d2e9d301994e81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 30 May 2022 21:12:27 +0200 Subject: [PATCH 7/7] fix building with new peotobuf structure. --- src/mesh/mesh-pb-constants.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index c0c90849..59ccc9e1 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -1,6 +1,7 @@ #pragma once #include "mesh/generated/mesh.pb.h" +#include "mesh/generated/localonly.pb.h" #include "mesh/generated/deviceonly.pb.h" #include "mesh/generated/admin.pb.h"