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..0254819e9 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -384,59 +384,8 @@ bool Power::axp192Init() 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; - } + // this was the previous 'Unset' default. + axp.setChargeControlCur(AXP1XX_CHARGE_CUR_450MA); #if 0 diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index b9e4edcc5..178e61a0f 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -16,7 +16,7 @@ static bool isPowered() 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/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..f46123560 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -273,7 +273,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 +297,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 +311,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..b1ae6ec29 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -10,7 +10,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 +19,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..167ab8cc5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -303,7 +303,7 @@ void setup() // 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 + 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/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 19ab81ac9..0ce214574 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,13 +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; 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; @@ -172,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() @@ -237,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 @@ -468,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); @@ -534,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); @@ -623,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 f926c5c69..42eafc24d 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; if (config.lora.hop_limit && config.lora.hop_limit <= HOP_MAX) { @@ -206,11 +206,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 @@ -277,7 +277,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); @@ -304,7 +304,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 /* @@ -349,7 +349,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); @@ -407,7 +407,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/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..1ee830829 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); @@ -377,7 +377,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/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 20ce7beeb..37bec8f27 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); + 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/sleep.cpp b/src/sleep.cpp index bd908357c..f63c1a62f 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -146,7 +146,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; }