diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml
index 8d29ab78c..812c9b2a4 100644
--- a/.github/workflows/main_matrix.yml
+++ b/.github/workflows/main_matrix.yml
@@ -5,7 +5,6 @@ on:
branches: [master]
paths-ignore:
- "**.md"
- - "**.yml"
- "version.properties"
# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
@@ -297,7 +296,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -U platformio adafruit-nrfutil
- pip install -U --pre meshtastic
+ pip install -U meshtastic meshtastic==1.3a30 # --pre meshtastic
- name: Upgrade platformio
run: |
diff --git a/boards/tbeam-s3-core.json b/boards/tbeam-s3-core.json
new file mode 100644
index 000000000..82d858df8
--- /dev/null
+++ b/boards/tbeam-s3-core.json
@@ -0,0 +1,48 @@
+{
+ "build": {
+ "arduino":{
+ "ldscript": "esp32s3_out.ld"
+ },
+ "core": "esp32",
+ "extra_flags": [
+ "-DBOARD_HAS_PSRAM",
+ "-DLILYGO_TBEAM_S3_CORE",
+ "-DARDUINO_USB_CDC_ON_BOOT=1",
+ "-DARDUINO_USB_DFU_ON_BOOT=1",
+ "-DARDUINO_USB_MSC_ON_BOOT=1",
+ "-DARDUINO_USB_MODE=1",
+ "-DARDUINO_RUNNING_CORE=1",
+ "-DARDUINO_EVENT_RUNNING_CORE=1"
+ ],
+ "f_cpu": "240000000L",
+ "f_flash": "80000000L",
+ "flash_mode": "dio",
+ "hwids": [
+ [
+ "0X303A",
+ "0x1001"
+ ]
+ ],
+ "mcu": "esp32s3",
+ "variant": "tbeam-s3-core"
+ },
+ "connectivity": [
+ "wifi"
+ ],
+ "debug": {
+ "openocd_target": "esp32s3.cfg"
+ },
+ "frameworks": [
+ "arduino"
+ ],
+ "name": "LilyGo TBeam-S3-Core",
+ "upload": {
+ "flash_size": "8MB",
+ "maximum_ram_size": 327680,
+ "maximum_size": 8388608,
+ "require_upload_port": true,
+ "speed": 921600
+ },
+ "url": "http://www.lilygo.cn/",
+ "vendor": "LilyGo"
+}
diff --git a/platformio.ini b/platformio.ini
index 20b319cdb..e1dbe47ef 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -3,6 +3,7 @@
[platformio]
default_envs = tbeam
+;default_envs = tbeam-s3-core
;default_envs = tbeam0.7
;default_envs = heltec-v1
;default_envs = heltec-v2.0
@@ -13,7 +14,7 @@ default_envs = tbeam
;default_envs = tlora-v2
;default_envs = tlora-v2-1-1.6
;default_envs = lora-relay-v1 # nrf board
-;default_envs = t-echo
+; default_envs = t-echo
;default_envs = nrf52840dk-geeksville
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
;default_envs = nano-g1
@@ -110,8 +111,8 @@ lib_deps =
h2zero/NimBLE-Arduino@1.4.0
arduino-libraries/NTPClient@^3.1.0
lorol/LittleFS_esp32@^1.0.6
- https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
-
+ https://github.com/lewisxhe/XPowersLib.git
+
lib_ignore =
segger_rtt
ESP32 BLE Arduino
@@ -203,3 +204,54 @@ lib_deps =
https://github.com/kokke/tiny-AES-c.git
lib_ignore =
mathertel/OneButton@^2.0.3
+
+
+
+[esp32s3_base]
+extends = arduino_base
+platform = espressif32
+build_src_filter =
+ ${arduino_base.build_src_filter} - - -
+upload_speed = 961200
+monitor_speed = 115200
+debug_init_break = tbreak setup
+
+# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
+# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
+# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
+build_flags =
+ ${arduino_base.build_flags}
+ -Wall
+ -Wextra
+ -Isrc/platform/esp32
+ -std=c++11
+ -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG
+ -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
+ -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL
+ -DAXP_DEBUG_PORT=Serial
+ -DCONFIG_BT_NIMBLE_ENABLED
+ -DCONFIG_NIMBLE_CPP_LOG_LEVEL=2
+ -DCONFIG_BT_NIMBLE_MAX_CCCDS=20
+
+lib_deps =
+ ${arduino_base.lib_deps}
+ ${networking_base.lib_deps}
+ ${environmental_base.lib_deps}
+ ; https://github.com/meshtastic/esp32_https_server.git
+ ; PR has been submitted and can be deleted after merging ,https://github.com/meshtastic/esp32_https_server/pull/1
+ https://github.com/lewisxhe/esp32_https_server.git
+ h2zero/NimBLE-Arduino@1.4.0
+ arduino-libraries/NTPClient@^3.1.0
+ https://github.com/lewisxhe/XPowersLib.git
+
+
+lib_ignore =
+ segger_rtt
+ ESP32 BLE Arduino
+platform_packages =
+ framework-arduinoespressif32@ 3.20004.220825
+
+; customize the partition table
+; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
+board_build.partitions = partition-table.csv
+
diff --git a/protobufs b/protobufs
index a72983993..f3c4aff7a 160000
--- a/protobufs
+++ b/protobufs
@@ -1 +1 @@
-Subproject commit a72983993ccd9c2dabb1ef9e17b2fe79bd94d671
+Subproject commit f3c4aff7a9f164b10680b8504f0036b4ed84404e
diff --git a/src/ButtonThread.h b/src/ButtonThread.h
index ed9fc613c..af0a8e1ec 100644
--- a/src/ButtonThread.h
+++ b/src/ButtonThread.h
@@ -128,8 +128,8 @@ class ButtonThread : public concurrency::OSThread
#endif
// If user button is held down for 5 seconds, shutdown the device.
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
-#ifdef HAS_AXP192
- if (axp192_found == true) {
+#ifdef HAS_PMU
+ if (pmu_found == true) {
setLed(false);
power->shutdown();
}
diff --git a/src/FSCommon.h b/src/FSCommon.h
index 5def77ecb..4336e88dd 100644
--- a/src/FSCommon.h
+++ b/src/FSCommon.h
@@ -23,9 +23,16 @@
#endif
#if defined(ARCH_ESP32)
+#if CONFIG_IDF_TARGET_ESP32S3
+#include //esp32s3 uses the framework's built-in LittleFS
+#define FSCom LittleFS
+#else
// ESP32 version
#include "LITTLEFS.h"
#define FSCom LITTLEFS
+#endif
+
+
#define FSBegin() FSCom.begin(true)
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"
diff --git a/src/GPSStatus.h b/src/GPSStatus.h
index 95f5f53e7..22f426d52 100644
--- a/src/GPSStatus.h
+++ b/src/GPSStatus.h
@@ -122,7 +122,7 @@ class GPSStatus : public Status
// Only update the status if values have actually changed
bool isDirty = matches(newStatus);
- if (isDirty && p.pos_timestamp && (newStatus->p.pos_timestamp == p.pos_timestamp)) {
+ if (isDirty && p.timestamp && (newStatus->p.timestamp == p.timestamp)) {
// We can NEVER be in two locations at the same time! (also PR #886)
DEBUG_MSG("BUG!! positional timestamp unchanged from prev solution\n");
}
@@ -136,7 +136,7 @@ class GPSStatus : public Status
if (isDirty) {
if (hasLock) {
// In debug logs, identify position by @timestamp:stage (stage 3 = notify)
- DEBUG_MSG("New GPS pos@%x:3 lat=%f, lon=%f, alt=%d, pdop=%.2f, track=%.2f, sats=%d\n", p.pos_timestamp,
+ DEBUG_MSG("New GPS pos@%x:3 lat=%f, lon=%f, alt=%d, pdop=%.2f, track=%.2f, sats=%d\n", p.timestamp,
p.latitude_i * 1e-7, p.longitude_i * 1e-7, p.altitude, p.PDOP * 1e-2, p.ground_track * 1e-5,
p.sats_in_view);
} else
diff --git a/src/Power.cpp b/src/Power.cpp
index 5c3dec01d..2c3fdd57b 100644
--- a/src/Power.cpp
+++ b/src/Power.cpp
@@ -7,10 +7,11 @@
#include "utils.h"
#include "buzz/buzz.h"
-#ifdef HAS_AXP192
-#include "axp20x.h"
-
-AXP20X_Class axp;
+#ifdef HAS_PMU
+#include "XPowersLibInterface.hpp"
+#include "XPowersAXP2101.tpp"
+#include "XPowersAXP192.tpp"
+XPowersLibInterface *PMU = NULL;
#else
// Copy of the base class defined in axp20x.h.
// I'd rather not inlude axp20x.h as it brings Wire dependency.
@@ -20,20 +21,20 @@ class HasBatteryLevel
/**
* Battery state of charge, from 0 to 100 or -1 for unknown
*/
- virtual int getBattPercentage() { return -1; }
+ virtual int getBatteryPercent() { return -1; }
/**
* The raw voltage of the battery or NAN if unknown
*/
- virtual float getBattVoltage() { return NAN; }
+ virtual uint16_t getBattVoltage() { return 0; }
/**
* return true if there is a battery installed in this unit
*/
virtual bool isBatteryConnect() { return false; }
- virtual bool isVBUSPlug() { return false; }
- virtual bool isChargeing() { return false; }
+ virtual bool isVbusIn() { return false; }
+ virtual bool isCharging() { return false; }
};
#endif
@@ -75,7 +76,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
*
* FIXME - use a lipo lookup table, the current % full is super wrong
*/
- virtual int getBattPercentage() override
+ virtual int getBatteryPercent() override
{
float v = getBattVoltage();
@@ -94,7 +95,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
/**
* The raw voltage of the batteryin millivolts or NAN if unknown
*/
- virtual float getBattVoltage() override
+ virtual uint16_t getBattVoltage() override
{
#ifndef ADC_MULTIPLIER
@@ -130,27 +131,27 @@ class AnalogBatteryLevel : public HasBatteryLevel
#endif
// DEBUG_MSG("battery gpio %d raw val=%u scaled=%u\n", BATTERY_PIN, raw, (uint32_t)(scaled));
last_read_value = scaled;
- return scaled;
+ return scaled * 1000;
} else {
return last_read_value;
}
#else
- return NAN;
+ return 0;
#endif
}
/**
* return true if there is a battery installed in this unit
*/
- virtual bool isBatteryConnect() override { return getBattPercentage() != -1; }
+ virtual bool isBatteryConnect() override { return getBatteryPercent() != -1; }
/// If we see a battery voltage higher than physics allows - assume charger is pumping
/// in power
- virtual bool isVBUSPlug() override { return getBattVoltage() > chargingVolt; }
+ virtual bool isVbusIn() override { return getBattVoltage() > chargingVolt; }
/// Assume charging if we have a battery and external power is connected.
/// we can't be smart enough to say 'full'?
- virtual bool isChargeing() override { return isBatteryConnect() && isVBUSPlug(); }
+ virtual bool isCharging() override { return isBatteryConnect() && isVbusIn(); }
private:
/// If we see a battery voltage higher than physics allows - assume charger is pumping
@@ -219,7 +220,7 @@ bool Power::analogInit()
bool Power::setup()
{
- bool found = axp192Init();
+ bool found = axpChipInit();
if (!found) {
found = analogInit();
@@ -232,10 +233,14 @@ bool Power::setup()
void Power::shutdown()
{
-#ifdef HAS_AXP192
+
+
+#ifdef HAS_PMU
DEBUG_MSG("Shutting down\n");
- axp.setChgLEDMode(AXP20X_LED_OFF);
- axp.shutdown();
+ if(PMU){
+ PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
+ PMU->shutdown();
+ }
#elif defined(ARCH_NRF52)
playBeep();
ledOff(PIN_LED1);
@@ -256,8 +261,8 @@ void Power::readPowerStatus()
if (hasBattery) {
batteryVoltageMv = batteryLevel->getBattVoltage();
// If the AXP192 returns a valid battery percentage, use it
- if (batteryLevel->getBattPercentage() >= 0) {
- batteryChargePercent = batteryLevel->getBattPercentage();
+ if (batteryLevel->getBatteryPercent() >= 0) {
+ batteryChargePercent = batteryLevel->getBatteryPercent();
} else {
// If the AXP192 returns a percentage less than 0, the feature is either not supported or there is an error
// In that case, we compute an estimate of the charge percent based on maximum and minimum voltages defined in
@@ -270,8 +275,8 @@ void Power::readPowerStatus()
// Notify any status instances that are observing us
const PowerStatus powerStatus2 =
- PowerStatus(hasBattery ? OptTrue : OptFalse, batteryLevel->isVBUSPlug() ? OptTrue : OptFalse,
- batteryLevel->isChargeing() ? OptTrue : OptFalse, batteryVoltageMv, batteryChargePercent);
+ PowerStatus(hasBattery ? OptTrue : OptFalse, batteryLevel->isVbusIn() ? OptTrue : OptFalse,
+ batteryLevel->isCharging() ? OptTrue : OptFalse, batteryVoltageMv, batteryChargePercent);
DEBUG_MSG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d\n", powerStatus2.getHasUSB(),
powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
newStatus.notifyObservers(&powerStatus2);
@@ -304,41 +309,46 @@ int32_t Power::runOnce()
{
readPowerStatus();
-#ifdef HAS_AXP192
+#ifdef HAS_PMU
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
// the IRQ status by reading the registers over I2C
- axp.readIRQ();
+ if(PMU){
- if (axp.isVbusRemoveIRQ()) {
- DEBUG_MSG("USB unplugged\n");
- powerFSM.trigger(EVENT_POWER_DISCONNECTED);
- }
- if (axp.isVbusPlugInIRQ()) {
- DEBUG_MSG("USB plugged In\n");
- powerFSM.trigger(EVENT_POWER_CONNECTED);
- }
- /*
- Other things we could check if we cared...
+ PMU->getIrqStatus();
- if (axp.isChargingIRQ()) {
- DEBUG_MSG("Battery start charging\n");
+ if(PMU->isVbusRemoveIrq()){
+ DEBUG_MSG("USB unplugged\n");
+ powerFSM.trigger(EVENT_POWER_DISCONNECTED);
+ }
+
+ if (PMU->isVbusInsertIrq()) {
+ DEBUG_MSG("USB plugged In\n");
+ powerFSM.trigger(EVENT_POWER_CONNECTED);
+ }
+
+ /*
+ Other things we could check if we cared...
+
+ if (PMU->isBatChagerStartIrq()) {
+ DEBUG_MSG("Battery start charging\n");
+ }
+ if (PMU->isBatChagerDoneIrq()) {
+ DEBUG_MSG("Battery fully charged\n");
+ }
+ if (PMU->isBatInsertIrq()) {
+ DEBUG_MSG("Battery inserted\n");
+ }
+ if (PMU->isBatRemoveIrq()) {
+ DEBUG_MSG("Battery removed\n");
+ }
+ if (PMU->isPekeyShortPressIrq()) {
+ DEBUG_MSG("PEK short button press\n");
+ }
+ */
+
+ PMU->clearIrqStatus();
}
- if (axp.isChargingDoneIRQ()) {
- DEBUG_MSG("Battery fully charged\n");
- }
- if (axp.isBattPlugInIRQ()) {
- DEBUG_MSG("Battery inserted\n");
- }
- if (axp.isBattRemoveIRQ()) {
- DEBUG_MSG("Battery removed\n");
- }
- if (axp.isPEKShortPressIRQ()) {
- DEBUG_MSG("PEK short button press\n");
- }
- */
- axp.clearIRQ();
#endif
-
// Only read once every 20 seconds once the power status for the app has been initialized
return (statusHandler && statusHandler->isInitialized()) ? (1000 * 20) : RUN_SAME;
}
@@ -351,128 +361,204 @@ int32_t Power::runOnce()
share the same i2c bus, instead use ssd1306 sleep mode DCDC2 -> unused DCDC3 0.7-3.5V @ 700mA max -> ESP32 (keep this on!) LDO1
30mA -> charges GPS backup battery // charges the tiny J13 battery by the GPS to power the GPS ram (for a couple of days), can
not be turned off LDO2 200mA -> LORA LDO3 200mA -> GPS
+ *
*/
-bool Power::axp192Init()
+bool Power::axpChipInit()
{
-#ifdef HAS_AXP192
- if (axp192_found) {
- if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
- batteryLevel = &axp;
- DEBUG_MSG("AXP192 Begin PASS\n");
+#ifdef HAS_PMU
- // axp.setChgLEDMode(LED_BLINK_4HZ);
- DEBUG_MSG("DCDC1: %s\n", axp.isDCDC1Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("DCDC2: %s\n", axp.isDCDC2Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("LDO2: %s\n", axp.isLDO2Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("LDO3: %s\n", axp.isLDO3Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("DCDC3: %s\n", axp.isDCDC3Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("Exten: %s\n", axp.isExtenEnable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("----------------------------------------\n");
-
- axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // LORA radio
- // axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // GPS main power - now turned on in setGpsPower
- axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
- axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
- axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
- axp.setDCDC1Voltage(3300); // for the OLED power
-
- DEBUG_MSG("DCDC1: %s\n", axp.isDCDC1Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("DCDC2: %s\n", axp.isDCDC2Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("LDO2: %s\n", axp.isLDO2Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("LDO3: %s\n", axp.isLDO3Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("DCDC3: %s\n", axp.isDCDC3Enable() ? "ENABLE" : "DISABLE");
- DEBUG_MSG("Exten: %s\n", axp.isExtenEnable() ? "ENABLE" : "DISABLE");
-
- switch (config.power.charge_current) {
- case Config_PowerConfig_ChargeCurrent_MAUnset:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA100:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_100MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA190:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_190MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA280:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_280MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA360:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_360MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA450:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA550:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_550MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA630:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_630MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA700:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_700MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA780:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_780MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA880:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_880MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA960:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_960MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA1000:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1000MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA1080:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1080MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA1160:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1160MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA1240:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1240MA);
- break;
- case Config_PowerConfig_ChargeCurrent_MA1320:
- axp.setChargeControlCur(AXP1XX_CHARGE_CUR_1320MA);
- break;
- }
-
-#if 0
-
- // Not connected
- //val = 0xfc;
- //axp._writeByte(AXP202_VHTF_CHGSET, 1, &val); // Set temperature protection
-
- //not used
- //val = 0x46;
- //axp._writeByte(AXP202_OFF_CTL, 1, &val); // enable bat detection
-#endif
- axp.debugCharging();
-
-#ifdef PMU_IRQ
- pinMode(PMU_IRQ, INPUT);
- attachInterrupt(
- PMU_IRQ, [] { pmu_irq = true; }, FALLING);
-
- axp.adc1Enable(AXP202_BATT_CUR_ADC1, 1);
- // we do not look for AXP202_CHARGING_FINISHED_IRQ & AXP202_CHARGING_IRQ because it occurs repeatedly while there is
- // no battery also it could cause inadvertent waking from light sleep just because the battery filled
- // we don't look for AXP202_BATT_REMOVED_IRQ because it occurs repeatedly while no battery installed
- // we don't look at AXP202_VBUS_REMOVED_IRQ because we don't have anything hooked to vbus
- axp.enableIRQ(AXP202_BATT_CONNECT_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_PEK_SHORTPRESS_IRQ, 1);
-
- axp.clearIRQ();
-#endif
- readPowerStatus();
+ if (!PMU) {
+ PMU = new XPowersAXP2101(Wire, I2C_SDA, I2C_SCL);
+ if (!PMU->init()) {
+ DEBUG_MSG("Warning: Failed to find AXP2101 power management\n");
+ delete PMU;
+ PMU = NULL;
} else {
- DEBUG_MSG("AXP192 Begin FAIL\n");
+ DEBUG_MSG("AXP2101 PMU init succeeded, using AXP2101 PMU\n");
}
- } else {
- DEBUG_MSG("AXP192 not found\n");
}
- return axp192_found;
+ if (!PMU) {
+ PMU = new XPowersAXP192(Wire, I2C_SDA, I2C_SCL);
+ if (!PMU->init()) {
+ DEBUG_MSG("Warning: Failed to find AXP192 power management\n");
+ delete PMU;
+ PMU = NULL;
+ } else {
+ DEBUG_MSG("AXP192 PMU init succeeded, using AXP192 PMU\n");
+ }
+ }
+
+ if (!PMU) {
+ /*
+ * In XPowersLib, if the XPowersAXPxxx object is released, Wire.end() will be called at the same time.
+ * In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once,
+ * if there are multiple devices sharing the bus.
+ * * */
+ Wire.begin(I2C_SDA, I2C_SCL);
+ return false;
+ }
+
+ batteryLevel = PMU;
+
+ if (PMU->getChipModel() == XPOWERS_AXP192) {
+
+ // lora radio power channel
+ PMU->setPowerChannelVoltage(XPOWERS_LDO2, 3300);
+ PMU->enablePowerOutput(XPOWERS_LDO2);
+
+
+ // oled module power channel,
+ // disable it will cause abnormal communication between boot and AXP power supply,
+ // do not turn it off
+ PMU->setPowerChannelVoltage(XPOWERS_DCDC1, 3300);
+ // enable oled power
+ PMU->enablePowerOutput(XPOWERS_DCDC1);
+
+
+ // gnss module power channel - now turned on in setGpsPower
+ PMU->setPowerChannelVoltage(XPOWERS_LDO3, 3300);
+ // PMU->enablePowerOutput(XPOWERS_LDO3);
+
+
+ //protected oled power source
+ PMU->setProtectedChannel(XPOWERS_DCDC1);
+ //protected esp32 power source
+ PMU->setProtectedChannel(XPOWERS_DCDC3);
+
+ //disable not use channel
+ PMU->disablePowerOutput(XPOWERS_DCDC2);
+
+ //disable all axp chip interrupt
+ PMU->disableIRQ(XPOWERS_AXP192_ALL_IRQ);
+
+ // Set constant current charging current
+ PMU->setChargerConstantCurr(XPOWERS_AXP192_CHG_CUR_450MA);
+
+
+ } else if (PMU->getChipModel() == XPOWERS_AXP2101) {
+
+ // t-beam s3 core
+
+ // gnss module power channel - now turned on in setGpsPower
+ // PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
+ // PMU->enablePowerOutput(XPOWERS_ALDO4);
+
+ // lora radio power channel
+ PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
+ PMU->enablePowerOutput(XPOWERS_ALDO3);
+
+ // m.2 interface
+ PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
+ PMU->enablePowerOutput(XPOWERS_DCDC3);
+
+ // PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
+ // PMU->enablePowerOutput(XPOWERS_DCDC4);
+
+ //not use channel
+ PMU->disablePowerOutput(XPOWERS_DCDC2); //not elicited
+ PMU->disablePowerOutput(XPOWERS_DCDC5); //not elicited
+ PMU->disablePowerOutput(XPOWERS_DLDO1); //Invalid power channel, it does not exist
+ PMU->disablePowerOutput(XPOWERS_DLDO2); //Invalid power channel, it does not exist
+ PMU->disablePowerOutput(XPOWERS_VBACKUP);
+
+ //disable all axp chip interrupt
+ PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
+
+ //Set the constant current charging current of AXP2101, temporarily use 500mA by default
+ PMU->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_500MA);
+
+ }
+
+
+ PMU->clearIrqStatus();
+
+ // TBeam1.1 /T-Beam S3-Core has no external TS detection,
+ // it needs to be disabled, otherwise it will cause abnormal charging
+ PMU->disableTSPinMeasure();
+
+ // PMU->enableSystemVoltageMeasure();
+ PMU->enableVbusVoltageMeasure();
+ PMU->enableBattVoltageMeasure();
+
+ DEBUG_MSG("=======================================================================\n");
+ if (PMU->isChannelAvailable(XPOWERS_DCDC1)) {
+ DEBUG_MSG("DC1 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC1) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_DCDC1));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_DCDC2)) {
+ DEBUG_MSG("DC2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC2) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_DCDC2));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_DCDC3)) {
+ DEBUG_MSG("DC3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC3) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_DCDC3));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_DCDC4)) {
+ DEBUG_MSG("DC4 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_DCDC4) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_DCDC4));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_LDO2)) {
+ DEBUG_MSG("LDO2 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO2) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_LDO2));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_LDO3)) {
+ DEBUG_MSG("LDO3 : %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_LDO3) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_LDO3));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_ALDO1)) {
+ DEBUG_MSG("ALDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO1) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_ALDO1));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_ALDO2)) {
+ DEBUG_MSG("ALDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO2) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_ALDO2));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_ALDO3)) {
+ DEBUG_MSG("ALDO3: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO3) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_ALDO3));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_ALDO4)) {
+ DEBUG_MSG("ALDO4: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_ALDO4) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_ALDO4));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_BLDO1)) {
+ DEBUG_MSG("BLDO1: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO1) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_BLDO1));
+ }
+ if (PMU->isChannelAvailable(XPOWERS_BLDO2)) {
+ DEBUG_MSG("BLDO2: %s Voltage:%u mV \n", PMU->isPowerChannelEnable(XPOWERS_BLDO2) ? "+" : "-", PMU->getPowerChannelVoltage(XPOWERS_BLDO2));
+ }
+ DEBUG_MSG("=======================================================================\n");
+
+
+ //Set up the charging voltage, AXP2101/AXP192 4.2V gear is the same
+ // XPOWERS_AXP192_CHG_VOL_4V2 = XPOWERS_AXP2101_CHG_VOL_4V2
+ PMU->setChargeTargetVoltage(XPOWERS_AXP192_CHG_VOL_4V2);
+
+ // Set PMU shutdown voltage at 2.6V to maximize battery utilization
+ PMU->setSysPowerDownVoltage(2600);
+
+
+
+#ifdef PMU_IRQ
+ uint64_t pmuIrqMask = 0;
+
+ if (PMU->getChipModel() == XPOWERS_AXP192) {
+ pmuIrqMask = XPOWERS_AXP192_VBUS_INSERT_IRQ | XPOWERS_AXP192_BAT_INSERT_IRQ | XPOWERS_AXP192_PKEY_SHORT_IRQ;
+ } else if (PMU->getChipModel() == XPOWERS_AXP2101) {
+ pmuIrqMask = XPOWERS_AXP2101_VBUS_INSERT_IRQ | XPOWERS_AXP2101_BAT_INSERT_IRQ | XPOWERS_AXP2101_PKEY_SHORT_IRQ;
+ }
+
+ pinMode(PMU_IRQ, INPUT);
+ attachInterrupt(
+ PMU_IRQ, [] { pmu_irq = true; }, FALLING);
+
+ // we do not look for AXPXXX_CHARGING_FINISHED_IRQ & AXPXXX_CHARGING_IRQ because it occurs repeatedly while there is
+ // no battery also it could cause inadvertent waking from light sleep just because the battery filled
+ // we don't look for AXPXXX_BATT_REMOVED_IRQ because it occurs repeatedly while no battery installed
+ // we don't look at AXPXXX_VBUS_REMOVED_IRQ because we don't have anything hooked to vbus
+ PMU->enableIRQ(pmuIrqMask);
+
+ PMU->clearIrqStatus();
+#endif /*PMU_IRQ*/
+
+ readPowerStatus();
+
+ pmu_found = true;
+
+ return pmu_found;
+
#else
return false;
#endif
diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp
index b9e4edcc5..2a495999b 100644
--- a/src/PowerFSM.cpp
+++ b/src/PowerFSM.cpp
@@ -12,11 +12,11 @@
static bool isPowered()
{
// Circumvent the battery sensing logic and assumes constant power if no battery pin or power mgmt IC
- #if !defined(BATTERY_PIN) && !defined(HAS_AXP192)
+ #if !defined(BATTERY_PIN) && !defined(HAS_AXP192) && !defined(HAS_AXP2101)
return true;
#endif
- bool isRouter = (config.device.role == Config_DeviceConfig_Role_Router ? 1 : 0);
+ bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0);
// If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON
// We assume routers might be powered all the time, but from a low current (solar) source
@@ -237,7 +237,7 @@ Fsm powerFSM(&stateBOOT);
void PowerFSM_setup()
{
- bool isRouter = (config.device.role == Config_DeviceConfig_Role_Router ? 1 : 0);
+ bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0);
bool hasPower = isPowered();
DEBUG_MSG("PowerFSM init, USB power=%d\n", hasPower);
diff --git a/src/detect/i2cScan.h b/src/detect/i2cScan.h
index c1c6f8f87..f5f8effc9 100644
--- a/src/detect/i2cScan.h
+++ b/src/detect/i2cScan.h
@@ -3,8 +3,9 @@
#include
#include "mesh/generated/telemetry.pb.h"
-#ifdef HAS_AXP192
-#include "axp20x.h"
+// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp
+#ifndef XPOWERS_AXP192_AXP2101_ADDRESS
+#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34
#endif
#if HAS_WIRE
@@ -114,10 +115,10 @@ void scanI2Cdevice(void)
screen_found = addr;
DEBUG_MSG("st7567 display found\n");
}
-#ifdef HAS_AXP192
- if (addr == AXP192_SLAVE_ADDRESS) {
- axp192_found = true;
- DEBUG_MSG("axp192 PMU found\n");
+#ifdef HAS_PMU
+ if (addr == XPOWERS_AXP192_AXP2101_ADDRESS) {
+ pmu_found = true;
+ DEBUG_MSG("axp192/axp2101 PMU found\n");
}
#endif
if (addr == BME_ADDR || addr == BME_ADDR_ALTERNATE) {
diff --git a/src/error.h b/src/error.h
index 0893f02f8..e57407bf8 100644
--- a/src/error.h
+++ b/src/error.h
@@ -8,4 +8,4 @@
#define RECORD_CRITICALERROR(code) recordCriticalError(code, __LINE__, __FILE__)
/// Record an error that should be reported via analytics
-void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_Unspecified, uint32_t address = 0, const char *filename = NULL);
+void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_UNSPECIFIED, uint32_t address = 0, const char *filename = NULL);
diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp
index f8bff1dfd..9cedc82a2 100644
--- a/src/gps/GPS.cpp
+++ b/src/gps/GPS.cpp
@@ -64,15 +64,40 @@ bool GPS::setupGPS()
if (_serial_gps && !didSerialInit) {
didSerialInit = true;
+#if CONFIG_IDF_TARGET_ESP32S3
+ // In esp32s3 framework, setRxBufferSize needs to be initialized before Serial
+ _serial_gps->setRxBufferSize(2048); // the default is 256
+#endif
+
// ESP32 has a special set of parameters vs other arduino ports
#if defined(GPS_RX_PIN) && defined(ARCH_ESP32)
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
#else
_serial_gps->begin(GPS_BAUDRATE);
#endif
-#ifdef ARCH_ESP32
+
+#if CONFIG_IDF_TARGET_ESP32
_serial_gps->setRxBufferSize(2048); // the default is 256
#endif
+
+#ifdef LILYGO_TBEAM_S3_CORE
+ /*
+ * t-beam-s3-core uses the same L76K GNSS module as t-echo.
+ * Unlike t-echo, L76K uses 9600 baud rate for communication by default.
+ * */
+ _serial_gps->begin(9600);
+ delay(250);
+ // Initialize the L76K Chip, use GPS + GLONASS
+ _serial_gps->write("$PCAS04,5*1C\r\n");
+ delay(250);
+ // only ask for RMC and GGA
+ _serial_gps->write("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0*02\r\n");
+ delay(250);
+ // Switch to Vehicle Mode, since SoftRF enables Aviation < 2g
+ _serial_gps->write("$PCAS11,3*1E\r\n");
+ delay(250);
+#endif
+
#ifdef TTGO_T_ECHO
// Switch to 9600 baud, then close and reopen port
_serial_gps->end();
@@ -273,7 +298,7 @@ uint32_t GPS::getWakeTime() const
return t; // already maxint
if (t == 0)
- t = (config.device.role == Config_DeviceConfig_Role_Router)
+ t = (config.device.role == Config_DeviceConfig_Role_ROUTER)
? 5 * 60
: 15 * 60; // Allow up to 15 mins for each attempt (probably will be much
// less if we can find sats) or less if a router
@@ -297,7 +322,7 @@ uint32_t GPS::getSleepTime() const
return t; // already maxint
if (t == 0) // default - unset in preferences
- t = (config.device.role == Config_DeviceConfig_Role_Router) ? 24 * 60 * 60
+ t = (config.device.role == Config_DeviceConfig_Role_ROUTER) ? 24 * 60 * 60
: 2 * 60; // 2 mins or once per day for routers
t *= 1000;
@@ -311,7 +336,7 @@ void GPS::publishUpdate()
shouldPublish = false;
// In debug logs, identify position by @timestamp:stage (stage 2 = publish)
- DEBUG_MSG("publishing pos@%x:2, hasVal=%d, GPSlock=%d\n", p.pos_timestamp, hasValidLocation, hasLock());
+ DEBUG_MSG("publishing pos@%x:2, hasVal=%d, GPSlock=%d\n", p.timestamp, hasValidLocation, hasLock());
// Notify any status instances that are observing us
const meshtastic::GPSStatus status = meshtastic::GPSStatus(hasValidLocation, isConnected(), p);
diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp
index 363eb8263..fc8f72781 100644
--- a/src/gps/NMEAGPS.cpp
+++ b/src/gps/NMEAGPS.cpp
@@ -155,7 +155,7 @@ bool NMEAGPS::lookForLocation()
return false;
}
- p.location_source = Position_LocSource_LOCSRC_GPS_INTERNAL;
+ p.location_source = Position_LocSource_LOC_INTERNAL;
// Dilution of precision (an accuracy metric) is reported in 10^2 units, so we need to scale down when we use it
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
@@ -176,8 +176,7 @@ bool NMEAGPS::lookForLocation()
p.latitude_i = toDegInt(loc.lat);
p.longitude_i = toDegInt(loc.lng);
- p.alt_geoid_sep = reader.geoidHeight.meters();
- p.altitude_hae = reader.altitude.meters() + p.alt_geoid_sep;
+ p.altitude_hae = reader.altitude.meters() + reader.geoidHeight.meters();
p.altitude = reader.altitude.meters();
p.fix_quality = fixQual;
@@ -194,7 +193,7 @@ bool NMEAGPS::lookForLocation()
t.tm_mon = reader.date.month() - 1;
t.tm_year = reader.date.year() - 1900;
t.tm_isdst = false;
- p.pos_timestamp = mktime(&t);
+ p.timestamp = mktime(&t);
// Nice to have, if available
if (reader.satellites.isUpdated()) {
diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp
index c74fa134e..77f61a796 100644
--- a/src/graphics/Screen.cpp
+++ b/src/graphics/Screen.cpp
@@ -540,21 +540,21 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const
display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine);
} else {
- if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDMS) {
+ if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) {
char coordinateLine[22];
geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude()));
- if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec) { // Decimal Degrees
+ if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees
sprintf(coordinateLine, "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7);
- } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_GpsFormatUTM) { // Universal Transverse Mercator
+ } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator
sprintf(coordinateLine, "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(),
geoCoord.getUTMEasting(), geoCoord.getUTMNorthing());
- } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_GpsFormatMGRS) { // Military Grid Reference System
+ } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System
sprintf(coordinateLine, "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(),
geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(),
geoCoord.getMGRSNorthing());
- } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOLC) { // Open Location Code
+ } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code
geoCoord.getOLCCode(coordinateLine);
- } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR) { // Ordnance Survey Grid Reference
+ } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference
if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region
sprintf(coordinateLine, "%s", "Out of Boundary");
else
@@ -1010,7 +1010,7 @@ int32_t Screen::runOnce()
}
#ifndef DISABLE_WELCOME_UNSET
- if (showingNormalScreen && config.lora.region == Config_LoRaConfig_RegionCode_Unset) {
+ if (showingNormalScreen && config.lora.region == Config_LoRaConfig_RegionCode_UNSET) {
setWelcomeFrames();
}
#endif
@@ -1366,8 +1366,8 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
#if HAS_WIFI
- const char *wifiName = config.wifi.ssid;
- const char *wifiPsw = config.wifi.psk;
+ const char *wifiName = config.network.wifi_ssid;
+ const char *wifiPsw = config.network.wifi_psk;
displayedNodeNum = 0; // Not currently showing a node pane
@@ -1378,7 +1378,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
if (isSoftAPForced()) {
display->drawString(x, y, String("WiFi: Software AP (Admin)"));
- } else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
+ } else if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN) {
display->drawString(x, y, String("WiFi: Software AP"));
} else if (WiFi.status() != WL_CONNECTED) {
display->drawString(x, y, String("WiFi: Not Connected"));
@@ -1401,8 +1401,8 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
- WL_NO_SHIELD: assigned when no WiFi shield is present;
*/
- if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
+ if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN) {
+ if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN || isSoftAPForced()) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
// Number of connections to the AP. Default max for the esp32 is 4
@@ -1494,7 +1494,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
}
} else {
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
+ if (config.network.wifi_mode== Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN) {
if ((millis() / 10000) % 2) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 2, "SSID: " + String(wifiName));
} else {
@@ -1542,25 +1542,25 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
auto mode = "";
switch (config.lora.modem_preset) {
- case Config_LoRaConfig_ModemPreset_ShortSlow:
+ case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
mode = "ShortS";
break;
- case Config_LoRaConfig_ModemPreset_ShortFast:
+ case Config_LoRaConfig_ModemPreset_SHORT_FAST:
mode = "ShortF";
break;
- case Config_LoRaConfig_ModemPreset_MedSlow:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
mode = "MedS";
break;
- case Config_LoRaConfig_ModemPreset_MedFast:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
mode = "MedF";
break;
- case Config_LoRaConfig_ModemPreset_LongSlow:
+ case Config_LoRaConfig_ModemPreset_LONG_SLOW:
mode = "LongS";
break;
- case Config_LoRaConfig_ModemPreset_LongFast:
+ case Config_LoRaConfig_ModemPreset_LONG_FAST:
mode = "LongF";
break;
- case Config_LoRaConfig_ModemPreset_VLongSlow:
+ case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
mode = "VeryL";
break;
default:
@@ -1619,7 +1619,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
// Line 3
if (config.display.gps_format !=
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDMS) // if DMS then don't draw altitude
+ Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude
drawGPSAltitude(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus);
// Line 4
diff --git a/src/input/RotaryEncoderInterruptBase.cpp b/src/input/RotaryEncoderInterruptBase.cpp
index 1cda39a79..6914824fd 100644
--- a/src/input/RotaryEncoderInterruptBase.cpp
+++ b/src/input/RotaryEncoderInterruptBase.cpp
@@ -34,7 +34,7 @@ void RotaryEncoderInterruptBase::init(
int32_t RotaryEncoderInterruptBase::runOnce()
{
InputEvent e;
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;
if (this->action == ROTARY_ACTION_PRESSED) {
@@ -48,7 +48,7 @@ int32_t RotaryEncoderInterruptBase::runOnce()
e.inputEvent = this->_eventCcw;
}
- if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE) {
+ if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
this->notifyObservers(&e);
}
diff --git a/src/input/RotaryEncoderInterruptBase.h b/src/input/RotaryEncoderInterruptBase.h
index 2965790fd..c468f4dc6 100644
--- a/src/input/RotaryEncoderInterruptBase.h
+++ b/src/input/RotaryEncoderInterruptBase.h
@@ -33,8 +33,8 @@ class RotaryEncoderInterruptBase : public Observable, privat
private:
uint8_t _pinA = 0;
uint8_t _pinB = 0;
- char _eventCw = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
- char _eventCcw = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
- char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
+ char _eventCw = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
+ char _eventCcw = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
+ char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
const char *_originName;
};
diff --git a/src/input/UpDownInterruptBase.h b/src/input/UpDownInterruptBase.h
index b6382ff71..1ee4e4a03 100644
--- a/src/input/UpDownInterruptBase.h
+++ b/src/input/UpDownInterruptBase.h
@@ -16,8 +16,8 @@ class UpDownInterruptBase : public Observable
private:
uint8_t _pinDown = 0;
uint8_t _pinUp = 0;
- char _eventDown = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
- char _eventUp = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
- char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
+ char _eventDown = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
+ char _eventUp = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
+ char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
const char *_originName;
};
diff --git a/src/input/UpDownInterruptImpl1.cpp b/src/input/UpDownInterruptImpl1.cpp
index fc04a8628..c49409660 100644
--- a/src/input/UpDownInterruptImpl1.cpp
+++ b/src/input/UpDownInterruptImpl1.cpp
@@ -17,9 +17,9 @@ void UpDownInterruptImpl1::init()
uint8_t pinDown = moduleConfig.canned_message.inputbroker_pin_b;
uint8_t pinPress = moduleConfig.canned_message.inputbroker_pin_press;
- char eventDown = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_DOWN);
- char eventUp = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_UP);
- char eventPressed = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_SELECT);
+ char eventDown = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_DOWN);
+ char eventUp = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_UP);
+ char eventPressed = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_SELECT);
UpDownInterruptBase::init(pinDown, pinUp, pinPress, eventDown, eventUp, eventPressed, UpDownInterruptImpl1::handleIntDown,
UpDownInterruptImpl1::handleIntUp, UpDownInterruptImpl1::handleIntPressed);
diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp
index 6a00e5a9a..4d94f31b0 100644
--- a/src/input/kbI2cBase.cpp
+++ b/src/input/kbI2cBase.cpp
@@ -2,6 +2,8 @@
#include "configuration.h"
#include
+extern uint8_t cardkb_found;
+
KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name)
{
this->_originName = name;
@@ -10,7 +12,7 @@ KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name)
int32_t KbI2cBase::runOnce()
{
InputEvent e;
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;
Wire.requestFrom(CARDKB_ADDR, 1);
@@ -19,30 +21,30 @@ int32_t KbI2cBase::runOnce()
char c = Wire.read();
switch (c) {
case 0x1b: // ESC
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_CANCEL;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
break;
case 0x08: // Back
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_BACK;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_BACK;
break;
case 0xb5: // Up
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_UP;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_UP;
break;
case 0xb6: // Down
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_DOWN;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
break;
case 0xb4: // Left
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_LEFT;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
break;
case 0xb7: // Right
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_RIGHT;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
break;
case 0x0d: // Enter
- e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_KEY_SELECT;
+ e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
break;
}
}
- if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE) {
+ if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
this->notifyObservers(&e);
}
return 500;
diff --git a/src/main.cpp b/src/main.cpp
index ece1fc868..0ef46107b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -84,7 +84,7 @@ bool eink_found = true;
uint32_t serialSinceMsec;
-bool axp192_found;
+bool pmu_found;
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
uint8_t nodeTelemetrySensorsMap[7] = { 0, 0, 0, 0, 0, 0, 0 };
@@ -301,9 +301,9 @@ void setup()
setupModules();
// Do this after service.init (because that clears error_code)
-#ifdef HAS_AXP192
- if (!axp192_found)
- RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware
+#ifdef HAS_PMU
+ if (!pmu_found)
+ RECORD_CRITICALERROR(CriticalErrorCode_NO_AXP192); // Record a hardware fault for missing hardware
#endif
// Don't call screen setup until after nodedb is setup (because we need
@@ -421,7 +421,7 @@ void setup()
airTime = new AirTime();
if (!rIf)
- RECORD_CRITICALERROR(CriticalErrorCode_NoRadio);
+ RECORD_CRITICALERROR(CriticalErrorCode_NO_RADIO);
else {
router->addInterface(rIf);
diff --git a/src/main.h b/src/main.h
index 02dce04b3..3f4bea7e2 100644
--- a/src/main.h
+++ b/src/main.h
@@ -15,7 +15,7 @@ extern uint8_t faceskb_found;
extern uint8_t rtc_found;
extern bool eink_found;
-extern bool axp192_found;
+extern bool pmu_found;
extern bool isCharging;
extern bool isUSBPowered;
diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp
index 2385da77d..b228cf8f4 100644
--- a/src/mesh/Channels.cpp
+++ b/src/mesh/Channels.cpp
@@ -85,7 +85,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex)
ChannelSettings &channelSettings = ch.settings;
Config_LoRaConfig &loraConfig = config.lora;
- loraConfig.modem_preset = Config_LoRaConfig_ModemPreset_LongFast; // Default to Long Range & Fast
+ loraConfig.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast
loraConfig.tx_power = 0; // default
uint8_t defaultpskIndex = 1;
@@ -214,25 +214,25 @@ const char *Channels::getName(size_t chIndex)
channelName = "Custom";
else
switch (config.lora.modem_preset) {
- case Config_LoRaConfig_ModemPreset_ShortSlow:
+ case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
channelName = "ShortS";
break;
- case Config_LoRaConfig_ModemPreset_ShortFast:
+ case Config_LoRaConfig_ModemPreset_SHORT_FAST:
channelName = "ShortF";
break;
- case Config_LoRaConfig_ModemPreset_MedSlow:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
channelName = "MedS";
break;
- case Config_LoRaConfig_ModemPreset_MedFast:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
channelName = "MedF";
break;
- case Config_LoRaConfig_ModemPreset_LongSlow:
+ case Config_LoRaConfig_ModemPreset_LONG_SLOW:
channelName = "LongS";
break;
- case Config_LoRaConfig_ModemPreset_LongFast:
+ case Config_LoRaConfig_ModemPreset_LONG_FAST:
channelName = "LongF";
break;
- case Config_LoRaConfig_ModemPreset_VLongSlow:
+ case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
channelName = "VeryL";
break;
default:
diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp
index 5e3126f77..b6519abdb 100644
--- a/src/mesh/FloodingRouter.cpp
+++ b/src/mesh/FloodingRouter.cpp
@@ -36,7 +36,7 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
} else if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
if (p->id != 0) {
- if (config.device.role != Config_DeviceConfig_Role_ClientMute) {
+ if (config.device.role != Config_DeviceConfig_Role_CLIENT_MUTE) {
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
tosend->hop_limit--; // bump down the hop count
diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp
index 3e85cba71..a4ef25d2a 100644
--- a/src/mesh/MeshModule.cpp
+++ b/src/mesh/MeshModule.cpp
@@ -72,7 +72,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
bool moduleFound = false;
// We now allow **encrypted** packets to pass through the modules
- bool isDecoded = mp.which_payloadVariant == MeshPacket_decoded_tag;
+ bool isDecoded = mp.which_payload_variant == MeshPacket_decoded_tag;
currentReply = NULL; // No reply yet
@@ -211,7 +211,7 @@ void MeshModule::sendResponse(const MeshPacket &req)
*/
void setReplyTo(MeshPacket *p, const MeshPacket &to)
{
- assert(p->which_payloadVariant == MeshPacket_decoded_tag); // Should already be set by now
+ assert(p->which_payload_variant == MeshPacket_decoded_tag); // Should already be set by now
p->to = getFrom(&to); // Make sure that if we are sending to the local node, we use our local node addr, not 0
p->channel = to.channel; // Use the same channel that the request came in on
@@ -266,7 +266,7 @@ AdminMessageHandleResult MeshModule::handleAdminMessageForAllPlugins(const MeshP
// In case we have a response it always has priority.
DEBUG_MSG("Reply prepared by module '%s' of variant: %d\n",
pi.name,
- response->which_variant);
+ response->which_payload_variant);
handled = h;
}
else if ((handled != AdminMessageHandleResult::HANDLED_WITH_RESPONSE) &&
diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp
index dafceafe0..825252402 100644
--- a/src/mesh/MeshService.cpp
+++ b/src/mesh/MeshService.cpp
@@ -252,7 +252,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
pos.time = getValidTime(RTCQualityGPS);
// In debug logs, identify position by @timestamp:stage (stage 4 = nodeDB)
- DEBUG_MSG("onGPSChanged() pos@%x, time=%u, lat=%d, lon=%d, alt=%d\n", pos.pos_timestamp, pos.time, pos.latitude_i,
+ DEBUG_MSG("onGPSChanged() pos@%x, time=%u, lat=%d, lon=%d, alt=%d\n", pos.timestamp, pos.time, pos.latitude_i,
pos.longitude_i, pos.altitude);
// Update our current position in the local DB
diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp
index 81e2f5b47..62c34279c 100644
--- a/src/mesh/NodeDB.cpp
+++ b/src/mesh/NodeDB.cpp
@@ -73,14 +73,13 @@ NodeNum getFrom(const MeshPacket *p)
return (p->from == 0) ? nodeDB.getNodeNum() : p->from;
}
-bool NodeDB::resetRadioConfig()
+bool NodeDB::resetRadioConfig(bool factory_reset)
{
bool didFactoryReset = false;
radioGeneration++;
- // radioConfig.has_preferences = true;
- if (config.device.factory_reset) {
+ if (factory_reset) {
didFactoryReset = factoryReset();
}
@@ -113,7 +112,6 @@ bool NodeDB::resetRadioConfig()
initRegion();
if (didFactoryReset) {
- config.device.factory_reset = false;
DEBUG_MSG("Rebooting due to factory reset");
screen->startRebootScreen();
rebootAtMsec = millis() + (5 * 1000);
@@ -157,14 +155,13 @@ void NodeDB::installDefaultConfig()
config.has_lora = true;
config.has_position = true;
config.has_power = true;
- config.has_wifi = true;
+ config.has_network = true;
config.has_bluetooth = true;
-
- config.lora.region = Config_LoRaConfig_RegionCode_Unset;
- config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LongFast;
+ config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
+ config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST;
config.lora.hop_limit = HOP_RELIABLE;
resetRadioConfig();
- strncpy(config.device.ntp_server, "0.pool.ntp.org", 32);
+ strncpy(config.network.ntp_server, "0.pool.ntp.org", 32);
// FIXME: Default to bluetooth capability of platform as default
config.bluetooth.enabled = true;
config.bluetooth.fixed_pin = defaultBLEPin;
@@ -173,9 +170,9 @@ void NodeDB::installDefaultConfig()
#else
bool hasScreen = screen_found;
#endif
- config.bluetooth.mode = hasScreen ? Config_BluetoothConfig_PairingMode_RandomPin : Config_BluetoothConfig_PairingMode_FixedPin;
+ config.bluetooth.mode = hasScreen ? Config_BluetoothConfig_PairingMode_RANDOM_PIN : Config_BluetoothConfig_PairingMode_FIXED_PIN;
// for backward compat, default position flags are ALT+MSL
- config.position.position_flags = (Config_PositionConfig_PositionFlags_POS_ALTITUDE | Config_PositionConfig_PositionFlags_POS_ALT_MSL);
+ config.position.position_flags = (Config_PositionConfig_PositionFlags_ALTITUDE | Config_PositionConfig_PositionFlags_ALTITUDE_MSL);
}
void NodeDB::installDefaultModuleConfig()
@@ -238,7 +235,7 @@ void NodeDB::init()
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
- myNodeInfo.error_code = CriticalErrorCode_None; // For the error code, only show values from this boot (discard value from flash)
+ myNodeInfo.error_code = CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash)
myNodeInfo.error_address = 0;
// likewise - we always want the app requirements to come from the running appload
@@ -469,7 +466,7 @@ void NodeDB::saveToDisk()
config.has_lora = true;
config.has_position = true;
config.has_power = true;
- config.has_wifi = true;
+ config.has_network = true;
config.has_bluetooth = true;
saveProto(configFileName, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config);
@@ -535,11 +532,11 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
if (src == RX_SRC_LOCAL) {
// Local packet, fully authoritative
- DEBUG_MSG("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.pos_timestamp, p.time, p.latitude_i,
+ DEBUG_MSG("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
p.longitude_i, p.altitude);
info->position = p;
- } else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.pos_timestamp && !p.location_source) {
+ } else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.timestamp && !p.location_source) {
// FIXME SPECIAL TIME SETTING PACKET FROM EUD TO RADIO
// (stop-gap fix for issue #900)
DEBUG_MSG("updatePosition SPECIAL time setting time=%u\n", p.time);
@@ -624,7 +621,7 @@ void NodeDB::updateUser(uint32_t nodeId, const User &p)
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
void NodeDB::updateFrom(const MeshPacket &mp)
{
- if (mp.which_payloadVariant == MeshPacket_decoded_tag && mp.from) {
+ if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.from) {
DEBUG_MSG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
NodeInfo *info = getOrCreateNode(getFrom(&mp));
diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h
index 4fd77d62b..9ecfbd4ca 100644
--- a/src/mesh/NodeDB.h
+++ b/src/mesh/NodeDB.h
@@ -60,7 +60,7 @@ class NodeDB
*
* @return true if the config was completely reset, in that case, we should send it back to the client
*/
- bool resetRadioConfig();
+ bool resetRadioConfig(bool factory_reset = false);
/// given a subpacket sniffed from the network, update our DB state
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
@@ -171,7 +171,7 @@ extern NodeDB nodeDB;
// Our delay functions check for this for times that should never expire
#define NODE_DELAY_FOREVER 0xffffffff
-#define IF_ROUTER(routerVal, normalVal) ((config.device.role == Config_DeviceConfig_Role_Router) ? (routerVal) : (normalVal))
+#define IF_ROUTER(routerVal, normalVal) ((config.device.role == Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal))
#define default_broadcast_interval_secs IF_ROUTER(12 * 60 * 60, 15 * 60)
#define default_wait_bluetooth_secs IF_ROUTER(1, 60)
diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp
index 5d2c148c4..b3f500f01 100644
--- a/src/mesh/PhoneAPI.cpp
+++ b/src/mesh/PhoneAPI.cpp
@@ -78,7 +78,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
memset(&toRadioScratch, 0, sizeof(toRadioScratch));
if (pb_decode_from_bytes(buf, bufLength, ToRadio_fields, &toRadioScratch)) {
- switch (toRadioScratch.which_payloadVariant) {
+ switch (toRadioScratch.which_payload_variant) {
case ToRadio_packet_tag:
return handleToRadioPacket(toRadioScratch.packet);
case ToRadio_want_config_id_tag:
@@ -134,7 +134,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
// If the user has specified they don't want our node to share its location, make sure to tell the phone
// app not to send locations on our behalf.
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
- fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_my_info_tag;
fromRadioScratch.my_info = myNodeInfo;
state = STATE_SEND_NODEINFO;
@@ -149,7 +149,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
if (info) {
DEBUG_MSG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
info->user.long_name);
- fromRadioScratch.which_payloadVariant = FromRadio_node_info_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_node_info_tag;
fromRadioScratch.node_info = *info;
// Stay in current state until done sending nodeinfos
} else {
@@ -163,36 +163,36 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_CONFIG:
DEBUG_MSG("getFromRadio=STATE_SEND_CONFIG\n");
- fromRadioScratch.which_payloadVariant = FromRadio_config_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_config_tag;
switch (config_state) {
case Config_device_tag:
- fromRadioScratch.config.which_payloadVariant = Config_device_tag;
- fromRadioScratch.config.payloadVariant.device = config.device;
+ fromRadioScratch.config.which_payload_variant = Config_device_tag;
+ fromRadioScratch.config.payload_variant.device = config.device;
break;
case Config_position_tag:
- fromRadioScratch.config.which_payloadVariant = Config_position_tag;
- fromRadioScratch.config.payloadVariant.position = config.position;
+ fromRadioScratch.config.which_payload_variant = Config_position_tag;
+ fromRadioScratch.config.payload_variant.position = config.position;
break;
case Config_power_tag:
- fromRadioScratch.config.which_payloadVariant = Config_power_tag;
- fromRadioScratch.config.payloadVariant.power = config.power;
- fromRadioScratch.config.payloadVariant.power.ls_secs = default_ls_secs;
+ fromRadioScratch.config.which_payload_variant = Config_power_tag;
+ fromRadioScratch.config.payload_variant.power = config.power;
+ fromRadioScratch.config.payload_variant.power.ls_secs = default_ls_secs;
break;
- case Config_wifi_tag:
- fromRadioScratch.config.which_payloadVariant = Config_wifi_tag;
- fromRadioScratch.config.payloadVariant.wifi = config.wifi;
+ case Config_network_tag:
+ fromRadioScratch.config.which_payload_variant = Config_network_tag;
+ fromRadioScratch.config.payload_variant.network = config.network;
break;
case Config_display_tag:
- fromRadioScratch.config.which_payloadVariant = Config_display_tag;
- fromRadioScratch.config.payloadVariant.display = config.display;
+ fromRadioScratch.config.which_payload_variant = Config_display_tag;
+ fromRadioScratch.config.payload_variant.display = config.display;
break;
case Config_lora_tag:
- fromRadioScratch.config.which_payloadVariant = Config_lora_tag;
- fromRadioScratch.config.payloadVariant.lora = config.lora;
+ fromRadioScratch.config.which_payload_variant = Config_lora_tag;
+ fromRadioScratch.config.payload_variant.lora = config.lora;
break;
case Config_bluetooth_tag:
- fromRadioScratch.config.which_payloadVariant = Config_bluetooth_tag;
- fromRadioScratch.config.payloadVariant.bluetooth = config.bluetooth;
+ fromRadioScratch.config.which_payload_variant = Config_bluetooth_tag;
+ fromRadioScratch.config.payload_variant.bluetooth = config.bluetooth;
break;
}
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
@@ -209,31 +209,31 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_MODULECONFIG:
DEBUG_MSG("getFromRadio=STATE_SEND_MODULECONFIG\n");
- fromRadioScratch.which_payloadVariant = FromRadio_moduleConfig_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag;
switch (config_state) {
case ModuleConfig_mqtt_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_mqtt_tag;
- fromRadioScratch.moduleConfig.payloadVariant.mqtt = moduleConfig.mqtt;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_mqtt_tag;
+ fromRadioScratch.moduleConfig.payload_variant.mqtt = moduleConfig.mqtt;
break;
case ModuleConfig_serial_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_serial_tag;
- fromRadioScratch.moduleConfig.payloadVariant.serial = moduleConfig.serial;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_serial_tag;
+ fromRadioScratch.moduleConfig.payload_variant.serial = moduleConfig.serial;
break;
case ModuleConfig_external_notification_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_external_notification_tag;
- fromRadioScratch.moduleConfig.payloadVariant.external_notification = moduleConfig.external_notification;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_external_notification_tag;
+ fromRadioScratch.moduleConfig.payload_variant.external_notification = moduleConfig.external_notification;
break;
case ModuleConfig_range_test_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_range_test_tag;
- fromRadioScratch.moduleConfig.payloadVariant.range_test = moduleConfig.range_test;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_range_test_tag;
+ fromRadioScratch.moduleConfig.payload_variant.range_test = moduleConfig.range_test;
break;
case ModuleConfig_telemetry_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_telemetry_tag;
- fromRadioScratch.moduleConfig.payloadVariant.telemetry = moduleConfig.telemetry;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_telemetry_tag;
+ fromRadioScratch.moduleConfig.payload_variant.telemetry = moduleConfig.telemetry;
break;
case ModuleConfig_canned_message_tag:
- fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_canned_message_tag;
- fromRadioScratch.moduleConfig.payloadVariant.canned_message = moduleConfig.canned_message;
+ fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_canned_message_tag;
+ fromRadioScratch.moduleConfig.payload_variant.canned_message = moduleConfig.canned_message;
break;
}
@@ -247,7 +247,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
case STATE_SEND_COMPLETE_ID:
DEBUG_MSG("getFromRadio=STATE_SEND_COMPLETE_ID\n");
- fromRadioScratch.which_payloadVariant = FromRadio_config_complete_id_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag;
fromRadioScratch.config_complete_id = config_nonce;
config_nonce = 0;
state = STATE_SEND_PACKETS;
@@ -260,7 +260,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
printPacket("phone downloaded packet", packetForPhone);
// Encapsulate as a FromRadio packet
- fromRadioScratch.which_payloadVariant = FromRadio_packet_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_packet_tag;
fromRadioScratch.packet = *packetForPhone;
}
releasePhonePacket();
@@ -271,7 +271,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
}
// Do we have a message from the mesh?
- if (fromRadioScratch.which_payloadVariant != 0) {
+ if (fromRadioScratch.which_payload_variant != 0) {
// Encapsulate as a FromRadio packet
size_t numbytes = pb_encode_to_bytes(buf, FromRadio_size, FromRadio_fields, &fromRadioScratch);
// DEBUG_MSG("encoding toPhone packet to phone variant=%d, %d bytes\n", fromRadioScratch.which_payloadVariant, numbytes);
diff --git a/src/mesh/ProtobufModule.h b/src/mesh/ProtobufModule.h
index 6d307d921..9905d2250 100644
--- a/src/mesh/ProtobufModule.h
+++ b/src/mesh/ProtobufModule.h
@@ -75,7 +75,7 @@ template class ProtobufModule : protected SinglePortModule
T scratch;
T *decoded = NULL;
- if (mp.which_payloadVariant == MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) {
+ if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
decoded = &scratch;
diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp
index bab24b73f..d56681412 100644
--- a/src/mesh/RF95Interface.cpp
+++ b/src/mesh/RF95Interface.cpp
@@ -104,15 +104,15 @@ bool RF95Interface::reconfigure()
// configure publicly accessible settings
int err = lora->setSpreadingFactor(sf);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
err = lora->setBandwidth(bw);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
err = lora->setCodingRate(cr);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
err = lora->setSyncWord(syncWord);
assert(err == RADIOLIB_ERR_NONE);
@@ -125,13 +125,13 @@ bool RF95Interface::reconfigure()
err = lora->setFrequency(getFreq());
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;
err = lora->setOutputPower(power);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
startReceive(); // restart receiving
diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp
index 8a6bda287..6d35fc283 100644
--- a/src/mesh/RadioInterface.cpp
+++ b/src/mesh/RadioInterface.cpp
@@ -27,7 +27,7 @@ const RegionInfo regions[] = {
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
*/
- RDEF(EU433, 433.0f, 434.0f, 10, 0, 12, true, false),
+ RDEF(EU_433, 433.0f, 434.0f, 10, 0, 12, true, false),
/*
https://www.thethingsnetwork.org/docs/lorawan/duty-cycle/
@@ -43,7 +43,7 @@ const RegionInfo regions[] = {
(Please refer to section 4.21 in the following document)
https://ec.europa.eu/growth/tools-databases/tris/index.cfm/ro/search/?trisaction=search.detail&year=2021&num=528&dLang=EN
*/
- RDEF(EU868, 869.4f, 869.65f, 10, 0, 27, false, false),
+ RDEF(EU_868, 869.4f, 869.65f, 10, 0, 27, false, false),
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
@@ -88,7 +88,7 @@ const RegionInfo regions[] = {
https://rrf.rsm.govt.nz/smart-web/smart/page/-smart/domain/licence/LicenceSummary.wdk?id=219752
https://iotalliance.org.nz/wp-content/uploads/sites/4/2019/05/IoT-Spectrum-in-NZ-Briefing-Paper.pdf
*/
- RDEF(NZ865, 864.0f, 868.0f, 100, 0, 0, true, false),
+ RDEF(NZ_865, 864.0f, 868.0f, 100, 0, 0, true, false),
/*
https://lora-alliance.org/wp-content/uploads/2020/11/lorawan_regional_parameters_v1.0.3reva_0.pdf
@@ -98,7 +98,7 @@ const RegionInfo regions[] = {
/*
This needs to be last. Same as US.
*/
- RDEF(Unset, 902.0f, 928.0f, 100, 0, 30, true, false)
+ RDEF(UNSET, 902.0f, 928.0f, 100, 0, 30, true, false)
};
@@ -107,7 +107,7 @@ const RegionInfo *myRegion;
void initRegion()
{
const RegionInfo *r = regions;
- for (; r->code != Config_LoRaConfig_RegionCode_Unset && r->code != config.lora.region; r++)
+ for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
;
myRegion = r;
DEBUG_MSG("Wanted region %d, using %s\n", config.lora.region, r->name);
@@ -157,7 +157,7 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl)
uint32_t RadioInterface::getPacketTime(MeshPacket *p)
{
- assert(p->which_payloadVariant == MeshPacket_encrypted_tag); // It should have already been encoded by now
+ assert(p->which_payload_variant == MeshPacket_encrypted_tag); // It should have already been encoded by now
uint32_t pl = p->encrypted.size + sizeof(PacketHeader);
return getPacketTime(pl);
@@ -204,8 +204,8 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
uint32_t delay = 0;
uint8_t CWsize = map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax);
// DEBUG_MSG("rx_snr of %f so setting CWsize to:%d\n", snr, CWsize);
- if (config.device.role == Config_DeviceConfig_Role_Router ||
- config.device.role == Config_DeviceConfig_Role_RouterClient) {
+ if (config.device.role == Config_DeviceConfig_Role_ROUTER ||
+ config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT) {
delay = random(0, 2*CWsize) * slotTimeMsec;
DEBUG_MSG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
} else {
@@ -220,7 +220,7 @@ void printPacket(const char *prefix, const MeshPacket *p)
{
DEBUG_MSG("%s (id=0x%08x Fr0x%02x To0x%02x, WantAck%d, HopLim%d Ch0x%x", prefix, p->id, p->from & 0xff, p->to & 0xff,
p->want_ack, p->hop_limit, p->channel);
- if (p->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (p->which_payload_variant == MeshPacket_decoded_tag) {
auto &s = p->decoded;
DEBUG_MSG(" Portnum=%d", s.portnum);
@@ -357,37 +357,37 @@ void RadioInterface::applyModemConfig()
auto channelSettings = channels.getPrimary();
if (loraConfig.spread_factor == 0) {
switch (loraConfig.modem_preset) {
- case Config_LoRaConfig_ModemPreset_ShortFast:
+ case Config_LoRaConfig_ModemPreset_SHORT_FAST:
bw = 250;
cr = 8;
sf = 7;
break;
- case Config_LoRaConfig_ModemPreset_ShortSlow:
+ case Config_LoRaConfig_ModemPreset_SHORT_SLOW:
bw = 250;
cr = 8;
sf = 8;
break;
- case Config_LoRaConfig_ModemPreset_MedFast:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_FAST:
bw = 250;
cr = 8;
sf = 9;
break;
- case Config_LoRaConfig_ModemPreset_MedSlow:
+ case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW:
bw = 250;
cr = 8;
sf = 10;
break;
- case Config_LoRaConfig_ModemPreset_LongFast:
+ case Config_LoRaConfig_ModemPreset_LONG_FAST:
bw = 250;
cr = 8;
sf = 11;
break;
- case Config_LoRaConfig_ModemPreset_LongSlow:
+ case Config_LoRaConfig_ModemPreset_LONG_SLOW:
bw = 125;
cr = 8;
sf = 12;
break;
- case Config_LoRaConfig_ModemPreset_VLongSlow:
+ case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW:
bw = 31.25;
cr = 8;
sf = 12;
@@ -479,7 +479,7 @@ size_t RadioInterface::beginSending(MeshPacket *p)
assert(!sendingPacket);
// DEBUG_MSG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
- assert(p->which_payloadVariant == MeshPacket_encrypted_tag); // It should have already been encoded by now
+ assert(p->which_payload_variant == MeshPacket_encrypted_tag); // It should have already been encoded by now
lastTxStart = millis();
diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp
index e70738516..4375da292 100644
--- a/src/mesh/RadioLibInterface.cpp
+++ b/src/mesh/RadioLibInterface.cpp
@@ -99,7 +99,7 @@ bool RadioLibInterface::canSendImmediately()
// TX IRQ from the radio, the radio is probably broken.
if (busyTx && (millis() - lastTxStart > 60000)) {
DEBUG_MSG("Hardware Failure! busyTx for more than 60s\n");
- RECORD_CRITICALERROR(CriticalErrorCode_TransmitFailed);
+ RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED);
#ifdef ARCH_ESP32
if (busyTx && (millis() - lastTxStart > 65000)) // After 5s more, reboot
ESP.restart();
@@ -120,10 +120,10 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
#ifndef DISABLE_WELCOME_UNSET
- if (config.lora.region != Config_LoRaConfig_RegionCode_Unset) {
+ if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
if (disabled || config.lora.tx_disabled) {
- if (config.lora.region != Config_LoRaConfig_RegionCode_Unset) {
+ if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
if (disabled || config.lora.tx_disabled) {
DEBUG_MSG("send - lora_tx_disabled\n");
packetPool.release(p);
@@ -362,7 +362,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
addReceiveMetadata(mp);
- mp->which_payloadVariant = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
+ mp->which_payload_variant = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
assert(((uint32_t)payloadLen) <= sizeof(mp->encrypted.bytes));
memcpy(mp->encrypted.bytes, payload, payloadLen);
mp->encrypted.size = payloadLen;
@@ -393,7 +393,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
int res = iface->startTransmit(radiobuf, numbytes);
if (res != RADIOLIB_ERR_NONE) {
- RECORD_CRITICALERROR(CriticalErrorCode_RadioSpiBug);
+ RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG);
// This send failed, but make sure to 'complete' it properly
completeSending();
diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp
index 856a0b249..815571b9b 100644
--- a/src/mesh/Router.cpp
+++ b/src/mesh/Router.cpp
@@ -115,7 +115,7 @@ MeshPacket *Router::allocForSending()
{
MeshPacket *p = packetPool.allocZeroed();
- p->which_payloadVariant = MeshPacket_decoded_tag; // Assume payload is decoded at start.
+ p->which_payload_variant = MeshPacket_decoded_tag; // Assume payload is decoded at start.
p->from = nodeDB.getNodeNum();
p->to = NODENUM_BROADCAST;
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
@@ -202,11 +202,11 @@ ErrorCode Router::send(MeshPacket *p)
// If the packet hasn't yet been encrypted, do so now (it might already be encrypted if we are just forwarding it)
- assert(p->which_payloadVariant == MeshPacket_encrypted_tag ||
- p->which_payloadVariant == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
+ assert(p->which_payload_variant == MeshPacket_encrypted_tag ||
+ p->which_payload_variant == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
// If the packet is not yet encrypted, do so now
- if (p->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (p->which_payload_variant == MeshPacket_decoded_tag) {
ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it
#if HAS_WIFI
@@ -273,7 +273,7 @@ bool perhapsDecode(MeshPacket *p)
// DEBUG_MSG("\n\n** perhapsDecode payloadVariant - %d\n\n", p->which_payloadVariant);
- if (p->which_payloadVariant == MeshPacket_decoded_tag)
+ if (p->which_payload_variant == MeshPacket_decoded_tag)
return true; // If packet was already decoded just return
// assert(p->which_payloadVariant == MeshPacket_encrypted_tag);
@@ -300,7 +300,7 @@ bool perhapsDecode(MeshPacket *p)
DEBUG_MSG("Invalid portnum (bad psk?)!\n");
} else {
// parsing was successful
- p->which_payloadVariant = MeshPacket_decoded_tag; // change type to decoded
+ p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded
p->channel = chIndex; // change to store the index instead of the hash
/*
@@ -345,7 +345,7 @@ bool perhapsDecode(MeshPacket *p)
Routing_Error perhapsEncode(MeshPacket *p)
{
// If the packet is not yet encrypted, do so now
- if (p->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (p->which_payload_variant == MeshPacket_decoded_tag) {
static uint8_t bytes[MAX_RHPACKETLEN]; // we have to use a scratch buffer because a union
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), Data_fields, &p->decoded);
@@ -403,7 +403,7 @@ Routing_Error perhapsEncode(MeshPacket *p)
// Copy back into the packet and set the variant type
memcpy(p->encrypted.bytes, bytes, numbytes);
p->encrypted.size = numbytes;
- p->which_payloadVariant = MeshPacket_encrypted_tag;
+ p->which_payload_variant = MeshPacket_encrypted_tag;
}
return Routing_Error_NONE;
diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp
index df00ba515..64758cd0d 100644
--- a/src/mesh/SX126xInterface.cpp
+++ b/src/mesh/SX126xInterface.cpp
@@ -116,15 +116,15 @@ bool SX126xInterface::reconfigure()
// configure publicly accessible settings
int err = lora.setSpreadingFactor(sf);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
err = lora.setBandwidth(bw);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
err = lora.setCodingRate(cr);
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
// TODO: Confirm gain registers are okay now
@@ -142,7 +142,7 @@ bool SX126xInterface::reconfigure()
err = lora.setFrequency(getFreq());
if (err != RADIOLIB_ERR_NONE)
- RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
+ RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING);
if (power > 22) // This chip has lower power limits than some
power = 22;
diff --git a/src/mesh/StreamAPI.cpp b/src/mesh/StreamAPI.cpp
index e930f4f77..742614b6e 100644
--- a/src/mesh/StreamAPI.cpp
+++ b/src/mesh/StreamAPI.cpp
@@ -114,7 +114,7 @@ void StreamAPI::emitRebooted()
{
// In case we send a FromRadio packet
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
- fromRadioScratch.which_payloadVariant = FromRadio_rebooted_tag;
+ fromRadioScratch.which_payload_variant = FromRadio_rebooted_tag;
fromRadioScratch.rebooted = true;
// DEBUG_MSG("Emitting reboot packet for serial shell\n");
diff --git a/src/mesh/generated/admin.pb.c b/src/mesh/generated/admin.pb.c
index 502b5aae6..43c32055f 100644
--- a/src/mesh/generated/admin.pb.c
+++ b/src/mesh/generated/admin.pb.c
@@ -6,7 +6,7 @@
#error Regenerate this file with the current version of nanopb generator.
#endif
-PB_BIND(AdminMessage, AdminMessage, AUTO)
+PB_BIND(AdminMessage, AdminMessage, 2)
diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h
index f0a80d3d6..dff112c61 100644
--- a/src/mesh/generated/admin.pb.h
+++ b/src/mesh/generated/admin.pb.h
@@ -19,7 +19,7 @@ typedef enum _AdminMessage_ConfigType {
AdminMessage_ConfigType_DEVICE_CONFIG = 0,
AdminMessage_ConfigType_POSITION_CONFIG = 1,
AdminMessage_ConfigType_POWER_CONFIG = 2,
- AdminMessage_ConfigType_WIFI_CONFIG = 3,
+ AdminMessage_ConfigType_NETWORK_CONFIG = 3,
AdminMessage_ConfigType_DISPLAY_CONFIG = 4,
AdminMessage_ConfigType_LORA_CONFIG = 5,
AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6
@@ -40,16 +40,8 @@ typedef enum _AdminMessage_ModuleConfigType {
This message is used to do settings operations to both remote AND local nodes.
(Prior to 1.2 these operations were done via special ToRadio operations) */
typedef struct _AdminMessage {
- pb_size_t which_variant;
+ pb_size_t which_payload_variant;
union {
- /* Set the owner for this node */
- User set_owner;
- /* Set channels (using the new API).
- A special channel is the "primary channel".
- The other records are secondary channels.
- Note: only one channel can be marked as primary.
- If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. */
- Channel set_channel;
/* Send the specified channel in the response to this message
NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present) */
uint32_t get_channel_request;
@@ -63,20 +55,38 @@ typedef struct _AdminMessage {
AdminMessage_ConfigType get_config_request;
/* Send the current Config in the response to this message. */
Config get_config_response;
- /* Set the current Config */
- Config set_config;
- /* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
- bool confirm_set_config;
/* Ask for the following config data to be sent */
AdminMessage_ModuleConfigType get_module_config_request;
/* Send the current Config in the response to this message. */
ModuleConfig get_module_config_response;
- /* Set the current Config */
- ModuleConfig set_module_config;
- /* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
- bool confirm_set_module_config;
/* Send all channels in the response to this message */
bool get_all_channel_request;
+ /* Get the Canned Message Module messages in the response to this message. */
+ bool get_canned_message_module_messages_request;
+ /* Get the Canned Message Module messages in the response to this message. */
+ char get_canned_message_module_messages_response[201];
+ /* Request the node to send device metadata (firmware, protobuf version, etc) */
+ uint32_t get_device_metadata_request;
+ /* Device metadata response */
+ DeviceMetadata get_device_metadata_response;
+ /* Set the owner for this node */
+ User set_owner;
+ /* Set channels (using the new API).
+ A special channel is the "primary channel".
+ The other records are secondary channels.
+ Note: only one channel can be marked as primary.
+ If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. */
+ Channel set_channel;
+ /* Set the current Config */
+ Config set_config;
+ /* Set the current Config */
+ ModuleConfig set_module_config;
+ /* Set the Canned Message Module messages text. */
+ char set_canned_message_module_messages[201];
+ /* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
+ bool confirm_set_config;
+ /* Sent immediatly after a config change has been sent to ensure comms, if this is not recieved, the config will be reverted after 10 mins */
+ bool confirm_set_module_config;
/* Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
If you fail to do so, the radio will assume loss of comms and revert your changes.
@@ -89,18 +99,10 @@ typedef struct _AdminMessage {
bool exit_simulator;
/* Tell the node to reboot in this many seconds (or <0 to cancel reboot) */
int32_t reboot_seconds;
- /* Get the Canned Message Module messages in the response to this message. */
- bool get_canned_message_module_messages_request;
- /* Get the Canned Message Module messages in the response to this message. */
- char get_canned_message_module_messages_response[201];
- /* Set the Canned Message Module messages text. */
- char set_canned_message_module_messages[201];
/* Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) */
int32_t shutdown_seconds;
- /* Request the node to send device metadata (firmware, protobuf version, etc) */
- uint32_t get_device_metadata_request;
- /* Device metadata response */
- DeviceMetadata get_device_metadata_response;
+ /* Tell the node to factory reset, all device settings will be returned to factory defaults. */
+ int32_t factory_reset;
};
} AdminMessage;
@@ -120,74 +122,76 @@ extern "C" {
#endif
/* Initializer values for message structs */
-#define AdminMessage_init_default {0, {User_init_default}}
-#define AdminMessage_init_zero {0, {User_init_zero}}
+#define AdminMessage_init_default {0, {0}}
+#define AdminMessage_init_zero {0, {0}}
/* Field tags (for use in manual encoding/decoding) */
-#define AdminMessage_set_owner_tag 2
-#define AdminMessage_set_channel_tag 3
-#define AdminMessage_get_channel_request_tag 6
-#define AdminMessage_get_channel_response_tag 7
-#define AdminMessage_get_owner_request_tag 8
-#define AdminMessage_get_owner_response_tag 9
-#define AdminMessage_get_config_request_tag 10
-#define AdminMessage_get_config_response_tag 11
-#define AdminMessage_set_config_tag 12
-#define AdminMessage_confirm_set_config_tag 13
-#define AdminMessage_get_module_config_request_tag 14
-#define AdminMessage_get_module_config_response_tag 15
-#define AdminMessage_set_module_config_tag 16
-#define AdminMessage_confirm_set_module_config_tag 17
-#define AdminMessage_get_all_channel_request_tag 18
-#define AdminMessage_confirm_set_channel_tag 32
-#define AdminMessage_confirm_set_radio_tag 33
-#define AdminMessage_exit_simulator_tag 34
-#define AdminMessage_reboot_seconds_tag 35
-#define AdminMessage_get_canned_message_module_messages_request_tag 36
-#define AdminMessage_get_canned_message_module_messages_response_tag 37
-#define AdminMessage_set_canned_message_module_messages_tag 44
-#define AdminMessage_shutdown_seconds_tag 51
-#define AdminMessage_get_device_metadata_request_tag 52
-#define AdminMessage_get_device_metadata_response_tag 53
+#define AdminMessage_get_channel_request_tag 1
+#define AdminMessage_get_channel_response_tag 2
+#define AdminMessage_get_owner_request_tag 3
+#define AdminMessage_get_owner_response_tag 4
+#define AdminMessage_get_config_request_tag 5
+#define AdminMessage_get_config_response_tag 6
+#define AdminMessage_get_module_config_request_tag 7
+#define AdminMessage_get_module_config_response_tag 8
+#define AdminMessage_get_all_channel_request_tag 9
+#define AdminMessage_get_canned_message_module_messages_request_tag 10
+#define AdminMessage_get_canned_message_module_messages_response_tag 11
+#define AdminMessage_get_device_metadata_request_tag 12
+#define AdminMessage_get_device_metadata_response_tag 13
+#define AdminMessage_set_owner_tag 32
+#define AdminMessage_set_channel_tag 33
+#define AdminMessage_set_config_tag 34
+#define AdminMessage_set_module_config_tag 35
+#define AdminMessage_set_canned_message_module_messages_tag 36
+#define AdminMessage_confirm_set_config_tag 64
+#define AdminMessage_confirm_set_module_config_tag 65
+#define AdminMessage_confirm_set_channel_tag 66
+#define AdminMessage_confirm_set_radio_tag 67
+#define AdminMessage_exit_simulator_tag 96
+#define AdminMessage_reboot_seconds_tag 97
+#define AdminMessage_shutdown_seconds_tag 98
+#define AdminMessage_factory_reset_tag 99
/* Struct field encoding specification for nanopb */
#define AdminMessage_FIELDLIST(X, a) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,set_owner,set_owner), 2) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,set_channel,set_channel), 3) \
-X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_request), 6) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \
-X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \
-X(a, STATIC, ONEOF, UENUM, (variant,get_config_request,get_config_request), 10) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,get_config_response,get_config_response), 11) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,set_config,set_config), 12) \
-X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_config,confirm_set_config), 13) \
-X(a, STATIC, ONEOF, UENUM, (variant,get_module_config_request,get_module_config_request), 14) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,get_module_config_response,get_module_config_response), 15) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,set_module_config,set_module_config), 16) \
-X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_module_config,confirm_set_module_config), 17) \
-X(a, STATIC, ONEOF, BOOL, (variant,get_all_channel_request,get_all_channel_request), 18) \
-X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
-X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
-X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
-X(a, STATIC, ONEOF, INT32, (variant,reboot_seconds,reboot_seconds), 35) \
-X(a, STATIC, ONEOF, BOOL, (variant,get_canned_message_module_messages_request,get_canned_message_module_messages_request), 36) \
-X(a, STATIC, ONEOF, STRING, (variant,get_canned_message_module_messages_response,get_canned_message_module_messages_response), 37) \
-X(a, STATIC, ONEOF, STRING, (variant,set_canned_message_module_messages,set_canned_message_module_messages), 44) \
-X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds), 51) \
-X(a, STATIC, ONEOF, UINT32, (variant,get_device_metadata_request,get_device_metadata_request), 52) \
-X(a, STATIC, ONEOF, MESSAGE, (variant,get_device_metadata_response,get_device_metadata_response), 53)
+X(a, STATIC, ONEOF, UINT32, (payload_variant,get_channel_request,get_channel_request), 1) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_channel_response,get_channel_response), 2) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,get_owner_request,get_owner_request), 3) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_owner_response,get_owner_response), 4) \
+X(a, STATIC, ONEOF, UENUM, (payload_variant,get_config_request,get_config_request), 5) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_config_response,get_config_response), 6) \
+X(a, STATIC, ONEOF, UENUM, (payload_variant,get_module_config_request,get_module_config_request), 7) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_module_config_response,get_module_config_response), 8) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,get_all_channel_request,get_all_channel_request), 9) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,get_canned_message_module_messages_request,get_canned_message_module_messages_request), 10) \
+X(a, STATIC, ONEOF, STRING, (payload_variant,get_canned_message_module_messages_response,get_canned_message_module_messages_response), 11) \
+X(a, STATIC, ONEOF, UINT32, (payload_variant,get_device_metadata_request,get_device_metadata_request), 12) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_device_metadata_response,get_device_metadata_response), 13) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_owner,set_owner), 32) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_channel,set_channel), 33) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_config,set_config), 34) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_module_config,set_module_config), 35) \
+X(a, STATIC, ONEOF, STRING, (payload_variant,set_canned_message_module_messages,set_canned_message_module_messages), 36) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_config,confirm_set_config), 64) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_module_config,confirm_set_module_config), 65) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_channel,confirm_set_channel), 66) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,confirm_set_radio,confirm_set_radio), 67) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,exit_simulator,exit_simulator), 96) \
+X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_seconds,reboot_seconds), 97) \
+X(a, STATIC, ONEOF, INT32, (payload_variant,shutdown_seconds,shutdown_seconds), 98) \
+X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset,factory_reset), 99)
#define AdminMessage_CALLBACK NULL
#define AdminMessage_DEFAULT NULL
-#define AdminMessage_variant_set_owner_MSGTYPE User
-#define AdminMessage_variant_set_channel_MSGTYPE Channel
-#define AdminMessage_variant_get_channel_response_MSGTYPE Channel
-#define AdminMessage_variant_get_owner_response_MSGTYPE User
-#define AdminMessage_variant_get_config_response_MSGTYPE Config
-#define AdminMessage_variant_set_config_MSGTYPE Config
-#define AdminMessage_variant_get_module_config_response_MSGTYPE ModuleConfig
-#define AdminMessage_variant_set_module_config_MSGTYPE ModuleConfig
-#define AdminMessage_variant_get_device_metadata_response_MSGTYPE DeviceMetadata
+#define AdminMessage_payload_variant_get_channel_response_MSGTYPE Channel
+#define AdminMessage_payload_variant_get_owner_response_MSGTYPE User
+#define AdminMessage_payload_variant_get_config_response_MSGTYPE Config
+#define AdminMessage_payload_variant_get_module_config_response_MSGTYPE ModuleConfig
+#define AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE DeviceMetadata
+#define AdminMessage_payload_variant_set_owner_MSGTYPE User
+#define AdminMessage_payload_variant_set_channel_MSGTYPE Channel
+#define AdminMessage_payload_variant_set_config_MSGTYPE Config
+#define AdminMessage_payload_variant_set_module_config_MSGTYPE ModuleConfig
extern const pb_msgdesc_t AdminMessage_msg;
diff --git a/src/mesh/generated/apponly.pb.h b/src/mesh/generated/apponly.pb.h
index eed957e6e..8f9ada079 100644
--- a/src/mesh/generated/apponly.pb.h
+++ b/src/mesh/generated/apponly.pb.h
@@ -54,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 573
+#define ChannelSet_size 557
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/mesh/generated/channel.pb.h b/src/mesh/generated/channel.pb.h
index 466a63b27..7112ecace 100644
--- a/src/mesh/generated/channel.pb.h
+++ b/src/mesh/generated/channel.pb.h
@@ -38,6 +38,25 @@ typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
FIXME: explain how apps use channels for security.
explain how remote settings and remote gpio are managed as an example */
typedef struct _ChannelSettings {
+ /* NOTE: this field is _independent_ and unrelated to the concepts in channel.proto.
+ this is controlling the actual hardware frequency the radio is transmitting on.
+ In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming.
+ Most users should never need to be exposed to this field/concept.
+ A channel number between 1 and 13 (or whatever the max is in the current
+ region). If ZERO then the rule is "use the old channel name hash based
+ algorithm to derive the channel number")
+ If using the hash algorithm the channel number will be: hash(channel_name) %
+ NUM_CHANNELS (Where num channels depends on the regulatory region).
+ NUM_CHANNELS_US is 13, for other values see MeshRadio.h in the device code.
+ hash a string into an integer - djb2 by Dan Bernstein. -
+ http://www.cse.yorku.ca/~oz/hash.html
+ unsigned long hash(char *str) {
+ unsigned long hash = 5381; int c;
+ while ((c = *str++) != 0)
+ hash = ((hash << 5) + hash) + (unsigned char) c;
+ return hash;
+ } */
+ uint8_t channel_num;
/* A simple pre-shared key for now for crypto.
Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
A special shorthand is used for 1 byte long psks.
@@ -58,25 +77,6 @@ typedef struct _ChannelSettings {
For channel_num hashing empty string will be treated as "X".
Where "X" is selected based on the English words listed above for ModemPreset */
char name[12];
- /* NOTE: this field is _independent_ and unrelated to the concepts in channel.proto.
- this is controlling the actual hardware frequency the radio is transmitting on.
- In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming.
- Most users should never need to be exposed to this field/concept.
- A channel number between 1 and 13 (or whatever the max is in the current
- region). If ZERO then the rule is "use the old channel name hash based
- algorithm to derive the channel number")
- If using the hash algorithm the channel number will be: hash(channel_name) %
- NUM_CHANNELS (Where num channels depends on the regulatory region).
- NUM_CHANNELS_US is 13, for other values see MeshRadio.h in the device code.
- hash a string into an integer - djb2 by Dan Bernstein. -
- http://www.cse.yorku.ca/~oz/hash.html
- unsigned long hash(char *str) {
- unsigned long hash = 5381; int c;
- while ((c = *str++) != 0)
- hash = ((hash << 5) + hash) + (unsigned char) c;
- return hash;
- } */
- uint8_t channel_num;
/* Used to construct a globally unique channel ID.
The full globally unique ID will be: "name.id" where ID is shown as base36.
Assuming that the number of meshtastic users is below 20K (true for a long time)
@@ -120,30 +120,30 @@ extern "C" {
#endif
/* Initializer values for message structs */
-#define ChannelSettings_init_default {{0, {0}}, "", 0, 0, 0, 0}
+#define ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0}
#define Channel_init_default {0, false, ChannelSettings_init_default, _Channel_Role_MIN}
-#define ChannelSettings_init_zero {{0, {0}}, "", 0, 0, 0, 0}
+#define ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0}
#define Channel_init_zero {0, false, ChannelSettings_init_zero, _Channel_Role_MIN}
/* Field tags (for use in manual encoding/decoding) */
-#define ChannelSettings_psk_tag 4
-#define ChannelSettings_name_tag 5
-#define ChannelSettings_channel_num_tag 9
-#define ChannelSettings_id_tag 10
-#define ChannelSettings_uplink_enabled_tag 16
-#define ChannelSettings_downlink_enabled_tag 17
+#define ChannelSettings_channel_num_tag 1
+#define ChannelSettings_psk_tag 2
+#define ChannelSettings_name_tag 3
+#define ChannelSettings_id_tag 4
+#define ChannelSettings_uplink_enabled_tag 5
+#define ChannelSettings_downlink_enabled_tag 6
#define Channel_index_tag 1
#define Channel_settings_tag 2
#define Channel_role_tag 3
/* Struct field encoding specification for nanopb */
#define ChannelSettings_FIELDLIST(X, a) \
-X(a, STATIC, SINGULAR, BYTES, psk, 4) \
-X(a, STATIC, SINGULAR, STRING, name, 5) \
-X(a, STATIC, SINGULAR, UINT32, channel_num, 9) \
-X(a, STATIC, SINGULAR, FIXED32, id, 10) \
-X(a, STATIC, SINGULAR, BOOL, uplink_enabled, 16) \
-X(a, STATIC, SINGULAR, BOOL, downlink_enabled, 17)
+X(a, STATIC, SINGULAR, UINT32, channel_num, 1) \
+X(a, STATIC, SINGULAR, BYTES, psk, 2) \
+X(a, STATIC, SINGULAR, STRING, name, 3) \
+X(a, STATIC, SINGULAR, FIXED32, id, 4) \
+X(a, STATIC, SINGULAR, BOOL, uplink_enabled, 5) \
+X(a, STATIC, SINGULAR, BOOL, downlink_enabled, 6)
#define ChannelSettings_CALLBACK NULL
#define ChannelSettings_DEFAULT NULL
@@ -163,8 +163,8 @@ extern const pb_msgdesc_t Channel_msg;
#define Channel_fields &Channel_msg
/* Maximum encoded size of messages (where known) */
-#define ChannelSettings_size 61
-#define Channel_size 76
+#define ChannelSettings_size 59
+#define Channel_size 74
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/mesh/generated/config.pb.c b/src/mesh/generated/config.pb.c
index e9b9df84f..3cf1be47a 100644
--- a/src/mesh/generated/config.pb.c
+++ b/src/mesh/generated/config.pb.c
@@ -18,7 +18,7 @@ PB_BIND(Config_PositionConfig, Config_PositionConfig, AUTO)
PB_BIND(Config_PowerConfig, Config_PowerConfig, AUTO)
-PB_BIND(Config_WiFiConfig, Config_WiFiConfig, AUTO)
+PB_BIND(Config_NetworkConfig, Config_NetworkConfig, AUTO)
PB_BIND(Config_DisplayConfig, Config_DisplayConfig, AUTO)
@@ -38,4 +38,3 @@ PB_BIND(Config_BluetoothConfig, Config_BluetoothConfig, AUTO)
-
diff --git a/src/mesh/generated/config.pb.h b/src/mesh/generated/config.pb.h
index 7896f42b3..674d7e386 100644
--- a/src/mesh/generated/config.pb.h
+++ b/src/mesh/generated/config.pb.h
@@ -11,66 +11,46 @@
/* Enum definitions */
typedef enum _Config_DeviceConfig_Role {
- Config_DeviceConfig_Role_Client = 0,
- Config_DeviceConfig_Role_ClientMute = 1,
- Config_DeviceConfig_Role_Router = 2,
- Config_DeviceConfig_Role_RouterClient = 3
+ Config_DeviceConfig_Role_CLIENT = 0,
+ Config_DeviceConfig_Role_CLIENT_MUTE = 1,
+ Config_DeviceConfig_Role_ROUTER = 2,
+ Config_DeviceConfig_Role_ROUTER_CLIENT = 3
} Config_DeviceConfig_Role;
typedef enum _Config_PositionConfig_PositionFlags {
- Config_PositionConfig_PositionFlags_POS_UNDEFINED = 0,
- Config_PositionConfig_PositionFlags_POS_ALTITUDE = 1,
- Config_PositionConfig_PositionFlags_POS_ALT_MSL = 2,
- Config_PositionConfig_PositionFlags_POS_GEO_SEP = 4,
- Config_PositionConfig_PositionFlags_POS_DOP = 8,
- Config_PositionConfig_PositionFlags_POS_HVDOP = 16,
- Config_PositionConfig_PositionFlags_POS_SATINVIEW = 32,
- Config_PositionConfig_PositionFlags_POS_SEQ_NOS = 64,
- Config_PositionConfig_PositionFlags_POS_TIMESTAMP = 128,
- Config_PositionConfig_PositionFlags_POS_HEADING = 256,
- Config_PositionConfig_PositionFlags_POS_SPEED = 512
+ Config_PositionConfig_PositionFlags_UNSET = 0,
+ Config_PositionConfig_PositionFlags_ALTITUDE = 1,
+ Config_PositionConfig_PositionFlags_ALTITUDE_MSL = 2,
+ Config_PositionConfig_PositionFlags_GEOIDAL_SEPERATION = 4,
+ Config_PositionConfig_PositionFlags_DOP = 8,
+ Config_PositionConfig_PositionFlags_HVDOP = 16,
+ Config_PositionConfig_PositionFlags_SATINVIEW = 32,
+ Config_PositionConfig_PositionFlags_SEQ_NO = 64,
+ Config_PositionConfig_PositionFlags_TIMESTAMP = 128,
+ Config_PositionConfig_PositionFlags_HEADING = 256,
+ Config_PositionConfig_PositionFlags_SPEED = 512
} Config_PositionConfig_PositionFlags;
-typedef enum _Config_PowerConfig_ChargeCurrent {
- Config_PowerConfig_ChargeCurrent_MAUnset = 0,
- Config_PowerConfig_ChargeCurrent_MA100 = 1,
- Config_PowerConfig_ChargeCurrent_MA190 = 2,
- Config_PowerConfig_ChargeCurrent_MA280 = 3,
- Config_PowerConfig_ChargeCurrent_MA360 = 4,
- Config_PowerConfig_ChargeCurrent_MA450 = 5,
- Config_PowerConfig_ChargeCurrent_MA550 = 6,
- Config_PowerConfig_ChargeCurrent_MA630 = 7,
- Config_PowerConfig_ChargeCurrent_MA700 = 8,
- Config_PowerConfig_ChargeCurrent_MA780 = 9,
- Config_PowerConfig_ChargeCurrent_MA880 = 10,
- Config_PowerConfig_ChargeCurrent_MA960 = 11,
- Config_PowerConfig_ChargeCurrent_MA1000 = 12,
- Config_PowerConfig_ChargeCurrent_MA1080 = 13,
- Config_PowerConfig_ChargeCurrent_MA1160 = 14,
- Config_PowerConfig_ChargeCurrent_MA1240 = 15,
- Config_PowerConfig_ChargeCurrent_MA1320 = 16
-} Config_PowerConfig_ChargeCurrent;
-
-typedef enum _Config_WiFiConfig_WiFiMode {
- Config_WiFiConfig_WiFiMode_Client = 0,
- Config_WiFiConfig_WiFiMode_AccessPoint = 1,
- Config_WiFiConfig_WiFiMode_AccessPointHidden = 2
-} Config_WiFiConfig_WiFiMode;
+typedef enum _Config_NetworkConfig_WiFiMode {
+ Config_NetworkConfig_WiFiMode_CLIENT = 0,
+ Config_NetworkConfig_WiFiMode_ACCESS_POINT = 1,
+ Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN = 2
+} Config_NetworkConfig_WiFiMode;
typedef enum _Config_DisplayConfig_GpsCoordinateFormat {
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec = 0,
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDMS = 1,
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatUTM = 2,
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatMGRS = 3,
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOLC = 4,
- Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR = 5
+ Config_DisplayConfig_GpsCoordinateFormat_DEC = 0,
+ Config_DisplayConfig_GpsCoordinateFormat_DMS = 1,
+ Config_DisplayConfig_GpsCoordinateFormat_UTM = 2,
+ Config_DisplayConfig_GpsCoordinateFormat_MGRS = 3,
+ Config_DisplayConfig_GpsCoordinateFormat_OLC = 4,
+ Config_DisplayConfig_GpsCoordinateFormat_OSGR = 5
} Config_DisplayConfig_GpsCoordinateFormat;
typedef enum _Config_LoRaConfig_RegionCode {
- Config_LoRaConfig_RegionCode_Unset = 0,
+ Config_LoRaConfig_RegionCode_UNSET = 0,
Config_LoRaConfig_RegionCode_US = 1,
- Config_LoRaConfig_RegionCode_EU433 = 2,
- Config_LoRaConfig_RegionCode_EU868 = 3,
+ Config_LoRaConfig_RegionCode_EU_433 = 2,
+ Config_LoRaConfig_RegionCode_EU_868 = 3,
Config_LoRaConfig_RegionCode_CN = 4,
Config_LoRaConfig_RegionCode_JP = 5,
Config_LoRaConfig_RegionCode_ANZ = 6,
@@ -78,24 +58,24 @@ typedef enum _Config_LoRaConfig_RegionCode {
Config_LoRaConfig_RegionCode_TW = 8,
Config_LoRaConfig_RegionCode_RU = 9,
Config_LoRaConfig_RegionCode_IN = 10,
- Config_LoRaConfig_RegionCode_NZ865 = 11,
+ Config_LoRaConfig_RegionCode_NZ_865 = 11,
Config_LoRaConfig_RegionCode_TH = 12
} Config_LoRaConfig_RegionCode;
typedef enum _Config_LoRaConfig_ModemPreset {
- Config_LoRaConfig_ModemPreset_LongFast = 0,
- Config_LoRaConfig_ModemPreset_LongSlow = 1,
- Config_LoRaConfig_ModemPreset_VLongSlow = 2,
- Config_LoRaConfig_ModemPreset_MedSlow = 3,
- Config_LoRaConfig_ModemPreset_MedFast = 4,
- Config_LoRaConfig_ModemPreset_ShortSlow = 5,
- Config_LoRaConfig_ModemPreset_ShortFast = 6
+ Config_LoRaConfig_ModemPreset_LONG_FAST = 0,
+ Config_LoRaConfig_ModemPreset_LONG_SLOW = 1,
+ Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW = 2,
+ Config_LoRaConfig_ModemPreset_MEDIUM_SLOW = 3,
+ Config_LoRaConfig_ModemPreset_MEDIUM_FAST = 4,
+ Config_LoRaConfig_ModemPreset_SHORT_SLOW = 5,
+ Config_LoRaConfig_ModemPreset_SHORT_FAST = 6
} Config_LoRaConfig_ModemPreset;
typedef enum _Config_BluetoothConfig_PairingMode {
- Config_BluetoothConfig_PairingMode_RandomPin = 0,
- Config_BluetoothConfig_PairingMode_FixedPin = 1,
- Config_BluetoothConfig_PairingMode_NoPin = 2
+ Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0,
+ Config_BluetoothConfig_PairingMode_FIXED_PIN = 1,
+ Config_BluetoothConfig_PairingMode_NO_PIN = 2
} Config_BluetoothConfig_PairingMode;
/* Struct definitions */
@@ -108,9 +88,7 @@ typedef struct _Config_BluetoothConfig {
typedef struct _Config_DeviceConfig {
Config_DeviceConfig_Role role;
bool serial_disabled;
- bool factory_reset;
bool debug_log_enabled;
- char ntp_server[33];
} Config_DeviceConfig;
typedef struct _Config_DisplayConfig {
@@ -134,6 +112,14 @@ typedef struct _Config_LoRaConfig {
uint32_t ignore_incoming[3];
} Config_LoRaConfig;
+typedef struct _Config_NetworkConfig {
+ bool wifi_enabled;
+ Config_NetworkConfig_WiFiMode wifi_mode;
+ char wifi_ssid[33];
+ char wifi_psk[64];
+ char ntp_server[33];
+} Config_NetworkConfig;
+
typedef struct _Config_PositionConfig {
uint32_t position_broadcast_secs;
bool position_broadcast_smart_disabled;
@@ -145,7 +131,6 @@ typedef struct _Config_PositionConfig {
} Config_PositionConfig;
typedef struct _Config_PowerConfig {
- Config_PowerConfig_ChargeCurrent charge_current;
bool is_power_saving;
uint32_t on_battery_shutdown_after_secs;
float adc_multiplier_override;
@@ -156,59 +141,48 @@ typedef struct _Config_PowerConfig {
uint32_t min_wake_secs;
} Config_PowerConfig;
-typedef struct _Config_WiFiConfig {
- bool enabled;
- Config_WiFiConfig_WiFiMode mode;
- char ssid[33];
- char psk[64];
-} Config_WiFiConfig;
-
typedef struct _Config {
- pb_size_t which_payloadVariant;
+ pb_size_t which_payload_variant;
union {
Config_DeviceConfig device;
Config_PositionConfig position;
Config_PowerConfig power;
- Config_WiFiConfig wifi;
+ Config_NetworkConfig network;
Config_DisplayConfig display;
Config_LoRaConfig lora;
Config_BluetoothConfig bluetooth;
- } payloadVariant;
+ } payload_variant;
} Config;
/* Helper constants for enums */
-#define _Config_DeviceConfig_Role_MIN Config_DeviceConfig_Role_Client
-#define _Config_DeviceConfig_Role_MAX Config_DeviceConfig_Role_RouterClient
-#define _Config_DeviceConfig_Role_ARRAYSIZE ((Config_DeviceConfig_Role)(Config_DeviceConfig_Role_RouterClient+1))
+#define _Config_DeviceConfig_Role_MIN Config_DeviceConfig_Role_CLIENT
+#define _Config_DeviceConfig_Role_MAX Config_DeviceConfig_Role_ROUTER_CLIENT
+#define _Config_DeviceConfig_Role_ARRAYSIZE ((Config_DeviceConfig_Role)(Config_DeviceConfig_Role_ROUTER_CLIENT+1))
-#define _Config_PositionConfig_PositionFlags_MIN Config_PositionConfig_PositionFlags_POS_UNDEFINED
-#define _Config_PositionConfig_PositionFlags_MAX Config_PositionConfig_PositionFlags_POS_SPEED
-#define _Config_PositionConfig_PositionFlags_ARRAYSIZE ((Config_PositionConfig_PositionFlags)(Config_PositionConfig_PositionFlags_POS_SPEED+1))
+#define _Config_PositionConfig_PositionFlags_MIN Config_PositionConfig_PositionFlags_UNSET
+#define _Config_PositionConfig_PositionFlags_MAX Config_PositionConfig_PositionFlags_SPEED
+#define _Config_PositionConfig_PositionFlags_ARRAYSIZE ((Config_PositionConfig_PositionFlags)(Config_PositionConfig_PositionFlags_SPEED+1))
-#define _Config_PowerConfig_ChargeCurrent_MIN Config_PowerConfig_ChargeCurrent_MAUnset
-#define _Config_PowerConfig_ChargeCurrent_MAX Config_PowerConfig_ChargeCurrent_MA1320
-#define _Config_PowerConfig_ChargeCurrent_ARRAYSIZE ((Config_PowerConfig_ChargeCurrent)(Config_PowerConfig_ChargeCurrent_MA1320+1))
+#define _Config_NetworkConfig_WiFiMode_MIN Config_NetworkConfig_WiFiMode_CLIENT
+#define _Config_NetworkConfig_WiFiMode_MAX Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN
+#define _Config_NetworkConfig_WiFiMode_ARRAYSIZE ((Config_NetworkConfig_WiFiMode)(Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN+1))
-#define _Config_WiFiConfig_WiFiMode_MIN Config_WiFiConfig_WiFiMode_Client
-#define _Config_WiFiConfig_WiFiMode_MAX Config_WiFiConfig_WiFiMode_AccessPointHidden
-#define _Config_WiFiConfig_WiFiMode_ARRAYSIZE ((Config_WiFiConfig_WiFiMode)(Config_WiFiConfig_WiFiMode_AccessPointHidden+1))
+#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_DEC
+#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_OSGR
+#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_OSGR+1))
-#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_GpsFormatDec
-#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR
-#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_GpsFormatOSGR+1))
-
-#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_Unset
+#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET
#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_LongFast
-#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_ShortFast
-#define _Config_LoRaConfig_ModemPreset_ARRAYSIZE ((Config_LoRaConfig_ModemPreset)(Config_LoRaConfig_ModemPreset_ShortFast+1))
+#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST
+#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST
+#define _Config_LoRaConfig_ModemPreset_ARRAYSIZE ((Config_LoRaConfig_ModemPreset)(Config_LoRaConfig_ModemPreset_SHORT_FAST+1))
-#define _Config_BluetoothConfig_PairingMode_MIN Config_BluetoothConfig_PairingMode_RandomPin
-#define _Config_BluetoothConfig_PairingMode_MAX Config_BluetoothConfig_PairingMode_NoPin
-#define _Config_BluetoothConfig_PairingMode_ARRAYSIZE ((Config_BluetoothConfig_PairingMode)(Config_BluetoothConfig_PairingMode_NoPin+1))
+#define _Config_BluetoothConfig_PairingMode_MIN Config_BluetoothConfig_PairingMode_RANDOM_PIN
+#define _Config_BluetoothConfig_PairingMode_MAX Config_BluetoothConfig_PairingMode_NO_PIN
+#define _Config_BluetoothConfig_PairingMode_ARRAYSIZE ((Config_BluetoothConfig_PairingMode)(Config_BluetoothConfig_PairingMode_NO_PIN+1))
#ifdef __cplusplus
@@ -217,18 +191,18 @@ extern "C" {
/* Initializer values for message structs */
#define Config_init_default {0, {Config_DeviceConfig_init_default}}
-#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
+#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0}
#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0}
-#define Config_PowerConfig_init_default {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
-#define Config_WiFiConfig_init_default {0, _Config_WiFiConfig_WiFiMode_MIN, "", ""}
+#define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0}
+#define Config_NetworkConfig_init_default {0, _Config_NetworkConfig_WiFiMode_MIN, "", "", ""}
#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0}
#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
#define Config_BluetoothConfig_init_default {0, _Config_BluetoothConfig_PairingMode_MIN, 0}
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
-#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, ""}
+#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0}
#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0}
-#define Config_PowerConfig_init_zero {_Config_PowerConfig_ChargeCurrent_MIN, 0, 0, 0, 0, 0, 0, 0, 0}
-#define Config_WiFiConfig_init_zero {0, _Config_WiFiConfig_WiFiMode_MIN, "", ""}
+#define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0}
+#define Config_NetworkConfig_init_zero {0, _Config_NetworkConfig_WiFiMode_MIN, "", "", ""}
#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0}
#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, {0, 0, 0}}
#define Config_BluetoothConfig_init_zero {0, _Config_BluetoothConfig_PairingMode_MIN, 0}
@@ -239,9 +213,7 @@ extern "C" {
#define Config_BluetoothConfig_fixed_pin_tag 3
#define Config_DeviceConfig_role_tag 1
#define Config_DeviceConfig_serial_disabled_tag 2
-#define Config_DeviceConfig_factory_reset_tag 3
-#define Config_DeviceConfig_debug_log_enabled_tag 4
-#define Config_DeviceConfig_ntp_server_tag 5
+#define Config_DeviceConfig_debug_log_enabled_tag 3
#define Config_DisplayConfig_screen_on_secs_tag 1
#define Config_DisplayConfig_gps_format_tag 2
#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3
@@ -256,59 +228,57 @@ extern "C" {
#define Config_LoRaConfig_hop_limit_tag 8
#define Config_LoRaConfig_tx_disabled_tag 9
#define Config_LoRaConfig_ignore_incoming_tag 103
+#define Config_NetworkConfig_wifi_enabled_tag 1
+#define Config_NetworkConfig_wifi_mode_tag 2
+#define Config_NetworkConfig_wifi_ssid_tag 3
+#define Config_NetworkConfig_wifi_psk_tag 4
+#define Config_NetworkConfig_ntp_server_tag 5
#define Config_PositionConfig_position_broadcast_secs_tag 1
#define Config_PositionConfig_position_broadcast_smart_disabled_tag 2
#define Config_PositionConfig_fixed_position_tag 3
-#define Config_PositionConfig_gps_disabled_tag 5
-#define Config_PositionConfig_gps_update_interval_tag 6
-#define Config_PositionConfig_gps_attempt_time_tag 7
-#define Config_PositionConfig_position_flags_tag 10
-#define Config_PowerConfig_charge_current_tag 1
-#define Config_PowerConfig_is_power_saving_tag 2
-#define Config_PowerConfig_on_battery_shutdown_after_secs_tag 4
-#define Config_PowerConfig_adc_multiplier_override_tag 6
-#define Config_PowerConfig_wait_bluetooth_secs_tag 7
-#define Config_PowerConfig_mesh_sds_timeout_secs_tag 9
-#define Config_PowerConfig_sds_secs_tag 10
-#define Config_PowerConfig_ls_secs_tag 11
-#define Config_PowerConfig_min_wake_secs_tag 12
-#define Config_WiFiConfig_enabled_tag 1
-#define Config_WiFiConfig_mode_tag 2
-#define Config_WiFiConfig_ssid_tag 3
-#define Config_WiFiConfig_psk_tag 4
+#define Config_PositionConfig_gps_disabled_tag 4
+#define Config_PositionConfig_gps_update_interval_tag 5
+#define Config_PositionConfig_gps_attempt_time_tag 6
+#define Config_PositionConfig_position_flags_tag 7
+#define Config_PowerConfig_is_power_saving_tag 1
+#define Config_PowerConfig_on_battery_shutdown_after_secs_tag 2
+#define Config_PowerConfig_adc_multiplier_override_tag 3
+#define Config_PowerConfig_wait_bluetooth_secs_tag 4
+#define Config_PowerConfig_mesh_sds_timeout_secs_tag 5
+#define Config_PowerConfig_sds_secs_tag 6
+#define Config_PowerConfig_ls_secs_tag 7
+#define Config_PowerConfig_min_wake_secs_tag 8
#define Config_device_tag 1
#define Config_position_tag 2
#define Config_power_tag 3
-#define Config_wifi_tag 4
+#define Config_network_tag 4
#define Config_display_tag 5
#define Config_lora_tag 6
#define Config_bluetooth_tag 7
/* Struct field encoding specification for nanopb */
#define Config_FIELDLIST(X, a) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,device,payloadVariant.device), 1) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,position,payloadVariant.position), 2) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,power,payloadVariant.power), 3) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,wifi,payloadVariant.wifi), 4) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,display,payloadVariant.display), 5) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,lora,payloadVariant.lora), 6) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,bluetooth,payloadVariant.bluetooth), 7)
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,device,payload_variant.device), 1) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,position,payload_variant.position), 2) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,power,payload_variant.power), 3) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,network,payload_variant.network), 4) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,display,payload_variant.display), 5) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,lora,payload_variant.lora), 6) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,bluetooth,payload_variant.bluetooth), 7)
#define Config_CALLBACK NULL
#define Config_DEFAULT NULL
-#define Config_payloadVariant_device_MSGTYPE Config_DeviceConfig
-#define Config_payloadVariant_position_MSGTYPE Config_PositionConfig
-#define Config_payloadVariant_power_MSGTYPE Config_PowerConfig
-#define Config_payloadVariant_wifi_MSGTYPE Config_WiFiConfig
-#define Config_payloadVariant_display_MSGTYPE Config_DisplayConfig
-#define Config_payloadVariant_lora_MSGTYPE Config_LoRaConfig
-#define Config_payloadVariant_bluetooth_MSGTYPE Config_BluetoothConfig
+#define Config_payload_variant_device_MSGTYPE Config_DeviceConfig
+#define Config_payload_variant_position_MSGTYPE Config_PositionConfig
+#define Config_payload_variant_power_MSGTYPE Config_PowerConfig
+#define Config_payload_variant_network_MSGTYPE Config_NetworkConfig
+#define Config_payload_variant_display_MSGTYPE Config_DisplayConfig
+#define Config_payload_variant_lora_MSGTYPE Config_LoRaConfig
+#define Config_payload_variant_bluetooth_MSGTYPE Config_BluetoothConfig
#define Config_DeviceConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, role, 1) \
X(a, STATIC, SINGULAR, BOOL, serial_disabled, 2) \
-X(a, STATIC, SINGULAR, BOOL, factory_reset, 3) \
-X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 4) \
-X(a, STATIC, SINGULAR, STRING, ntp_server, 5)
+X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3)
#define Config_DeviceConfig_CALLBACK NULL
#define Config_DeviceConfig_DEFAULT NULL
@@ -316,33 +286,33 @@ X(a, STATIC, SINGULAR, STRING, ntp_server, 5)
X(a, STATIC, SINGULAR, UINT32, position_broadcast_secs, 1) \
X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart_disabled, 2) \
X(a, STATIC, SINGULAR, BOOL, fixed_position, 3) \
-X(a, STATIC, SINGULAR, BOOL, gps_disabled, 5) \
-X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 6) \
-X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 7) \
-X(a, STATIC, SINGULAR, UINT32, position_flags, 10)
+X(a, STATIC, SINGULAR, BOOL, gps_disabled, 4) \
+X(a, STATIC, SINGULAR, UINT32, gps_update_interval, 5) \
+X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 6) \
+X(a, STATIC, SINGULAR, UINT32, position_flags, 7)
#define Config_PositionConfig_CALLBACK NULL
#define Config_PositionConfig_DEFAULT NULL
#define Config_PowerConfig_FIELDLIST(X, a) \
-X(a, STATIC, SINGULAR, UENUM, charge_current, 1) \
-X(a, STATIC, SINGULAR, BOOL, is_power_saving, 2) \
-X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 4) \
-X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 6) \
-X(a, STATIC, SINGULAR, UINT32, wait_bluetooth_secs, 7) \
-X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 9) \
-X(a, STATIC, SINGULAR, UINT32, sds_secs, 10) \
-X(a, STATIC, SINGULAR, UINT32, ls_secs, 11) \
-X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 12)
+X(a, STATIC, SINGULAR, BOOL, is_power_saving, 1) \
+X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 2) \
+X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 3) \
+X(a, STATIC, SINGULAR, UINT32, wait_bluetooth_secs, 4) \
+X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 5) \
+X(a, STATIC, SINGULAR, UINT32, sds_secs, 6) \
+X(a, STATIC, SINGULAR, UINT32, ls_secs, 7) \
+X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 8)
#define Config_PowerConfig_CALLBACK NULL
#define Config_PowerConfig_DEFAULT NULL
-#define Config_WiFiConfig_FIELDLIST(X, a) \
-X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
-X(a, STATIC, SINGULAR, UENUM, mode, 2) \
-X(a, STATIC, SINGULAR, STRING, ssid, 3) \
-X(a, STATIC, SINGULAR, STRING, psk, 4)
-#define Config_WiFiConfig_CALLBACK NULL
-#define Config_WiFiConfig_DEFAULT NULL
+#define Config_NetworkConfig_FIELDLIST(X, a) \
+X(a, STATIC, SINGULAR, BOOL, wifi_enabled, 1) \
+X(a, STATIC, SINGULAR, UENUM, wifi_mode, 2) \
+X(a, STATIC, SINGULAR, STRING, wifi_ssid, 3) \
+X(a, STATIC, SINGULAR, STRING, wifi_psk, 4) \
+X(a, STATIC, SINGULAR, STRING, ntp_server, 5)
+#define Config_NetworkConfig_CALLBACK NULL
+#define Config_NetworkConfig_DEFAULT NULL
#define Config_DisplayConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, screen_on_secs, 1) \
@@ -377,7 +347,7 @@ extern const pb_msgdesc_t Config_msg;
extern const pb_msgdesc_t Config_DeviceConfig_msg;
extern const pb_msgdesc_t Config_PositionConfig_msg;
extern const pb_msgdesc_t Config_PowerConfig_msg;
-extern const pb_msgdesc_t Config_WiFiConfig_msg;
+extern const pb_msgdesc_t Config_NetworkConfig_msg;
extern const pb_msgdesc_t Config_DisplayConfig_msg;
extern const pb_msgdesc_t Config_LoRaConfig_msg;
extern const pb_msgdesc_t Config_BluetoothConfig_msg;
@@ -387,20 +357,20 @@ extern const pb_msgdesc_t Config_BluetoothConfig_msg;
#define Config_DeviceConfig_fields &Config_DeviceConfig_msg
#define Config_PositionConfig_fields &Config_PositionConfig_msg
#define Config_PowerConfig_fields &Config_PowerConfig_msg
-#define Config_WiFiConfig_fields &Config_WiFiConfig_msg
+#define Config_NetworkConfig_fields &Config_NetworkConfig_msg
#define Config_DisplayConfig_fields &Config_DisplayConfig_msg
#define Config_LoRaConfig_fields &Config_LoRaConfig_msg
#define Config_BluetoothConfig_fields &Config_BluetoothConfig_msg
/* Maximum encoded size of messages (where known) */
#define Config_BluetoothConfig_size 10
-#define Config_DeviceConfig_size 42
+#define Config_DeviceConfig_size 6
#define Config_DisplayConfig_size 16
#define Config_LoRaConfig_size 67
+#define Config_NetworkConfig_size 137
#define Config_PositionConfig_size 30
-#define Config_PowerConfig_size 45
-#define Config_WiFiConfig_size 103
-#define Config_size 105
+#define Config_PowerConfig_size 43
+#define Config_size 140
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h
index a940de2f6..3b1e17b6e 100644
--- a/src/mesh/generated/deviceonly.pb.h
+++ b/src/mesh/generated/deviceonly.pb.h
@@ -164,8 +164,8 @@ extern const pb_msgdesc_t OEMStore_msg;
#define OEMStore_fields &OEMStore_msg
/* Maximum encoded size of messages (where known) */
-#define ChannelFile_size 630
-#define DeviceState_size 22218
+#define ChannelFile_size 614
+#define DeviceState_size 21800
#define OEMStore_size 2106
#ifdef __cplusplus
diff --git a/src/mesh/generated/localonly.pb.h b/src/mesh/generated/localonly.pb.h
index 28c282ff0..8cfd5944f 100644
--- a/src/mesh/generated/localonly.pb.h
+++ b/src/mesh/generated/localonly.pb.h
@@ -23,8 +23,8 @@ typedef struct _LocalConfig {
bool has_power;
Config_PowerConfig power;
/* The part of the config that is specific to the Wifi Settings */
- bool has_wifi;
- Config_WiFiConfig wifi;
+ bool has_network;
+ Config_NetworkConfig network;
/* The part of the config that is specific to the Display */
bool has_display;
Config_DisplayConfig display;
@@ -74,16 +74,16 @@ 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, false, Config_BluetoothConfig_init_default, 0}
+#define LocalConfig_init_default {false, Config_DeviceConfig_init_default, false, Config_PositionConfig_init_default, false, Config_PowerConfig_init_default, false, Config_NetworkConfig_init_default, false, Config_DisplayConfig_init_default, false, Config_LoRaConfig_init_default, false, Config_BluetoothConfig_init_default, 0}
#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, 0}
-#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, false, Config_BluetoothConfig_init_zero, 0}
+#define LocalConfig_init_zero {false, Config_DeviceConfig_init_zero, false, Config_PositionConfig_init_zero, false, Config_PowerConfig_init_zero, false, Config_NetworkConfig_init_zero, false, Config_DisplayConfig_init_zero, false, Config_LoRaConfig_init_zero, false, Config_BluetoothConfig_init_zero, 0}
#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, 0}
/* 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_network_tag 4
#define LocalConfig_display_tag 5
#define LocalConfig_lora_tag 6
#define LocalConfig_bluetooth_tag 7
@@ -102,7 +102,7 @@ extern "C" {
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, network, 4) \
X(a, STATIC, OPTIONAL, MESSAGE, display, 5) \
X(a, STATIC, OPTIONAL, MESSAGE, lora, 6) \
X(a, STATIC, OPTIONAL, MESSAGE, bluetooth, 7) \
@@ -112,7 +112,7 @@ X(a, STATIC, SINGULAR, UINT32, version, 8)
#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_network_MSGTYPE Config_NetworkConfig
#define LocalConfig_display_MSGTYPE Config_DisplayConfig
#define LocalConfig_lora_MSGTYPE Config_LoRaConfig
#define LocalConfig_bluetooth_MSGTYPE Config_BluetoothConfig
@@ -144,7 +144,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg;
#define LocalModuleConfig_fields &LocalModuleConfig_msg
/* Maximum encoded size of messages (where known) */
-#define LocalConfig_size 333
+#define LocalConfig_size 330
#define LocalModuleConfig_size 270
#ifdef __cplusplus
diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h
index c00504c48..c0579f010 100644
--- a/src/mesh/generated/mesh.pb.h
+++ b/src/mesh/generated/mesh.pb.h
@@ -26,18 +26,18 @@ typedef enum _HardwareModel {
/* TODO: REPLACE */
HardwareModel_TLORA_V1 = 2,
/* TODO: REPLACE */
- HardwareModel_TLORA_V2_1_1p6 = 3,
+ HardwareModel_TLORA_V2_1_1P6 = 3,
/* TODO: REPLACE */
HardwareModel_TBEAM = 4,
/* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13
(see HELTEC_V2 for the new version). */
HardwareModel_HELTEC_V2_0 = 5,
/* TODO: REPLACE */
- HardwareModel_TBEAM0p7 = 6,
+ HardwareModel_TBEAM_V0P7 = 6,
/* TODO: REPLACE */
HardwareModel_T_ECHO = 7,
/* TODO: REPLACE */
- HardwareModel_TLORA_V1_1p3 = 8,
+ HardwareModel_TLORA_V1_1P3 = 8,
/* TODO: REPLACE */
HardwareModel_RAK4631 = 9,
/* The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37.
@@ -45,6 +45,14 @@ typedef enum _HardwareModel {
HardwareModel_HELTEC_V2_1 = 10,
/* Ancient heltec WiFi_Lora_32 board */
HardwareModel_HELTEC_V1 = 11,
+ /* New T-BEAM with ESP32-S3 CPU */
+ HardwareModel_LILYGO_TBEAM_S3_CORE = 12,
+ /* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */
+ HardwareModel_RAK11200 = 13,
+ /* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */
+ HardwareModel_NANO_G1 = 14,
+ /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */
+ HardwareModel_STATION_G1 = 25,
/* Less common/prototype boards listed here (needs one more byte over the air) */
HardwareModel_LORA_RELAY_V1 = 32,
/* TODO: REPLACE */
@@ -61,18 +69,12 @@ typedef enum _HardwareModel {
HardwareModel_ANDROID_SIM = 38,
/* Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics */
HardwareModel_DIY_V1 = 39,
- /* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */
- HardwareModel_RAK11200 = 40,
- /* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */
- HardwareModel_NANO_G1 = 41,
/* nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/ */
- HardwareModel_NRF52840_PCA10059 = 42,
+ HardwareModel_NRF52840_PCA10059 = 40,
/* Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3 */
- HardwareModel_DR_DEV = 43,
+ HardwareModel_DR_DEV = 41,
/* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */
- HardwareModel_M5STACK = 44,
- /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */
- HardwareModel_STATION_G1 = 45,
+ HardwareModel_M5STACK = 42,
/* Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. */
HardwareModel_PRIVATE_HW = 255
} HardwareModel;
@@ -81,7 +83,7 @@ typedef enum _HardwareModel {
typedef enum _Constants {
/* First enum must be zero, and we are just using this enum to
pass int constants between two very different environments */
- Constants_Unused = 0,
+ Constants_ZERO = 0,
/* From mesh.options
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
outside of this envelope */
@@ -94,32 +96,32 @@ typedef enum _Constants {
and we'll try to help. */
typedef enum _CriticalErrorCode {
/* TODO: REPLACE */
- CriticalErrorCode_None = 0,
+ CriticalErrorCode_NONE = 0,
/* A software bug was detected while trying to send lora */
- CriticalErrorCode_TxWatchdog = 1,
+ CriticalErrorCode_TX_WATCHDOG = 1,
/* A software bug was detected on entry to sleep */
- CriticalErrorCode_SleepEnterWait = 2,
+ CriticalErrorCode_SLEEP_ENTER_WAIT = 2,
/* No Lora radio hardware could be found */
- CriticalErrorCode_NoRadio = 3,
+ CriticalErrorCode_NO_RADIO = 3,
/* Not normally used */
- CriticalErrorCode_Unspecified = 4,
+ CriticalErrorCode_UNSPECIFIED = 4,
/* We failed while configuring a UBlox GPS */
- CriticalErrorCode_UBloxInitFailed = 5,
+ CriticalErrorCode_UBLOX_UNIT_FAILED = 5,
/* This board was expected to have a power management chip and it is missing or broken */
- CriticalErrorCode_NoAXP192 = 6,
+ CriticalErrorCode_NO_AXP192 = 6,
/* The channel tried to set a radio setting which is not supported by this chipset,
radio comms settings are now undefined. */
- CriticalErrorCode_InvalidRadioSetting = 7,
+ CriticalErrorCode_INVALID_RADIO_SETTING = 7,
/* Radio transmit hardware failure. We sent data to the radio chip, but it didn't
reply with an interrupt. */
- CriticalErrorCode_TransmitFailed = 8,
+ CriticalErrorCode_TRANSMIT_FAILED = 8,
/* We detected that the main CPU voltage dropped below the minumum acceptable value */
- CriticalErrorCode_Brownout = 9,
+ CriticalErrorCode_BROWNOUT = 9,
/* Selftest of SX1262 radio chip failed */
- CriticalErrorCode_SX1262Failure = 10,
+ CriticalErrorCode_SX1262_FAILURE = 10,
/* A (likely software but possibly hardware) failure was detected while trying to send packets.
If this occurs on your board, please post in the forum so that we can ask you to collect some information to allow fixing this bug */
- CriticalErrorCode_RadioSpiBug = 11
+ CriticalErrorCode_RADIO_SPI_BUG = 11
} CriticalErrorCode;
/* Note: these enum names must EXACTLY match the string used in the device
@@ -128,27 +130,27 @@ typedef enum _CriticalErrorCode {
To match the old style filenames, _ is converted to -, p is converted to . */
typedef enum _Position_LocSource {
/* TODO: REPLACE */
- Position_LocSource_LOCSRC_UNSPECIFIED = 0,
+ Position_LocSource_LOC_UNSET = 0,
/* TODO: REPLACE */
- Position_LocSource_LOCSRC_MANUAL_ENTRY = 1,
+ Position_LocSource_LOC_MANUAL = 1,
/* TODO: REPLACE */
- Position_LocSource_LOCSRC_GPS_INTERNAL = 2,
+ Position_LocSource_LOC_INTERNAL = 2,
/* TODO: REPLACE */
- Position_LocSource_LOCSRC_GPS_EXTERNAL = 3
+ Position_LocSource_LOC_EXTERNAL = 3
} Position_LocSource;
/* Shared constants between device and phone */
typedef enum _Position_AltSource {
/* First enum must be zero, and we are just using this enum to
pass int constants between two very different environments */
- Position_AltSource_ALTSRC_UNSPECIFIED = 0,
+ Position_AltSource_ALT_UNSET = 0,
/* From mesh.options
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
outside of this envelope */
- Position_AltSource_ALTSRC_MANUAL_ENTRY = 1,
- Position_AltSource_ALTSRC_GPS_INTERNAL = 2,
- Position_AltSource_ALTSRC_GPS_EXTERNAL = 3,
- Position_AltSource_ALTSRC_BAROMETRIC = 4
+ Position_AltSource_ALT_MANUAL = 1,
+ Position_AltSource_ALT_INTERNAL = 2,
+ Position_AltSource_ALT_EXTERNAL = 3,
+ Position_AltSource_ALT_BAROMETRIC = 4
} Position_AltSource;
/* Note: these enum names must EXACTLY match the string used in the device
@@ -304,6 +306,8 @@ typedef struct _MyNodeInfo {
/* Note: This flag merely means we detected a hardware GPS in our node.
Not the same as UserPreferences.location_sharing */
bool has_gps;
+ /* The maximum number of 'software' channels that can be set on this node. */
+ uint32_t max_channels;
/* 0.0.5 etc... */
char firmware_version[18];
/* An error message we'd like to report back to the mothership through analytics.
@@ -331,8 +335,6 @@ typedef struct _MyNodeInfo {
/* The minimum app version that can talk to this device.
Phone/PC apps should compare this to their build number and if too low tell the user they must update their app */
uint32_t min_app_version;
- /* The maximum number of 'software' channels that can be set on this node. */
- uint32_t max_channels;
/* 24 time windows of 1hr each with the airtime transmitted out of the device per hour. */
pb_size_t air_period_tx_count;
uint32_t air_period_tx[8];
@@ -367,13 +369,13 @@ typedef struct _Position {
/* TODO: REPLACE */
Position_AltSource altitude_source;
/* Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds */
- uint32_t pos_timestamp;
+ uint32_t timestamp;
/* Pos. timestamp milliseconds adjustment (rarely available or required) */
- int32_t pos_time_millis;
+ int32_t timestamp_millis_adjust;
/* HAE altitude in meters - can be used instead of MSL altitude */
int32_t altitude_hae;
/* Geoidal separation in meters */
- int32_t alt_geoid_sep;
+ int32_t altitude_geoidal_seperation;
/* Horizontal, Vertical and Position Dilution of Precision, in 1/100 units
- PDOP is sufficient for most cases
- for higher precision scenarios, HDOP and VDOP can be used instead,
@@ -409,10 +411,10 @@ typedef struct _Position {
- if we update at fixed intervals of X seconds, use X
- if we update at dynamic intervals (based on relative movement etc),
but "AT LEAST every Y seconds", use Y */
- uint32_t pos_next_update;
+ uint32_t next_update;
/* A sequence number, incremented with each Position message to help
detect lost updates if needed */
- uint32_t pos_seq_number;
+ uint32_t seq_number;
} Position;
/* A message used in our Dynamic Source Routing protocol (RFC 4728 based) */
@@ -496,7 +498,7 @@ typedef struct _Waypoint {
typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
/* A packet envelope sent/received over the mesh
- only payloadVariant is sent in the payload portion of the LORA packet.
+ only payload_variant is sent in the payload portion of the LORA packet.
The other fields are either not sent at all, or sent in the special 16 byte LORA header. */
typedef struct _MeshPacket {
/* The sending node number.
@@ -513,9 +515,9 @@ typedef struct _MeshPacket {
Therefore channel_index is inherently a local concept and meaningless to send between nodes.
Very briefly, while sending and receiving deep inside the device Router code, this field instead
contains the 'channel hash' instead of the index.
- This 'trick' is only used while the payloadVariant is an 'encrypted'. */
+ This 'trick' is only used while the payload_variant is an 'encrypted'. */
uint8_t channel;
- pb_size_t which_payloadVariant;
+ pb_size_t which_payload_variant;
union {
/* TODO: REPLACE */
Data decoded;
@@ -624,8 +626,10 @@ typedef struct _FromRadio {
/* The packet id, used to allow the phone to request missing read packets from the FIFO,
see our bluetooth docs */
uint32_t id;
- pb_size_t which_payloadVariant;
+ pb_size_t which_payload_variant;
union {
+ /* Log levels, chosen to match python logging conventions. */
+ MeshPacket packet;
/* Tells the phone what our node number is, can be -1 if we've not yet joined a mesh.
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
MyNodeInfo my_info;
@@ -648,15 +652,13 @@ typedef struct _FromRadio {
bool rebooted;
/* Include module config */
ModuleConfig moduleConfig;
- /* Log levels, chosen to match python logging conventions. */
- MeshPacket packet;
};
} FromRadio;
/* Packets/commands to the radio will be written (reliably) to the toRadio characteristic.
Once the write completes the phone can assume it is handled. */
typedef struct _ToRadio {
- pb_size_t which_payloadVariant;
+ pb_size_t which_payload_variant;
union {
/* Send this packet on the mesh */
MeshPacket packet;
@@ -685,21 +687,21 @@ typedef struct _ToRadio {
#define _HardwareModel_MAX HardwareModel_PRIVATE_HW
#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1))
-#define _Constants_MIN Constants_Unused
+#define _Constants_MIN Constants_ZERO
#define _Constants_MAX Constants_DATA_PAYLOAD_LEN
#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1))
-#define _CriticalErrorCode_MIN CriticalErrorCode_None
-#define _CriticalErrorCode_MAX CriticalErrorCode_RadioSpiBug
-#define _CriticalErrorCode_ARRAYSIZE ((CriticalErrorCode)(CriticalErrorCode_RadioSpiBug+1))
+#define _CriticalErrorCode_MIN CriticalErrorCode_NONE
+#define _CriticalErrorCode_MAX CriticalErrorCode_RADIO_SPI_BUG
+#define _CriticalErrorCode_ARRAYSIZE ((CriticalErrorCode)(CriticalErrorCode_RADIO_SPI_BUG+1))
-#define _Position_LocSource_MIN Position_LocSource_LOCSRC_UNSPECIFIED
-#define _Position_LocSource_MAX Position_LocSource_LOCSRC_GPS_EXTERNAL
-#define _Position_LocSource_ARRAYSIZE ((Position_LocSource)(Position_LocSource_LOCSRC_GPS_EXTERNAL+1))
+#define _Position_LocSource_MIN Position_LocSource_LOC_UNSET
+#define _Position_LocSource_MAX Position_LocSource_LOC_EXTERNAL
+#define _Position_LocSource_ARRAYSIZE ((Position_LocSource)(Position_LocSource_LOC_EXTERNAL+1))
-#define _Position_AltSource_MIN Position_AltSource_ALTSRC_UNSPECIFIED
-#define _Position_AltSource_MAX Position_AltSource_ALTSRC_BAROMETRIC
-#define _Position_AltSource_ARRAYSIZE ((Position_AltSource)(Position_AltSource_ALTSRC_BAROMETRIC+1))
+#define _Position_AltSource_MIN Position_AltSource_ALT_UNSET
+#define _Position_AltSource_MAX Position_AltSource_ALT_BAROMETRIC
+#define _Position_AltSource_ARRAYSIZE ((Position_AltSource)(Position_AltSource_ALT_BAROMETRIC+1))
#define _Routing_Error_MIN Routing_Error_NONE
#define _Routing_Error_MAX Routing_Error_NOT_AUTHORIZED
@@ -731,9 +733,9 @@ extern "C" {
#define Waypoint_init_default {0, 0, 0, 0, 0, "", ""}
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default}
-#define MyNodeInfo_init_default {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
+#define MyNodeInfo_init_default {0, 0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
-#define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}}
+#define FromRadio_init_default {0, 0, {MeshPacket_init_default}}
#define ToRadio_init_default {0, {MeshPacket_init_default}}
#define ToRadio_PeerInfo_init_default {0, 0}
#define Compressed_init_default {_PortNum_MIN, {0, {0}}}
@@ -745,9 +747,9 @@ extern "C" {
#define Waypoint_init_zero {0, 0, 0, 0, 0, "", ""}
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero}
-#define MyNodeInfo_init_zero {0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
+#define MyNodeInfo_init_zero {0, 0, 0, "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0}
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
-#define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}}
+#define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}}
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
#define ToRadio_PeerInfo_init_zero {0, 0}
#define Compressed_init_zero {_PortNum_MIN, {0, {0}}}
@@ -769,51 +771,51 @@ extern "C" {
#define LogRecord_level_tag 4
#define MyNodeInfo_my_node_num_tag 1
#define MyNodeInfo_has_gps_tag 2
-#define MyNodeInfo_firmware_version_tag 6
-#define MyNodeInfo_error_code_tag 7
-#define MyNodeInfo_error_address_tag 8
-#define MyNodeInfo_error_count_tag 9
-#define MyNodeInfo_reboot_count_tag 10
-#define MyNodeInfo_bitrate_tag 11
-#define MyNodeInfo_message_timeout_msec_tag 13
-#define MyNodeInfo_min_app_version_tag 14
-#define MyNodeInfo_max_channels_tag 15
-#define MyNodeInfo_air_period_tx_tag 16
-#define MyNodeInfo_air_period_rx_tag 17
-#define MyNodeInfo_has_wifi_tag 18
-#define MyNodeInfo_channel_utilization_tag 19
-#define MyNodeInfo_air_util_tx_tag 20
+#define MyNodeInfo_max_channels_tag 3
+#define MyNodeInfo_firmware_version_tag 4
+#define MyNodeInfo_error_code_tag 5
+#define MyNodeInfo_error_address_tag 6
+#define MyNodeInfo_error_count_tag 7
+#define MyNodeInfo_reboot_count_tag 8
+#define MyNodeInfo_bitrate_tag 9
+#define MyNodeInfo_message_timeout_msec_tag 10
+#define MyNodeInfo_min_app_version_tag 11
+#define MyNodeInfo_air_period_tx_tag 12
+#define MyNodeInfo_air_period_rx_tag 13
+#define MyNodeInfo_has_wifi_tag 14
+#define MyNodeInfo_channel_utilization_tag 15
+#define MyNodeInfo_air_util_tx_tag 16
#define Position_latitude_i_tag 1
#define Position_longitude_i_tag 2
#define Position_altitude_tag 3
-#define Position_time_tag 9
-#define Position_location_source_tag 10
-#define Position_altitude_source_tag 11
-#define Position_pos_timestamp_tag 12
-#define Position_pos_time_millis_tag 13
-#define Position_altitude_hae_tag 14
-#define Position_alt_geoid_sep_tag 15
-#define Position_PDOP_tag 16
-#define Position_HDOP_tag 17
-#define Position_VDOP_tag 18
-#define Position_gps_accuracy_tag 19
-#define Position_ground_speed_tag 20
-#define Position_ground_track_tag 21
-#define Position_fix_quality_tag 22
-#define Position_fix_type_tag 23
-#define Position_sats_in_view_tag 24
-#define Position_sensor_id_tag 25
-#define Position_pos_next_update_tag 40
-#define Position_pos_seq_number_tag 41
-#define RouteDiscovery_route_tag 2
+#define Position_time_tag 4
+#define Position_location_source_tag 5
+#define Position_altitude_source_tag 6
+#define Position_timestamp_tag 7
+#define Position_timestamp_millis_adjust_tag 8
+#define Position_altitude_hae_tag 9
+#define Position_altitude_geoidal_seperation_tag 10
+#define Position_PDOP_tag 11
+#define Position_HDOP_tag 12
+#define Position_VDOP_tag 13
+#define Position_gps_accuracy_tag 14
+#define Position_ground_speed_tag 15
+#define Position_ground_track_tag 16
+#define Position_fix_quality_tag 17
+#define Position_fix_type_tag 18
+#define Position_sats_in_view_tag 19
+#define Position_sensor_id_tag 20
+#define Position_next_update_tag 21
+#define Position_seq_number_tag 22
+#define RouteDiscovery_route_tag 1
#define ToRadio_PeerInfo_app_version_tag 1
#define ToRadio_PeerInfo_mqtt_gateway_tag 2
#define User_id_tag 1
#define User_long_name_tag 2
#define User_short_name_tag 3
#define User_macaddr_tag 4
-#define User_hw_model_tag 6
-#define User_is_licensed_tag 7
+#define User_hw_model_tag 5
+#define User_is_licensed_tag 6
#define Waypoint_id_tag 1
#define Waypoint_latitude_i_tag 2
#define Waypoint_longitude_i_tag 3
@@ -829,11 +831,11 @@ extern "C" {
#define MeshPacket_id_tag 6
#define MeshPacket_rx_time_tag 7
#define MeshPacket_rx_snr_tag 8
-#define MeshPacket_hop_limit_tag 10
-#define MeshPacket_want_ack_tag 11
-#define MeshPacket_priority_tag 12
-#define MeshPacket_rx_rssi_tag 13
-#define MeshPacket_delayed_tag 15
+#define MeshPacket_hop_limit_tag 9
+#define MeshPacket_want_ack_tag 10
+#define MeshPacket_priority_tag 11
+#define MeshPacket_rx_rssi_tag 12
+#define MeshPacket_delayed_tag 13
#define NodeInfo_num_tag 1
#define NodeInfo_user_tag 2
#define NodeInfo_position_tag 3
@@ -844,43 +846,43 @@ extern "C" {
#define Routing_route_reply_tag 2
#define Routing_error_reason_tag 3
#define FromRadio_id_tag 1
+#define FromRadio_packet_tag 2
#define FromRadio_my_info_tag 3
#define FromRadio_node_info_tag 4
-#define FromRadio_config_tag 6
-#define FromRadio_log_record_tag 7
-#define FromRadio_config_complete_id_tag 8
-#define FromRadio_rebooted_tag 9
-#define FromRadio_moduleConfig_tag 10
-#define FromRadio_packet_tag 11
-#define ToRadio_packet_tag 2
-#define ToRadio_peer_info_tag 3
-#define ToRadio_want_config_id_tag 100
-#define ToRadio_disconnect_tag 104
+#define FromRadio_config_tag 5
+#define FromRadio_log_record_tag 6
+#define FromRadio_config_complete_id_tag 7
+#define FromRadio_rebooted_tag 8
+#define FromRadio_moduleConfig_tag 9
+#define ToRadio_packet_tag 1
+#define ToRadio_peer_info_tag 2
+#define ToRadio_want_config_id_tag 3
+#define ToRadio_disconnect_tag 4
/* Struct field encoding specification for nanopb */
#define Position_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 1) \
X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 2) \
X(a, STATIC, SINGULAR, INT32, altitude, 3) \
-X(a, STATIC, SINGULAR, FIXED32, time, 9) \
-X(a, STATIC, SINGULAR, UENUM, location_source, 10) \
-X(a, STATIC, SINGULAR, UENUM, altitude_source, 11) \
-X(a, STATIC, SINGULAR, FIXED32, pos_timestamp, 12) \
-X(a, STATIC, SINGULAR, INT32, pos_time_millis, 13) \
-X(a, STATIC, SINGULAR, SINT32, altitude_hae, 14) \
-X(a, STATIC, SINGULAR, SINT32, alt_geoid_sep, 15) \
-X(a, STATIC, SINGULAR, UINT32, PDOP, 16) \
-X(a, STATIC, SINGULAR, UINT32, HDOP, 17) \
-X(a, STATIC, SINGULAR, UINT32, VDOP, 18) \
-X(a, STATIC, SINGULAR, UINT32, gps_accuracy, 19) \
-X(a, STATIC, SINGULAR, UINT32, ground_speed, 20) \
-X(a, STATIC, SINGULAR, UINT32, ground_track, 21) \
-X(a, STATIC, SINGULAR, UINT32, fix_quality, 22) \
-X(a, STATIC, SINGULAR, UINT32, fix_type, 23) \
-X(a, STATIC, SINGULAR, UINT32, sats_in_view, 24) \
-X(a, STATIC, SINGULAR, UINT32, sensor_id, 25) \
-X(a, STATIC, SINGULAR, UINT32, pos_next_update, 40) \
-X(a, STATIC, SINGULAR, UINT32, pos_seq_number, 41)
+X(a, STATIC, SINGULAR, FIXED32, time, 4) \
+X(a, STATIC, SINGULAR, UENUM, location_source, 5) \
+X(a, STATIC, SINGULAR, UENUM, altitude_source, 6) \
+X(a, STATIC, SINGULAR, FIXED32, timestamp, 7) \
+X(a, STATIC, SINGULAR, INT32, timestamp_millis_adjust, 8) \
+X(a, STATIC, SINGULAR, SINT32, altitude_hae, 9) \
+X(a, STATIC, SINGULAR, SINT32, altitude_geoidal_seperation, 10) \
+X(a, STATIC, SINGULAR, UINT32, PDOP, 11) \
+X(a, STATIC, SINGULAR, UINT32, HDOP, 12) \
+X(a, STATIC, SINGULAR, UINT32, VDOP, 13) \
+X(a, STATIC, SINGULAR, UINT32, gps_accuracy, 14) \
+X(a, STATIC, SINGULAR, UINT32, ground_speed, 15) \
+X(a, STATIC, SINGULAR, UINT32, ground_track, 16) \
+X(a, STATIC, SINGULAR, UINT32, fix_quality, 17) \
+X(a, STATIC, SINGULAR, UINT32, fix_type, 18) \
+X(a, STATIC, SINGULAR, UINT32, sats_in_view, 19) \
+X(a, STATIC, SINGULAR, UINT32, sensor_id, 20) \
+X(a, STATIC, SINGULAR, UINT32, next_update, 21) \
+X(a, STATIC, SINGULAR, UINT32, seq_number, 22)
#define Position_CALLBACK NULL
#define Position_DEFAULT NULL
@@ -889,13 +891,13 @@ X(a, STATIC, SINGULAR, STRING, id, 1) \
X(a, STATIC, SINGULAR, STRING, long_name, 2) \
X(a, STATIC, SINGULAR, STRING, short_name, 3) \
X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \
-X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \
-X(a, STATIC, SINGULAR, BOOL, is_licensed, 7)
+X(a, STATIC, SINGULAR, UENUM, hw_model, 5) \
+X(a, STATIC, SINGULAR, BOOL, is_licensed, 6)
#define User_CALLBACK NULL
#define User_DEFAULT NULL
#define RouteDiscovery_FIELDLIST(X, a) \
-X(a, STATIC, REPEATED, FIXED32, route, 2)
+X(a, STATIC, REPEATED, FIXED32, route, 1)
#define RouteDiscovery_CALLBACK NULL
#define RouteDiscovery_DEFAULT NULL
@@ -935,19 +937,19 @@ X(a, STATIC, SINGULAR, STRING, description, 7)
X(a, STATIC, SINGULAR, FIXED32, from, 1) \
X(a, STATIC, SINGULAR, FIXED32, to, 2) \
X(a, STATIC, SINGULAR, UINT32, channel, 3) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,decoded,decoded), 4) \
-X(a, STATIC, ONEOF, BYTES, (payloadVariant,encrypted,encrypted), 5) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,decoded,decoded), 4) \
+X(a, STATIC, ONEOF, BYTES, (payload_variant,encrypted,encrypted), 5) \
X(a, STATIC, SINGULAR, FIXED32, id, 6) \
X(a, STATIC, SINGULAR, FIXED32, rx_time, 7) \
X(a, STATIC, SINGULAR, FLOAT, rx_snr, 8) \
-X(a, STATIC, SINGULAR, UINT32, hop_limit, 10) \
-X(a, STATIC, SINGULAR, BOOL, want_ack, 11) \
-X(a, STATIC, SINGULAR, UENUM, priority, 12) \
-X(a, STATIC, SINGULAR, INT32, rx_rssi, 13) \
-X(a, STATIC, SINGULAR, UENUM, delayed, 15)
+X(a, STATIC, SINGULAR, UINT32, hop_limit, 9) \
+X(a, STATIC, SINGULAR, BOOL, want_ack, 10) \
+X(a, STATIC, SINGULAR, UENUM, priority, 11) \
+X(a, STATIC, SINGULAR, INT32, rx_rssi, 12) \
+X(a, STATIC, SINGULAR, UENUM, delayed, 13)
#define MeshPacket_CALLBACK NULL
#define MeshPacket_DEFAULT NULL
-#define MeshPacket_payloadVariant_decoded_MSGTYPE Data
+#define MeshPacket_payload_variant_decoded_MSGTYPE Data
#define NodeInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, num, 1) \
@@ -965,20 +967,20 @@ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6)
#define MyNodeInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, my_node_num, 1) \
X(a, STATIC, SINGULAR, BOOL, has_gps, 2) \
-X(a, STATIC, SINGULAR, STRING, firmware_version, 6) \
-X(a, STATIC, SINGULAR, UENUM, error_code, 7) \
-X(a, STATIC, SINGULAR, UINT32, error_address, 8) \
-X(a, STATIC, SINGULAR, UINT32, error_count, 9) \
-X(a, STATIC, SINGULAR, UINT32, reboot_count, 10) \
-X(a, STATIC, SINGULAR, FLOAT, bitrate, 11) \
-X(a, STATIC, SINGULAR, UINT32, message_timeout_msec, 13) \
-X(a, STATIC, SINGULAR, UINT32, min_app_version, 14) \
-X(a, STATIC, SINGULAR, UINT32, max_channels, 15) \
-X(a, STATIC, REPEATED, UINT32, air_period_tx, 16) \
-X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) \
-X(a, STATIC, SINGULAR, BOOL, has_wifi, 18) \
-X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 19) \
-X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 20)
+X(a, STATIC, SINGULAR, UINT32, max_channels, 3) \
+X(a, STATIC, SINGULAR, STRING, firmware_version, 4) \
+X(a, STATIC, SINGULAR, UENUM, error_code, 5) \
+X(a, STATIC, SINGULAR, UINT32, error_address, 6) \
+X(a, STATIC, SINGULAR, UINT32, error_count, 7) \
+X(a, STATIC, SINGULAR, UINT32, reboot_count, 8) \
+X(a, STATIC, SINGULAR, FLOAT, bitrate, 9) \
+X(a, STATIC, SINGULAR, UINT32, message_timeout_msec, 10) \
+X(a, STATIC, SINGULAR, UINT32, min_app_version, 11) \
+X(a, STATIC, REPEATED, UINT32, air_period_tx, 12) \
+X(a, STATIC, REPEATED, UINT32, air_period_rx, 13) \
+X(a, STATIC, SINGULAR, BOOL, has_wifi, 14) \
+X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 15) \
+X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 16)
#define MyNodeInfo_CALLBACK NULL
#define MyNodeInfo_DEFAULT NULL
@@ -992,32 +994,32 @@ X(a, STATIC, SINGULAR, UENUM, level, 4)
#define FromRadio_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, id, 1) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,my_info,my_info), 3) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,node_info,node_info), 4) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,config,config), 6) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \
-X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \
-X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,moduleConfig,moduleConfig), 10) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 2) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,my_info,my_info), 3) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,node_info,node_info), 4) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,config,config), 5) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,log_record,log_record), 6) \
+X(a, STATIC, ONEOF, UINT32, (payload_variant,config_complete_id,config_complete_id), 7) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,rebooted,rebooted), 8) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,moduleConfig,moduleConfig), 9)
#define FromRadio_CALLBACK NULL
#define FromRadio_DEFAULT NULL
-#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo
-#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
-#define FromRadio_payloadVariant_config_MSGTYPE Config
-#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
-#define FromRadio_payloadVariant_moduleConfig_MSGTYPE ModuleConfig
-#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
+#define FromRadio_payload_variant_packet_MSGTYPE MeshPacket
+#define FromRadio_payload_variant_my_info_MSGTYPE MyNodeInfo
+#define FromRadio_payload_variant_node_info_MSGTYPE NodeInfo
+#define FromRadio_payload_variant_config_MSGTYPE Config
+#define FromRadio_payload_variant_log_record_MSGTYPE LogRecord
+#define FromRadio_payload_variant_moduleConfig_MSGTYPE ModuleConfig
#define ToRadio_FIELDLIST(X, a) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 2) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,peer_info,peer_info), 3) \
-X(a, STATIC, ONEOF, UINT32, (payloadVariant,want_config_id,want_config_id), 100) \
-X(a, STATIC, ONEOF, BOOL, (payloadVariant,disconnect,disconnect), 104)
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 1) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,peer_info,peer_info), 2) \
+X(a, STATIC, ONEOF, UINT32, (payload_variant,want_config_id,want_config_id), 3) \
+X(a, STATIC, ONEOF, BOOL, (payload_variant,disconnect,disconnect), 4)
#define ToRadio_CALLBACK NULL
#define ToRadio_DEFAULT NULL
-#define ToRadio_payloadVariant_packet_MSGTYPE MeshPacket
-#define ToRadio_payloadVariant_peer_info_MSGTYPE ToRadio_PeerInfo
+#define ToRadio_payload_variant_packet_MSGTYPE MeshPacket
+#define ToRadio_payload_variant_peer_info_MSGTYPE ToRadio_PeerInfo
#define ToRadio_PeerInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, app_version, 1) \
@@ -1068,9 +1070,9 @@ extern const pb_msgdesc_t Compressed_msg;
#define FromRadio_size 330
#define LogRecord_size 81
#define MeshPacket_size 321
-#define MyNodeInfo_size 197
-#define NodeInfo_size 263
-#define Position_size 142
+#define MyNodeInfo_size 179
+#define NodeInfo_size 258
+#define Position_size 137
#define RouteDiscovery_size 40
#define Routing_size 42
#define ToRadio_PeerInfo_size 8
diff --git a/src/mesh/generated/module_config.pb.h b/src/mesh/generated/module_config.pb.h
index b79b74ac6..b1afc01bd 100644
--- a/src/mesh/generated/module_config.pb.h
+++ b/src/mesh/generated/module_config.pb.h
@@ -11,7 +11,7 @@
/* Enum definitions */
typedef enum _ModuleConfig_SerialConfig_Serial_Baud {
- ModuleConfig_SerialConfig_Serial_Baud_BAUD_Default = 0,
+ ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT = 0,
ModuleConfig_SerialConfig_Serial_Baud_BAUD_110 = 1,
ModuleConfig_SerialConfig_Serial_Baud_BAUD_300 = 2,
ModuleConfig_SerialConfig_Serial_Baud_BAUD_600 = 3,
@@ -30,20 +30,20 @@ typedef enum _ModuleConfig_SerialConfig_Serial_Baud {
} ModuleConfig_SerialConfig_Serial_Baud;
typedef enum _ModuleConfig_SerialConfig_Serial_Mode {
- ModuleConfig_SerialConfig_Serial_Mode_MODE_Default = 0,
- ModuleConfig_SerialConfig_Serial_Mode_MODE_SIMPLE = 1,
- ModuleConfig_SerialConfig_Serial_Mode_MODE_PROTO = 2
+ ModuleConfig_SerialConfig_Serial_Mode_DEFAULT = 0,
+ ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1,
+ ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2
} ModuleConfig_SerialConfig_Serial_Mode;
typedef enum _ModuleConfig_CannedMessageConfig_InputEventChar {
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE = 0,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_UP = 17,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_DOWN = 18,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_LEFT = 19,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_RIGHT = 20,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_SELECT = 10,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_BACK = 27,
- ModuleConfig_CannedMessageConfig_InputEventChar_KEY_CANCEL = 24
+ ModuleConfig_CannedMessageConfig_InputEventChar_NONE = 0,
+ ModuleConfig_CannedMessageConfig_InputEventChar_UP = 17,
+ ModuleConfig_CannedMessageConfig_InputEventChar_DOWN = 18,
+ ModuleConfig_CannedMessageConfig_InputEventChar_LEFT = 19,
+ ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT = 20,
+ ModuleConfig_CannedMessageConfig_InputEventChar_SELECT = 10,
+ ModuleConfig_CannedMessageConfig_InputEventChar_BACK = 27,
+ ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL = 24
} ModuleConfig_CannedMessageConfig_InputEventChar;
/* Struct definitions */
@@ -113,7 +113,7 @@ typedef struct _ModuleConfig_TelemetryConfig {
/* Module Config */
typedef struct _ModuleConfig {
- pb_size_t which_payloadVariant;
+ pb_size_t which_payload_variant;
union {
/* TODO: REPLACE */
ModuleConfig_MQTTConfig mqtt;
@@ -129,22 +129,22 @@ typedef struct _ModuleConfig {
ModuleConfig_TelemetryConfig telemetry;
/* TODO: REPLACE */
ModuleConfig_CannedMessageConfig canned_message;
- } payloadVariant;
+ } payload_variant;
} ModuleConfig;
/* Helper constants for enums */
-#define _ModuleConfig_SerialConfig_Serial_Baud_MIN ModuleConfig_SerialConfig_Serial_Baud_BAUD_Default
+#define _ModuleConfig_SerialConfig_Serial_Baud_MIN ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT
#define _ModuleConfig_SerialConfig_Serial_Baud_MAX ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600
#define _ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Baud)(ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1))
-#define _ModuleConfig_SerialConfig_Serial_Mode_MIN ModuleConfig_SerialConfig_Serial_Mode_MODE_Default
-#define _ModuleConfig_SerialConfig_Serial_Mode_MAX ModuleConfig_SerialConfig_Serial_Mode_MODE_PROTO
-#define _ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Mode)(ModuleConfig_SerialConfig_Serial_Mode_MODE_PROTO+1))
+#define _ModuleConfig_SerialConfig_Serial_Mode_MIN ModuleConfig_SerialConfig_Serial_Mode_DEFAULT
+#define _ModuleConfig_SerialConfig_Serial_Mode_MAX ModuleConfig_SerialConfig_Serial_Mode_PROTO
+#define _ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Mode)(ModuleConfig_SerialConfig_Serial_Mode_PROTO+1))
-#define _ModuleConfig_CannedMessageConfig_InputEventChar_MIN ModuleConfig_CannedMessageConfig_InputEventChar_KEY_NONE
-#define _ModuleConfig_CannedMessageConfig_InputEventChar_MAX ModuleConfig_CannedMessageConfig_InputEventChar_KEY_BACK
-#define _ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((ModuleConfig_CannedMessageConfig_InputEventChar)(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_BACK+1))
+#define _ModuleConfig_CannedMessageConfig_InputEventChar_MIN ModuleConfig_CannedMessageConfig_InputEventChar_NONE
+#define _ModuleConfig_CannedMessageConfig_InputEventChar_MAX ModuleConfig_CannedMessageConfig_InputEventChar_BACK
+#define _ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((ModuleConfig_CannedMessageConfig_InputEventChar)(ModuleConfig_CannedMessageConfig_InputEventChar_BACK+1))
#ifdef __cplusplus
@@ -212,7 +212,7 @@ extern "C" {
#define ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
#define ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
#define ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
-#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 7
+#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 5
#define ModuleConfig_mqtt_tag 1
#define ModuleConfig_serial_tag 2
#define ModuleConfig_external_notification_tag 3
@@ -223,22 +223,22 @@ extern "C" {
/* Struct field encoding specification for nanopb */
#define ModuleConfig_FIELDLIST(X, a) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,mqtt,payloadVariant.mqtt), 1) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,serial,payloadVariant.serial), 2) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,external_notification,payloadVariant.external_notification), 3) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,store_forward,payloadVariant.store_forward), 4) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,range_test,payloadVariant.range_test), 5) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,telemetry,payloadVariant.telemetry), 6) \
-X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,canned_message,payloadVariant.canned_message), 7)
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,mqtt,payload_variant.mqtt), 1) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,serial,payload_variant.serial), 2) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,external_notification,payload_variant.external_notification), 3) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,store_forward,payload_variant.store_forward), 4) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,range_test,payload_variant.range_test), 5) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,telemetry,payload_variant.telemetry), 6) \
+X(a, STATIC, ONEOF, MESSAGE, (payload_variant,canned_message,payload_variant.canned_message), 7)
#define ModuleConfig_CALLBACK NULL
#define ModuleConfig_DEFAULT NULL
-#define ModuleConfig_payloadVariant_mqtt_MSGTYPE ModuleConfig_MQTTConfig
-#define ModuleConfig_payloadVariant_serial_MSGTYPE ModuleConfig_SerialConfig
-#define ModuleConfig_payloadVariant_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig
-#define ModuleConfig_payloadVariant_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig
-#define ModuleConfig_payloadVariant_range_test_MSGTYPE ModuleConfig_RangeTestConfig
-#define ModuleConfig_payloadVariant_telemetry_MSGTYPE ModuleConfig_TelemetryConfig
-#define ModuleConfig_payloadVariant_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig
+#define ModuleConfig_payload_variant_mqtt_MSGTYPE ModuleConfig_MQTTConfig
+#define ModuleConfig_payload_variant_serial_MSGTYPE ModuleConfig_SerialConfig
+#define ModuleConfig_payload_variant_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig
+#define ModuleConfig_payload_variant_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig
+#define ModuleConfig_payload_variant_range_test_MSGTYPE ModuleConfig_RangeTestConfig
+#define ModuleConfig_payload_variant_telemetry_MSGTYPE ModuleConfig_TelemetryConfig
+#define ModuleConfig_payload_variant_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig
#define ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, enabled, 1) \
@@ -292,7 +292,7 @@ X(a, STATIC, SINGULAR, UINT32, device_update_interval, 1) \
X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \
X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \
X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \
-X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 7)
+X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 5)
#define ModuleConfig_TelemetryConfig_CALLBACK NULL
#define ModuleConfig_TelemetryConfig_DEFAULT NULL
diff --git a/src/mesh/generated/remote_hardware.pb.h b/src/mesh/generated/remote_hardware.pb.h
index 6de3f80d2..d923c1189 100644
--- a/src/mesh/generated/remote_hardware.pb.h
+++ b/src/mesh/generated/remote_hardware.pb.h
@@ -31,7 +31,7 @@ typedef enum _HardwareMessage_Type {
(a special channel once multichannel support is included?) */
typedef struct _HardwareMessage {
/* What type of HardwareMessage is this? */
- HardwareMessage_Type typ;
+ HardwareMessage_Type type;
/* What gpios are we changing. Not used for all MessageTypes, see MessageType for details */
uint64_t gpio_mask;
/* For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios.
@@ -55,13 +55,13 @@ extern "C" {
#define HardwareMessage_init_zero {_HardwareMessage_Type_MIN, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
-#define HardwareMessage_typ_tag 1
+#define HardwareMessage_type_tag 1
#define HardwareMessage_gpio_mask_tag 2
#define HardwareMessage_gpio_value_tag 3
/* Struct field encoding specification for nanopb */
#define HardwareMessage_FIELDLIST(X, a) \
-X(a, STATIC, SINGULAR, UENUM, typ, 1) \
+X(a, STATIC, SINGULAR, UENUM, type, 1) \
X(a, STATIC, SINGULAR, UINT64, gpio_mask, 2) \
X(a, STATIC, SINGULAR, UINT64, gpio_value, 3)
#define HardwareMessage_CALLBACK NULL
diff --git a/src/mesh/generated/telemetry.pb.h b/src/mesh/generated/telemetry.pb.h
index 9a75230dd..8636a4386 100644
--- a/src/mesh/generated/telemetry.pb.h
+++ b/src/mesh/generated/telemetry.pb.h
@@ -13,7 +13,7 @@
/* TODO: REPLACE */
typedef enum _TelemetrySensorType {
/* No external telemetry sensor explicitly set */
- TelemetrySensorType_NotSet = 0,
+ TelemetrySensorType_SENSOR_UNSET = 0,
/* High accuracy temperature, pressure, humidity */
TelemetrySensorType_BME280 = 1,
/* High accuracy temperature, pressure, humidity, and air resistance */
@@ -76,7 +76,7 @@ typedef struct _Telemetry {
/* Helper constants for enums */
-#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
+#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET
#define _TelemetrySensorType_MAX TelemetrySensorType_BMP280
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_BMP280+1))
diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp
index 21e4d84b2..298fce3c4 100644
--- a/src/mesh/http/ContentHandler.cpp
+++ b/src/mesh/http/ContentHandler.cpp
@@ -610,7 +610,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
// data->wifi
String ipStr;
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
+ if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN || isSoftAPForced()) {
ipStr = String(WiFi.softAPIP().toString());
} else {
ipStr = String(WiFi.localIP().toString());
diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp
index 024327cbb..f7868106f 100644
--- a/src/mesh/http/WiFiAPClient.cpp
+++ b/src/mesh/http/WiFiAPClient.cpp
@@ -28,7 +28,7 @@ DNSServer dnsServer;
WiFiUDP ntpUDP;
#ifndef DISABLE_NTP
-NTPClient timeClient(ntpUDP, config.device.ntp_server);
+NTPClient timeClient(ntpUDP, config.network.ntp_server);
#endif
uint8_t wifiDisconnectReason = 0;
@@ -59,10 +59,10 @@ static WifiSleepObserver wifiSleepObserver;
static int32_t reconnectWiFi()
{
- const char *wifiName = config.wifi.ssid;
- const char *wifiPsw = config.wifi.psk;
+ const char *wifiName = config.network.wifi_ssid;
+ const char *wifiPsw = config.network.wifi_psk;
- if (config.wifi.enabled && needReconnect && !WiFi.isConnected()) {
+ if (config.network.wifi_enabled && needReconnect && !WiFi.isConnected()) {
// if (radioConfig.has_preferences && needReconnect && !WiFi.isConnected()) {
if (!*wifiPsw) // Treat empty password as no password
@@ -114,7 +114,7 @@ bool isWifiAvailable()
return true;
}
- const char *wifiName = config.wifi.ssid;
+ const char *wifiName = config.network.wifi_ssid;
if (*wifiName) {
return true;
@@ -184,18 +184,18 @@ bool initWifi(bool forceSoftAP)
{
forcedSoftAP = forceSoftAP;
- if (config.wifi.enabled && ((config.wifi.ssid[0]) || forceSoftAP)) {
+ if (config.network.wifi_enabled && ((config.network.wifi_ssid[0]) || forceSoftAP)) {
// if ((radioConfig.has_preferences && config.wifi.ssid[0]) || forceSoftAP) {
- const char *wifiName = config.wifi.ssid;
- const char *wifiPsw = config.wifi.psk;
+ const char *wifiName = config.network.wifi_ssid;
+ const char *wifiPsw = config.network.wifi_psk;
if (forceSoftAP) {
DEBUG_MSG("WiFi ... Forced AP Mode\n");
- } else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint) {
+ } else if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT) {
DEBUG_MSG("WiFi ... AP Mode\n");
- } else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
+ } else if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN) {
DEBUG_MSG("WiFi ... Hidden AP Mode\n");
- } else if (config.wifi.mode == Config_WiFiConfig_WiFiMode_Client) {
+ } else if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_CLIENT) {
DEBUG_MSG("WiFi ... Client Mode\n");
} else {
DEBUG_MSG("WiFi ... WiFi Disabled\n");
@@ -207,7 +207,7 @@ bool initWifi(bool forceSoftAP)
wifiPsw = NULL;
if (*wifiName || forceSoftAP) {
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || forceSoftAP) {
+ if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN || forceSoftAP) {
IPAddress apIP(192, 168, 42, 1);
WiFi.onEvent(WiFiEvent);
@@ -222,7 +222,7 @@ bool initWifi(bool forceSoftAP)
} else {
// If AP is configured to be hidden hidden
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden) {
+ if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN) {
// The configurations on softAP are from the espresif library
int ok = WiFi.softAP(wifiName, wifiPsw, 1, 1, 4);
@@ -238,8 +238,10 @@ bool initWifi(bool forceSoftAP)
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
DEBUG_MSG("MY IP AP ADDRESS: %s\n", WiFi.softAPIP().toString().c_str());
+#if !CONFIG_IDF_TARGET_ESP32S3
// This is needed to improve performance.
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
+#endif
dnsServer.start(53, "*", apIP);
@@ -252,14 +254,19 @@ bool initWifi(bool forceSoftAP)
WiFi.setHostname(ourHost);
WiFi.onEvent(WiFiEvent);
+#if !CONFIG_IDF_TARGET_ESP32S3
// This is needed to improve performance.
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
+#endif
WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.print("\nWiFi lost connection. Reason: ");
+ #if CONFIG_IDF_TARGET_ESP32S3
+ Serial.println(info.wifi_sta_disconnected.reason);
+ wifiDisconnectReason = info.wifi_sta_disconnected.reason;
+ #else
Serial.println(info.disconnected.reason);
-
/*
If we are disconnected from the AP for some reason,
save the error code.
@@ -268,8 +275,14 @@ bool initWifi(bool forceSoftAP)
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-reason-code
*/
wifiDisconnectReason = info.disconnected.reason;
+ #endif
+
},
+#if CONFIG_IDF_TARGET_ESP32S3
+ WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
+#else
WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
+#endif
DEBUG_MSG("JOINING WIFI soon: ssid=%s\n", wifiName);
wifiReconnect = new Periodic("WifiConnect", reconnectWiFi);
@@ -377,7 +390,7 @@ static void WiFiEvent(WiFiEvent_t event)
void handleDNSResponse()
{
- if (config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPoint || config.wifi.mode == Config_WiFiConfig_WiFiMode_AccessPointHidden || isSoftAPForced()) {
+ if (config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT || config.network.wifi_mode == Config_NetworkConfig_WiFiMode_ACCESS_POINT_HIDDEN || isSoftAPForced()) {
dnsServer.processNextRequest();
}
}
diff --git a/src/mesh/mesh-pb-constants.cpp b/src/mesh/mesh-pb-constants.cpp
index 6b9fc4986..b2b99644c 100644
--- a/src/mesh/mesh-pb-constants.cpp
+++ b/src/mesh/mesh-pb-constants.cpp
@@ -10,7 +10,6 @@
/// returns the encoded packet size
size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc_t *fields, const void *src_struct)
{
-
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
if (!pb_encode(&stream, fields, src_struct)) {
DEBUG_MSG("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp
index 20ce7beeb..7991869d8 100644
--- a/src/modules/AdminModule.cpp
+++ b/src/modules/AdminModule.cpp
@@ -38,7 +38,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
bool handled = false;
assert(r);
- switch (r->which_variant) {
+ switch (r->which_payload_variant) {
/**
* Getters
@@ -129,10 +129,10 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
myReply = allocDataProtobuf(res);
} else if (mp.decoded.want_response) {
- DEBUG_MSG("We did not responded to a request that wanted a respond. req.variant=%d\n", r->which_variant);
+ DEBUG_MSG("We did not responded to a request that wanted a respond. req.variant=%d\n", r->which_payload_variant);
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
- DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_variant);
+ DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_payload_variant);
}
break;
}
@@ -171,43 +171,43 @@ void AdminModule::handleSetOwner(const User &o)
void AdminModule::handleSetConfig(const Config &c)
{
bool requiresReboot = false;
- switch (c.which_payloadVariant) {
+ switch (c.which_payload_variant) {
case Config_device_tag:
DEBUG_MSG("Setting config: Device\n");
config.has_device = true;
- config.device = c.payloadVariant.device;
+ config.device = c.payload_variant.device;
break;
case Config_position_tag:
DEBUG_MSG("Setting config: Position\n");
config.has_position = true;
- config.position = c.payloadVariant.position;
+ config.position = c.payload_variant.position;
break;
case Config_power_tag:
DEBUG_MSG("Setting config: Power\n");
config.has_power = true;
- config.power = c.payloadVariant.power;
+ config.power = c.payload_variant.power;
break;
- case Config_wifi_tag:
+ case Config_network_tag:
DEBUG_MSG("Setting config: WiFi\n");
- config.has_wifi = true;
- config.wifi = c.payloadVariant.wifi;
+ config.has_network = true;
+ config.network = c.payload_variant.network;
requiresReboot = true;
break;
case Config_display_tag:
DEBUG_MSG("Setting config: Display\n");
config.has_display = true;
- config.display = c.payloadVariant.display;
+ config.display = c.payload_variant.display;
break;
case Config_lora_tag:
DEBUG_MSG("Setting config: LoRa\n");
config.has_lora = true;
- config.lora = c.payloadVariant.lora;
+ config.lora = c.payload_variant.lora;
requiresReboot = true;
break;
case Config_bluetooth_tag:
DEBUG_MSG("Setting config: Bluetooth\n");
config.has_bluetooth = true;
- config.bluetooth = c.payloadVariant.bluetooth;
+ config.bluetooth = c.payload_variant.bluetooth;
requiresReboot = true;
break;
}
@@ -223,41 +223,41 @@ void AdminModule::handleSetConfig(const Config &c)
void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
{
- switch (c.which_payloadVariant) {
+ switch (c.which_payload_variant) {
case ModuleConfig_mqtt_tag:
DEBUG_MSG("Setting module config: MQTT\n");
moduleConfig.has_mqtt = true;
- moduleConfig.mqtt = c.payloadVariant.mqtt;
+ moduleConfig.mqtt = c.payload_variant.mqtt;
break;
case ModuleConfig_serial_tag:
DEBUG_MSG("Setting module config: Serial\n");
moduleConfig.has_serial = true;
- moduleConfig.serial = c.payloadVariant.serial;
+ moduleConfig.serial = c.payload_variant.serial;
break;
case ModuleConfig_external_notification_tag:
DEBUG_MSG("Setting module config: External Notification\n");
moduleConfig.has_external_notification = true;
- moduleConfig.external_notification = c.payloadVariant.external_notification;
+ moduleConfig.external_notification = c.payload_variant.external_notification;
break;
case ModuleConfig_store_forward_tag:
DEBUG_MSG("Setting module config: Store & Forward\n");
moduleConfig.has_store_forward = true;
- moduleConfig.store_forward = c.payloadVariant.store_forward;
+ moduleConfig.store_forward = c.payload_variant.store_forward;
break;
case ModuleConfig_range_test_tag:
DEBUG_MSG("Setting module config: Range Test\n");
moduleConfig.has_range_test = true;
- moduleConfig.range_test = c.payloadVariant.range_test;
+ moduleConfig.range_test = c.payload_variant.range_test;
break;
case ModuleConfig_telemetry_tag:
DEBUG_MSG("Setting module config: Telemetry\n");
moduleConfig.has_telemetry = true;
- moduleConfig.telemetry = c.payloadVariant.telemetry;
+ moduleConfig.telemetry = c.payload_variant.telemetry;
break;
case ModuleConfig_canned_message_tag:
DEBUG_MSG("Setting module config: Canned Message\n");
moduleConfig.has_canned_message = true;
- moduleConfig.canned_message = c.payloadVariant.canned_message;
+ moduleConfig.canned_message = c.payload_variant.canned_message;
break;
}
@@ -282,7 +282,7 @@ void AdminModule::handleGetOwner(const MeshPacket &req)
AdminMessage res = AdminMessage_init_default;
res.get_owner_response = owner;
- res.which_variant = AdminMessage_get_owner_response_tag;
+ res.which_payload_variant = AdminMessage_get_owner_response_tag;
myReply = allocDataProtobuf(res);
}
}
@@ -295,39 +295,39 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
switch (configType) {
case AdminMessage_ConfigType_DEVICE_CONFIG:
DEBUG_MSG("Getting config: Device\n");
- res.get_config_response.which_payloadVariant = Config_device_tag;
- res.get_config_response.payloadVariant.device = config.device;
+ res.get_config_response.which_payload_variant = Config_device_tag;
+ res.get_config_response.payload_variant.device = config.device;
break;
case AdminMessage_ConfigType_POSITION_CONFIG:
DEBUG_MSG("Getting config: Position\n");
- res.get_config_response.which_payloadVariant = Config_position_tag;
- res.get_config_response.payloadVariant.position = config.position;
+ res.get_config_response.which_payload_variant = Config_position_tag;
+ res.get_config_response.payload_variant.position = config.position;
break;
case AdminMessage_ConfigType_POWER_CONFIG:
DEBUG_MSG("Getting config: Power\n");
- res.get_config_response.which_payloadVariant = Config_power_tag;
- res.get_config_response.payloadVariant.power = config.power;
+ res.get_config_response.which_payload_variant = Config_power_tag;
+ res.get_config_response.payload_variant.power = config.power;
break;
- case AdminMessage_ConfigType_WIFI_CONFIG:
- DEBUG_MSG("Getting config: WiFi\n");
- res.get_config_response.which_payloadVariant = Config_wifi_tag;
- res.get_config_response.payloadVariant.wifi = config.wifi;
- writeSecret(res.get_config_response.payloadVariant.wifi.psk, config.wifi.psk);
+ case AdminMessage_ConfigType_NETWORK_CONFIG:
+ DEBUG_MSG("Getting config: Network\n");
+ res.get_config_response.which_payload_variant = Config_network_tag;
+ res.get_config_response.payload_variant.network = config.network;
+ writeSecret(res.get_config_response.payload_variant.network.wifi_psk, config.network.wifi_psk);
break;
case AdminMessage_ConfigType_DISPLAY_CONFIG:
DEBUG_MSG("Getting config: Display\n");
- res.get_config_response.which_payloadVariant = Config_display_tag;
- res.get_config_response.payloadVariant.display = config.display;
+ res.get_config_response.which_payload_variant = Config_display_tag;
+ res.get_config_response.payload_variant.display = config.display;
break;
case AdminMessage_ConfigType_LORA_CONFIG:
DEBUG_MSG("Getting config: LoRa\n");
- res.get_config_response.which_payloadVariant = Config_lora_tag;
- res.get_config_response.payloadVariant.lora = config.lora;
+ res.get_config_response.which_payload_variant = Config_lora_tag;
+ res.get_config_response.payload_variant.lora = config.lora;
break;
case AdminMessage_ConfigType_BLUETOOTH_CONFIG:
DEBUG_MSG("Getting config: Bluetooth\n");
- res.get_config_response.which_payloadVariant = Config_bluetooth_tag;
- res.get_config_response.payloadVariant.bluetooth = config.bluetooth;
+ res.get_config_response.which_payload_variant = Config_bluetooth_tag;
+ res.get_config_response.payload_variant.bluetooth = config.bluetooth;
break;
}
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
@@ -337,7 +337,7 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private
// and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password);
// r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag;
- res.which_variant = AdminMessage_get_config_response_tag;
+ res.which_payload_variant = AdminMessage_get_config_response_tag;
myReply = allocDataProtobuf(res);
}
}
@@ -350,39 +350,39 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
switch (configType) {
case AdminMessage_ModuleConfigType_MQTT_CONFIG:
DEBUG_MSG("Getting module config: MQTT\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_mqtt_tag;
- res.get_module_config_response.payloadVariant.mqtt = moduleConfig.mqtt;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_mqtt_tag;
+ res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt;
break;
case AdminMessage_ModuleConfigType_SERIAL_CONFIG:
DEBUG_MSG("Getting module config: Serial\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_serial_tag;
- res.get_module_config_response.payloadVariant.serial = moduleConfig.serial;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_serial_tag;
+ res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
break;
case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
DEBUG_MSG("Getting module config: External Notification\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_external_notification_tag;
- res.get_module_config_response.payloadVariant.external_notification =
+ res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag;
+ res.get_module_config_response.payload_variant.external_notification =
moduleConfig.external_notification;
break;
case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
DEBUG_MSG("Getting module config: Store & Forward\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_store_forward_tag;
- res.get_module_config_response.payloadVariant.store_forward = moduleConfig.store_forward;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_store_forward_tag;
+ res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
break;
case AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
DEBUG_MSG("Getting module config: Range Test\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_range_test_tag;
- res.get_module_config_response.payloadVariant.range_test = moduleConfig.range_test;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_range_test_tag;
+ res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
break;
case AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
DEBUG_MSG("Getting module config: Telemetry\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_telemetry_tag;
- res.get_module_config_response.payloadVariant.telemetry = moduleConfig.telemetry;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_telemetry_tag;
+ res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry;
break;
case AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG:
DEBUG_MSG("Getting module config: Canned Message\n");
- res.get_module_config_response.which_payloadVariant = ModuleConfig_canned_message_tag;
- res.get_module_config_response.payloadVariant.canned_message = moduleConfig.canned_message;
+ res.get_module_config_response.which_payload_variant = ModuleConfig_canned_message_tag;
+ res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
break;
}
@@ -393,7 +393,7 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private
// and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password);
// r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag;
- res.which_variant = AdminMessage_get_module_config_response_tag;
+ res.which_payload_variant = AdminMessage_get_module_config_response_tag;
myReply = allocDataProtobuf(res);
}
}
@@ -406,7 +406,7 @@ void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) {
deviceMetadata.device_state_version = DEVICESTATE_CUR_VER;
r.get_device_metadata_response = deviceMetadata;
- r.which_variant = AdminMessage_get_device_metadata_response_tag;
+ r.which_payload_variant = AdminMessage_get_device_metadata_response_tag;
myReply = allocDataProtobuf(r);
}
@@ -416,7 +416,7 @@ void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
// We create the reply here
AdminMessage r = AdminMessage_init_default;
r.get_channel_response = channels.getByIndex(channelIndex);
- r.which_variant = AdminMessage_get_channel_response_tag;
+ r.which_payload_variant = AdminMessage_get_channel_response_tag;
myReply = allocDataProtobuf(r);
}
}
diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp
index 48c711287..54c02f67f 100644
--- a/src/modules/CannedMessageModule.cpp
+++ b/src/modules/CannedMessageModule.cpp
@@ -100,17 +100,17 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
}
bool validEvent = false;
- if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_UP)) {
+ if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_UP)) {
DEBUG_MSG("Canned message event UP\n");
this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_UP;
validEvent = true;
}
- if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_DOWN)) {
+ if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_DOWN)) {
DEBUG_MSG("Canned message event DOWN\n");
this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_DOWN;
validEvent = true;
}
- if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_KEY_SELECT)) {
+ if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_SELECT)) {
DEBUG_MSG("Canned message event Select\n");
// when inactive, call the onebutton shortpress instead. Activate Module only on up/down
if ((this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED)) {
@@ -309,7 +309,7 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const
{
AdminMessageHandleResult result;
- switch (request->which_variant) {
+ switch (request->which_payload_variant) {
case AdminMessage_get_canned_message_module_messages_request_tag:
DEBUG_MSG("Client is getting radio canned messages\n");
this->handleGetCannedMessageModuleMessages(mp, response);
@@ -334,7 +334,7 @@ void CannedMessageModule::handleGetCannedMessageModuleMessages(const MeshPacket
DEBUG_MSG("*** handleGetCannedMessageModuleMessages\n");
assert(req.decoded.want_response);
- response->which_variant = AdminMessage_get_canned_message_module_messages_response_tag;
+ response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag;
strcpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages);
}
diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp
index 22659cac6..8e5be49d7 100644
--- a/src/modules/PositionModule.cpp
+++ b/src/modules/PositionModule.cpp
@@ -34,8 +34,8 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr
// Log packet size and list of fields
DEBUG_MSG("POSITION node=%08x l=%d %s%s%s%s%s%s%s%s%s%s%s%s%s\n", getFrom(&mp), mp.decoded.payload.size,
p.latitude_i ? "LAT " : "", p.longitude_i ? "LON " : "", p.altitude ? "MSL " : "", p.altitude_hae ? "HAE " : "",
- p.alt_geoid_sep ? "GEO " : "", p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "",
- p.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.pos_timestamp ? "PTS " : "",
+ p.PDOP ? "PDOP " : "", p.HDOP ? "HDOP " : "", p.VDOP ? "VDOP " : "",
+ p.sats_in_view ? "SIV " : "", p.fix_quality ? "FXQ " : "", p.fix_type ? "FXT " : "", p.timestamp ? "PTS " : "",
p.time ? "TIME " : "");
if (p.time) {
@@ -70,29 +70,26 @@ MeshPacket *PositionModule::allocReply()
p.longitude_i = node->position.longitude_i;
p.time = node->position.time;
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_ALTITUDE) {
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_ALT_MSL)
+ if (pos_flags & Config_PositionConfig_PositionFlags_ALTITUDE) {
+ if (pos_flags & Config_PositionConfig_PositionFlags_ALTITUDE_MSL)
p.altitude = node->position.altitude;
else
p.altitude_hae = node->position.altitude_hae;
-
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_GEO_SEP)
- p.alt_geoid_sep = node->position.alt_geoid_sep;
}
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_DOP) {
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_HVDOP) {
+ if (pos_flags & Config_PositionConfig_PositionFlags_DOP) {
+ if (pos_flags & Config_PositionConfig_PositionFlags_HVDOP) {
p.HDOP = node->position.HDOP;
p.VDOP = node->position.VDOP;
} else
p.PDOP = node->position.PDOP;
}
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_SATINVIEW)
+ if (pos_flags & Config_PositionConfig_PositionFlags_SATINVIEW)
p.sats_in_view = node->position.sats_in_view;
- if (pos_flags & Config_PositionConfig_PositionFlags_POS_TIMESTAMP)
- p.pos_timestamp = node->position.pos_timestamp;
+ if (pos_flags & Config_PositionConfig_PositionFlags_TIMESTAMP)
+ p.timestamp = node->position.timestamp;
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
@@ -144,7 +141,7 @@ int32_t PositionModule::runOnce()
bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration;
- DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
+ DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.timestamp, requestReplies);
sendOurPosition(NODENUM_BROADCAST, requestReplies);
}
} else {
@@ -183,7 +180,7 @@ int32_t PositionModule::runOnce()
bool requestReplies = currentGeneration != radioGeneration;
currentGeneration = radioGeneration;
- DEBUG_MSG("Sending smart pos@%x:6 to mesh (wantReplies=%d, d=%d, dtt=%d, tt=%d)\n", node2->position.pos_timestamp,
+ DEBUG_MSG("Sending smart pos@%x:6 to mesh (wantReplies=%d, d=%d, dtt=%d, tt=%d)\n", node2->position.timestamp,
requestReplies, distance, distanceTravelThreshold, timeTravel);
sendOurPosition(NODENUM_BROADCAST, requestReplies);
diff --git a/src/modules/RemoteHardwareModule.cpp b/src/modules/RemoteHardwareModule.cpp
index b031f06e8..7a859c87a 100644
--- a/src/modules/RemoteHardwareModule.cpp
+++ b/src/modules/RemoteHardwareModule.cpp
@@ -55,9 +55,9 @@ RemoteHardwareModule::RemoteHardwareModule()
bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *pptr)
{
auto p = *pptr;
- DEBUG_MSG("Received RemoteHardware typ=%d\n", p.typ);
+ DEBUG_MSG("Received RemoteHardware typ=%d\n", p.type);
- switch (p.typ) {
+ switch (p.type) {
case HardwareMessage_Type_WRITE_GPIOS:
// Print notification to LCD screen
screen->print("Write GPIOs\n");
@@ -81,7 +81,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
// Send the reply
HardwareMessage r = HardwareMessage_init_default;
- r.typ = HardwareMessage_Type_READ_GPIOS_REPLY;
+ r.type = HardwareMessage_Type_READ_GPIOS_REPLY;
r.gpio_value = res;
r.gpio_mask = p.gpio_mask;
MeshPacket *p2 = allocDataProtobuf(r);
@@ -104,7 +104,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar
break; // Ignore - we might see our own replies
default:
- DEBUG_MSG("Hardware operation %d not yet implemented! FIXME\n", p.typ);
+ DEBUG_MSG("Hardware operation %d not yet implemented! FIXME\n", p.type);
break;
}
@@ -125,7 +125,7 @@ int32_t RemoteHardwareModule::runOnce()
// Something changed! Tell the world with a broadcast message
HardwareMessage r = HardwareMessage_init_default;
- r.typ = HardwareMessage_Type_GPIOS_CHANGED;
+ r.type = HardwareMessage_Type_GPIOS_CHANGED;
r.gpio_value = curVal;
MeshPacket *p = allocDataProtobuf(r);
service.sendToMesh(p);
diff --git a/src/modules/esp32/SerialModule.cpp b/src/modules/esp32/SerialModule.cpp
index b74f4c118..0a7f4f685 100644
--- a/src/modules/esp32/SerialModule.cpp
+++ b/src/modules/esp32/SerialModule.cpp
@@ -91,7 +91,7 @@ int32_t SerialModule::runOnce()
uint32_t baud = 0;
- if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_Default) {
+ if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT) {
baud = 38400;
} else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_110) {
@@ -237,13 +237,13 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
} else {
- if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_MODE_Default ||
- moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_MODE_SIMPLE) {
+ if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_DEFAULT ||
+ moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_SIMPLE) {
// DEBUG_MSG("* * Message came from the mesh\n");
// Serial2.println("* * Message came from the mesh");
Serial2.printf("%s", p.payload.bytes);
- } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_MODE_PROTO) {
+ } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) {
}
}
diff --git a/src/modules/esp32/StoreForwardModule.cpp b/src/modules/esp32/StoreForwardModule.cpp
index 4c4122e82..95aeef709 100644
--- a/src/modules/esp32/StoreForwardModule.cpp
+++ b/src/modules/esp32/StoreForwardModule.cpp
@@ -21,7 +21,7 @@ int32_t StoreForwardModule::runOnce()
if (moduleConfig.store_forward.enabled) {
- if (config.device.role == Config_DeviceConfig_Role_Router) {
+ if (config.device.role == Config_DeviceConfig_Role_ROUTER) {
// Send out the message queue.
if (this->busy) {
@@ -397,7 +397,7 @@ StoreForwardModule::StoreForwardModule()
if (moduleConfig.store_forward.enabled) {
// Router
- if (config.device.role == Config_DeviceConfig_Role_Router) {
+ if (config.device.role == Config_DeviceConfig_Role_ROUTER) {
DEBUG_MSG("Initializing Store & Forward Module - Enabled as Router\n");
if (ESP.getPsramSize()) {
if (ESP.getFreePsram() >= 1024 * 1024) {
diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp
index 9e8427b54..d425576e7 100644
--- a/src/mqtt/MQTT.cpp
+++ b/src/mqtt/MQTT.cpp
@@ -288,7 +288,7 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
msgType = "telemetry";
Telemetry scratch;
Telemetry *decoded = NULL;
- if (mp->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (mp->which_payload_variant == MeshPacket_decoded_tag) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Telemetry_msg, &scratch)) {
decoded = &scratch;
@@ -318,7 +318,7 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
msgType = "nodeinfo";
User scratch;
User *decoded = NULL;
- if (mp->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (mp->which_payload_variant == MeshPacket_decoded_tag) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &User_msg, &scratch)) {
decoded = &scratch;
@@ -338,13 +338,13 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
msgType = "position";
Position scratch;
Position *decoded = NULL;
- if (mp->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (mp->which_payload_variant == MeshPacket_decoded_tag) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Position_msg, &scratch)) {
decoded = &scratch;
msgPayload = Json::object{
{"time", (int)decoded->time},
- {"pos_timestamp", (int)decoded->pos_timestamp},
+ {"pos_timestamp", (int)decoded->timestamp},
{"latitude_i", decoded->latitude_i},
{"longitude_i", decoded->longitude_i},
{"altitude", decoded->altitude}
@@ -360,7 +360,7 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
msgType = "position";
Waypoint scratch;
Waypoint *decoded = NULL;
- if (mp->which_payloadVariant == MeshPacket_decoded_tag) {
+ if (mp->which_payload_variant == MeshPacket_decoded_tag) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Waypoint_msg, &scratch)) {
decoded = &scratch;
diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp
index 741d0d14d..4bc3fe44a 100644
--- a/src/nimble/NimbleBluetooth.cpp
+++ b/src/nimble/NimbleBluetooth.cpp
@@ -74,9 +74,9 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks
if (doublepressed > 0 && (doublepressed + (30 * 1000)) > millis()) {
DEBUG_MSG("User has set BLE pairing mode to fixed-pin\n");
- config.bluetooth.mode = Config_BluetoothConfig_PairingMode_FixedPin;
+ config.bluetooth.mode = Config_BluetoothConfig_PairingMode_FIXED_PIN;
nodeDB.saveToDisk();
- } else if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RandomPin) {
+ } else if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) {
DEBUG_MSG("Using random passkey\n");
// This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits
passkey = random(100000, 999999);
@@ -135,7 +135,7 @@ void NimbleBluetooth::setup()
NimBLEDevice::init(getDeviceName());
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
- if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NoPin) {
+ if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NO_PIN) {
NimBLEDevice::setSecurityAuth(true, true, true);
NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY);
}
@@ -154,7 +154,7 @@ void NimbleBluetooth::setupService()
NimBLECharacteristic *ToRadioCharacteristic;
NimBLECharacteristic *FromRadioCharacteristic;
// Define the characteristics that the app is looking for
- if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_NoPin) {
+ if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_NO_PIN) {
ToRadioCharacteristic = bleService->createCharacteristic(TORADIO_UUID, NIMBLE_PROPERTY::WRITE);
FromRadioCharacteristic = bleService->createCharacteristic(FROMRADIO_UUID, NIMBLE_PROPERTY::READ);
fromNumCharacteristic = bleService->createCharacteristic(FROMNUM_UUID, NIMBLE_PROPERTY::NOTIFY | NIMBLE_PROPERTY::READ);
diff --git a/src/platform/esp32/ESP32CryptoEngine.cpp b/src/platform/esp32/ESP32CryptoEngine.cpp
index 2003a235b..60026c4db 100644
--- a/src/platform/esp32/ESP32CryptoEngine.cpp
+++ b/src/platform/esp32/ESP32CryptoEngine.cpp
@@ -1,16 +1,16 @@
#include "CryptoEngine.h"
#include "configuration.h"
+#if CONFIG_IDF_TARGET_ESP32S3
+#include "mbedtls/aes.h"
+#else
#include "crypto/includes.h"
-
#include "crypto/common.h"
-
// #include "esp_system.h"
-
#include "crypto/aes.h"
#include "crypto/aes_wrap.h"
#include "mbedtls/aes.h"
-
+#endif
class ESP32CryptoEngine : public CryptoEngine
diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h
index b408daf98..527f2947e 100644
--- a/src/platform/esp32/architecture.h
+++ b/src/platform/esp32/architecture.h
@@ -34,6 +34,9 @@
#define HAS_RTC 1
#endif
+#if defined(HAS_AXP192) || defined(HAS_AXP2101)
+#define HAS_PMU
+#endif
//
// set HW_VENDOR
//
@@ -43,7 +46,9 @@
#if defined(TBEAM_V10)
#define HW_VENDOR HardwareModel_TBEAM
#elif defined(TBEAM_V07)
- #define HW_VENDOR HardwareModel_TBEAM0p7
+ #define HW_VENDOR HardwareModel_TBEAM_V0P7
+#elif defined(LILYGO_TBEAM_S3_CORE)
+ #define HW_VENDOR HardwareModel_LILYGO_TBEAM_S3_CORE
#elif defined(DIY_V1)
#define HW_VENDOR HardwareModel_DIY_V1
#elif defined(RAK_11200)
@@ -62,9 +67,9 @@
#elif defined(TLORA_V2)
#define HW_VENDOR HardwareModel_TLORA_V2
#elif defined(TLORA_V1_3)
- #define HW_VENDOR HardwareModel_TLORA_V1_1p3
+ #define HW_VENDOR HardwareModel_TLORA_V1_1P3
#elif defined(TLORA_V2_1_16)
- #define HW_VENDOR HardwareModel_TLORA_V2_1_1p6
+ #define HW_VENDOR HardwareModel_TLORA_V2_1_1P6
#elif defined(GENIEBLOCKS)
#define HW_VENDOR HardwareModel_GENIEBLOCKS
#elif defined(PRIVATE_HW)
diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp
index 93a486d45..bfa3887ed 100644
--- a/src/platform/nrf52/NRF52Bluetooth.cpp
+++ b/src/platform/nrf52/NRF52Bluetooth.cpp
@@ -167,7 +167,7 @@ void setupMeshService(void)
// any characteristic(s) within that service definition.. Calling .begin() on
// a BLECharacteristic will cause it to be added to the last BLEService that
// was 'begin()'ed!
- auto secMode = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_NoPin ? SECMODE_OPEN : SECMODE_ENC_NO_MITM;
+ auto secMode = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_NO_PIN ? SECMODE_OPEN : SECMODE_ENC_NO_MITM;
fromNum.setProperties(CHR_PROPS_NOTIFY | CHR_PROPS_READ);
fromNum.setPermission(secMode, SECMODE_NO_ACCESS); // FIXME, secure this!!!
@@ -221,8 +221,8 @@ void NRF52Bluetooth::setup()
Bluefruit.Advertising.clearData();
Bluefruit.ScanResponse.clearData();
- if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NoPin) {
- configuredPasskey = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_FixedPin ?
+ if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NO_PIN) {
+ configuredPasskey = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_FIXED_PIN ?
config.bluetooth.fixed_pin : random(100000, 999999);
auto pinString = std::to_string(configuredPasskey);
DEBUG_MSG("Bluetooth pin set to '%i'\n", configuredPasskey);
diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp
index 589e4ae59..254ab695b 100644
--- a/src/platform/nrf52/main-nrf52.cpp
+++ b/src/platform/nrf52/main-nrf52.cpp
@@ -108,7 +108,7 @@ void checkSDEvents()
while (NRF_SUCCESS == sd_evt_get(&evt)) {
switch (evt) {
case NRF_EVT_POWER_FAILURE_WARNING:
- RECORD_CRITICALERROR(CriticalErrorCode_Brownout);
+ RECORD_CRITICALERROR(CriticalErrorCode_BROWNOUT);
break;
default:
@@ -118,7 +118,7 @@ void checkSDEvents()
}
} else {
if (NRF_POWER->EVENTS_POFWARN)
- RECORD_CRITICALERROR(CriticalErrorCode_Brownout);
+ RECORD_CRITICALERROR(CriticalErrorCode_BROWNOUT);
}
}
diff --git a/src/power.h b/src/power.h
index 5e5005a64..64043eb86 100644
--- a/src/power.h
+++ b/src/power.h
@@ -32,8 +32,8 @@ class Power : private concurrency::OSThread
protected:
meshtastic::PowerStatus *statusHandler;
- /// Setup a axp192, return true if found
- bool axp192Init();
+ /// Setup a xpowers chip axp192/axp2101, return true if found
+ bool axpChipInit();
/// Setup a simple ADC input based battery sensor
bool analogInit();
diff --git a/src/shutdown.h b/src/shutdown.h
index 306f84d22..f37339641 100644
--- a/src/shutdown.h
+++ b/src/shutdown.h
@@ -35,8 +35,8 @@ void powerCommandsCheck()
if (shutdownAtMsec && millis() > shutdownAtMsec) {
DEBUG_MSG("Shutting down from admin command\n");
-#ifdef HAS_AXP192
- if (axp192_found == true) {
+#ifdef HAS_PMU
+ if (pmu_found == true) {
playShutdownMelody();
power->shutdown();
}
diff --git a/src/sleep.cpp b/src/sleep.cpp
index bd908357c..055cf770d 100644
--- a/src/sleep.cpp
+++ b/src/sleep.cpp
@@ -19,9 +19,9 @@
esp_sleep_source_t wakeCause; // the reason we booted this time
#endif
-#ifdef HAS_AXP192
-#include "axp20x.h"
-extern AXP20X_Class axp;
+#ifdef HAS_PMU
+#include "XPowersLibInterface.hpp"
+extern XPowersLibInterface *PMU;
#endif
/// Called to ask any observers if they want to veto sleep. Return 1 to veto or 0 to allow sleep to happen
@@ -78,10 +78,10 @@ void setLed(bool ledOn)
digitalWrite(LED_PIN, ledOn ^ LED_INVERTED);
#endif
-#ifdef HAS_AXP192
- if (axp192_found) {
+#ifdef HAS_PMU
+ if (pmu_found && PMU) {
// blink the axp led
- axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
+ PMU->setChargingLedMode(ledOn ? XPOWERS_CHG_LED_ON : XPOWERS_CHG_LED_OFF);
}
#endif
}
@@ -90,9 +90,17 @@ void setGPSPower(bool on)
{
DEBUG_MSG("Setting GPS power=%d\n", on);
-#ifdef HAS_AXP192
- if (axp192_found)
- axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
+#ifdef HAS_PMU
+ if (pmu_found && PMU){
+ uint8_t model = PMU->getChipModel();
+ if(model == XPOWERS_AXP2101){
+ // t-beam-s3-core GNSS power channel
+ on ? PMU->enablePowerOutput(XPOWERS_ALDO4) : PMU->disablePowerOutput(XPOWERS_ALDO4);
+ }else if(model == XPOWERS_AXP192){
+ // t-beam GNSS power channel
+ on ? PMU->enablePowerOutput(XPOWERS_LDO3) : PMU->disablePowerOutput(XPOWERS_LDO3);
+ }
+ }
#endif
}
@@ -146,7 +154,7 @@ static void waitEnterSleep()
delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep
- RECORD_CRITICALERROR(CriticalErrorCode_SleepEnterWait);
+ RECORD_CRITICALERROR(CriticalErrorCode_SLEEP_ENTER_WAIT);
assert(0); // FIXME - for now we just restart, need to fix bug #167
break;
}
@@ -185,8 +193,8 @@ void doDeepSleep(uint64_t msecToWake)
digitalWrite(VEXT_ENABLE, 1); // turn off the display power
#endif
-#ifdef HAS_AXP192
- if (axp192_found) {
+#ifdef HAS_PMU
+ if (pmu_found && PMU) {
// Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep.
// We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost
// wake. We currently use deep sleep only for 'we want our device to actually be off - because our battery is
@@ -198,7 +206,12 @@ void doDeepSleep(uint64_t msecToWake)
// in its sequencer (true?) so the average power draw should be much lower even if we were listinging for packets
// all the time.
- axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); // LORA radio
+ uint8_t model = PMU->getChipModel();
+ if(model == XPOWERS_AXP2101){
+ PMU->disablePowerOutput(XPOWERS_ALDO3); // lora radio power channel
+ }else if(model == XPOWERS_AXP192){
+ PMU->disablePowerOutput(XPOWERS_LDO2); // lora radio power channel
+ }
}
#endif
@@ -255,7 +268,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
#endif
#ifdef PMU_IRQ
// wake due to PMU can happen repeatedly if there is no battery installed or the battery fills
- if (axp192_found)
+ if (pmu_found)
gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_LOW_LEVEL); // pmu irq
#endif
assert(esp_sleep_enable_gpio_wakeup() == ESP_OK);
@@ -284,7 +297,12 @@ void enableModemSleep()
{
static esp_pm_config_esp32_t esp32_config; // filled with zeros because bss
+
+#if CONFIG_IDF_TARGET_ESP32S3
+ esp32_config.max_freq_mhz = CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ;
+#else
esp32_config.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
+#endif
esp32_config.min_freq_mhz = 20; // 10Mhz is minimum recommended
esp32_config.light_sleep_enable = false;
int rv = esp_pm_configure(&esp32_config);
diff --git a/variants/tbeam-s3-core/pins_arduino.h b/variants/tbeam-s3-core/pins_arduino.h
new file mode 100644
index 000000000..7b0193e0e
--- /dev/null
+++ b/variants/tbeam-s3-core/pins_arduino.h
@@ -0,0 +1,29 @@
+#ifndef Pins_Arduino_h
+#define Pins_Arduino_h
+
+#include
+
+#define USB_VID 0x303a
+#define USB_PID 0x1001
+
+#define EXTERNAL_NUM_INTERRUPTS 46
+#define NUM_DIGITAL_PINS 48
+#define NUM_ANALOG_INPUTS 20
+
+#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
+#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
+#define digitalPinHasPWM(p) (p < 46)
+
+static const uint8_t TX = 43;
+static const uint8_t RX = 44;
+
+static const uint8_t SDA = 42;
+static const uint8_t SCL = 41;
+
+static const uint8_t SS = 10;
+static const uint8_t MOSI = 11;
+static const uint8_t MISO = 13;
+static const uint8_t SCK = 12;
+
+
+#endif /* Pins_Arduino_h */
diff --git a/variants/tbeam-s3-core/platformio.ini b/variants/tbeam-s3-core/platformio.ini
new file mode 100644
index 000000000..9adfb90dc
--- /dev/null
+++ b/variants/tbeam-s3-core/platformio.ini
@@ -0,0 +1,11 @@
+; The 1.0 release of the LilyGo TBEAM-S3-Core board
+[env:tbeam-s3-core]
+extends = esp32s3_base
+board = tbeam-s3-core
+
+lib_deps =
+ ${esp32s3_base.lib_deps}
+build_flags =
+ ${esp32s3_base.build_flags}
+ -Ivariants/tbeam-s3-core
+
diff --git a/variants/tbeam-s3-core/variant.h b/variants/tbeam-s3-core/variant.h
new file mode 100644
index 000000000..8fe181ad0
--- /dev/null
+++ b/variants/tbeam-s3-core/variant.h
@@ -0,0 +1,49 @@
+// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
+
+#define I2C_SDA 42
+#define I2C_SCL 41
+
+#define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3
+//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented anywhere.
+// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
+
+#define LED_INVERTED 1
+// #define LED_PIN 4 // Newer tbeams (1.1) have an extra led on GPIO4
+
+// TTGO uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
+// not found then probe for SX1262
+#define USE_SX1262
+#define USE_SX1268
+
+#define LORA_DIO0 -1 // a No connect on the SX1262 module
+#define LORA_RESET 5
+#define LORA_DIO1 1 // SX1262 IRQ
+#define LORA_DIO2 4 // SX1262 BUSY
+#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
+
+#ifdef USE_SX1262
+#define SX126X_CS 10 // FIXME - we really should define LORA_CS instead
+#define SX126X_DIO1 LORA_DIO1
+#define SX126X_BUSY LORA_DIO2
+#define SX126X_RESET LORA_RESET
+#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that
+// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface
+// code)
+#endif
+
+// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts
+// and waking from light sleep
+// #define PMU_IRQ 40
+#define HAS_AXP2101
+
+#define RF95_SCK 12
+#define RF95_MISO 13
+#define RF95_MOSI 11
+#define RF95_NSS 10
+
+#define GPS_RX_PIN 9
+#define GPS_TX_PIN 8
+#define GPS_WAKEUP_PIN 7
+#define GPS_1PPS_PIN 6
+
+
diff --git a/version.properties b/version.properties
index 62f8ca550..45a90e1ad 100644
--- a/version.properties
+++ b/version.properties
@@ -1,4 +1,4 @@
[VERSION]
major = 1
minor = 3
-build = 40
+build = 41