From 3acab0816636ca1a6bc4e19e76bc94bac13fe1ec Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sat, 24 Jan 2026 14:57:47 -0600 Subject: [PATCH 1/9] Adding battery calibration module --- protobufs | 2 +- src/Power.cpp | 62 +++- src/PowerFSM.cpp | 9 + src/graphics/Screen.cpp | 15 +- src/graphics/draw/MenuHandler.cpp | 92 ++++++ src/graphics/draw/MenuHandler.h | 4 + src/graphics/draw/NotificationRenderer.cpp | 24 +- src/graphics/draw/NotificationRenderer.h | 1 + src/main.cpp | 3 + src/modules/BatteryCalibrationModule.cpp | 342 +++++++++++++++++++++ src/modules/BatteryCalibrationModule.h | 39 +++ src/modules/BatteryCalibrationSampler.cpp | 105 +++++++ src/modules/BatteryCalibrationSampler.h | 44 +++ src/modules/Modules.cpp | 8 + src/power.h | 5 +- 15 files changed, 741 insertions(+), 14 deletions(-) create mode 100644 src/modules/BatteryCalibrationModule.cpp create mode 100644 src/modules/BatteryCalibrationModule.h create mode 100644 src/modules/BatteryCalibrationSampler.cpp create mode 100644 src/modules/BatteryCalibrationSampler.h diff --git a/protobufs b/protobufs index 77c8329a59a..4f35a058bf3 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 77c8329a59a9c96a61c447b5d5f1a52ca583e4f2 +Subproject commit 4f35a058bf3938d73d1556e056a2700b55e7bcf4 diff --git a/src/Power.cpp b/src/Power.cpp index b2a4ddaaf6e..eecfad94023 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -25,6 +25,10 @@ #include "power/PowerHAL.h" #include "sleep.h" +#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION +#include "modules/BatteryCalibrationModule.h" +#endif + #if defined(ARCH_PORTDUINO) #include "api/WiFiServerAPI.h" #include "input/LinuxInputImpl.h" @@ -175,6 +179,26 @@ Power *power; using namespace meshtastic; +// pulls saved OCV array from config +namespace +{ +bool copyOcvFromConfig(uint16_t *dest, size_t len) +{ + if (config.power.OCV_count == 0) { + return false; + } + if (config.power.OCV_count != len) { + LOG_WARN("Power config OCV array has %u entries, expected %u; using defaults", config.power.OCV_count, + static_cast(len)); + return false; + } + for (size_t i = 0; i < len; ++i) { + dest[i] = static_cast(config.power.OCV[i]); + } + return true; +} +} // namespace + // NRF52 has AREF_VOLTAGE defined in architecture.h but // make sure it's included. If something is wrong with NRF52 // definition - compilation will fail on missing definition @@ -229,10 +253,26 @@ static void battery_adcDisable() /** * A simple battery level sensor that assumes the battery voltage is attached * via a voltage-divider to an analog input + * OCV array is pulled from saved config if available */ class AnalogBatteryLevel : public HasBatteryLevel { public: + void applyOcvConfig(bool reset_read_value = false) + { + bool ocv_loaded = copyOcvFromConfig(OCV, NUM_OCV_POINTS); + LOG_INFO("OCV load from config: %s (first: %u, last: %u)", ocv_loaded ? "true" : "false", OCV[0], + OCV[NUM_OCV_POINTS - 1]); + if (!ocv_loaded) { + return; + } + chargingVolt = (OCV[0] + 10) * NUM_CELLS; + noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS; + if (reset_read_value || !initial_read_done) { + last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS); + } + } + /** * Battery state of charge, from 0 to 100 or -1 for unknown */ @@ -510,9 +550,9 @@ class AnalogBatteryLevel : public HasBatteryLevel /// For heltecs with no battery connected, the measured voltage is 2204, so // need to be higher than that, in this case is 2500mV (3000-500) - const uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY}; - const float chargingVolt = (OCV[0] + 10) * NUM_CELLS; - const float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS; + uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY}; + float chargingVolt = (OCV[0] + 10) * NUM_CELLS; + float noBatVolt = (OCV[NUM_OCV_POINTS - 1] - 500) * NUM_CELLS; // Start value from minimum voltage for the filter to not start from 0 // that could trigger some events. // This value is over-written by the first ADC reading, it the voltage seems @@ -605,7 +645,18 @@ Power::Power() : OSThread("Power") lastheap = memGet.getFreeHeap(); #endif } - +// Allows overwriting defaults with values loaded from config independent of boot sequence +void Power::loadOcvFromConfig() +{ + copyOcvFromConfig(OCV, NUM_OCV_POINTS); +} +bool Power::reloadOcvFromConfig() +{ + bool loaded = copyOcvFromConfig(OCV, NUM_OCV_POINTS); + analogLevel.applyOcvConfig(true); + LOG_INFO("Power OCV reload %s (first=%u last=%u)", loaded ? "ok" : "failed", OCV[0], OCV[NUM_OCV_POINTS - 1]); + return loaded; +} bool Power::analogInit() { #ifdef EXT_PWR_DETECT @@ -672,7 +723,7 @@ bool Power::analogInit() #ifndef ARCH_ESP32 analogReadResolution(BATTERY_SENSE_RESOLUTION_BITS); #endif - + analogLevel.applyOcvConfig(); batteryLevel = &analogLevel; return true; #else @@ -688,6 +739,7 @@ bool Power::analogInit() bool Power::setup() { bool found = false; + analogLevel.applyOcvConfig(); if (axpChipInit()) { found = true; } else if (lipoInit()) { diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 9f8097b84a4..eb29b21aaf1 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -18,6 +18,9 @@ #include "main.h" #include "sleep.h" #include "target_specific.h" +#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION +#include "modules/BatteryCalibrationModule.h" +#endif #if HAS_WIFI && !defined(ARCH_PORTDUINO) || defined(MESHTASTIC_EXCLUDE_WIFI) #include "mesh/wifi/WiFiAPClient.h" @@ -65,6 +68,12 @@ static void sdsEnter() static void lowBattSDSEnter() { LOG_POWERFSM("State: Lower batt SDS"); +// Save OCV array to persistent memory if in battery calibration +#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION + if (batteryCalibrationModule && batteryCalibrationModule->persistCalibrationOcv()) { + nodeDB->saveToDisk(SEGMENT_CONFIG); + } +#endif doDeepSleep(Default::getConfiguredOrDefaultMs(config.power.sds_secs), false, true); } extern Power *power; diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 8bf69b7a00e..f45356d9def 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -38,6 +38,7 @@ along with this program. If not, see . #include "draw/NodeListRenderer.h" #include "draw/NotificationRenderer.h" #include "draw/UIRenderer.h" +#include "modules/BatteryCalibrationModule.h" #include "modules/CannedMessageModule.h" #if !MESHTASTIC_EXCLUDE_GPS @@ -155,6 +156,7 @@ void Screen::showOverlayBanner(BannerOverlayOptions banner_overlay_options) #ifdef USE_EINK EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // Skip full refresh for all overlay menus #endif + NotificationRenderer::bannerGeneration++; // bugfix for external modules // Store the message and set the expiration timestamp strncpy(NotificationRenderer::alertBannerMessage, banner_overlay_options.message, 255); NotificationRenderer::alertBannerMessage[255] = '\0'; // Ensure null termination @@ -166,7 +168,8 @@ void Screen::showOverlayBanner(BannerOverlayOptions banner_overlay_options) NotificationRenderer::alertBannerCallback = banner_overlay_options.bannerCallback; NotificationRenderer::curSelected = banner_overlay_options.InitialSelected; NotificationRenderer::pauseBanner = false; - NotificationRenderer::current_notification_type = notificationTypeEnum::selection_picker; + NotificationRenderer::current_notification_type = banner_overlay_options.notificationType; + NotificationRenderer::inEvent.inputEvent = INPUT_BROKER_NONE; static OverlayCallback overlays[] = {graphics::UIRenderer::drawNavigationBar, NotificationRenderer::drawBannercallback}; ui->setOverlays(overlays, sizeof(overlays) / sizeof(overlays[0])); ui->setTargetFPS(60); @@ -179,6 +182,7 @@ void Screen::showNodePicker(const char *message, uint32_t durationMs, std::funct #ifdef USE_EINK EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // Skip full refresh for all overlay menus #endif + NotificationRenderer::bannerGeneration++; nodeDB->pause_sort(true); // Store the message and set the expiration timestamp strncpy(NotificationRenderer::alertBannerMessage, message, 255); @@ -202,6 +206,7 @@ void Screen::showNumberPicker(const char *message, uint32_t durationMs, uint8_t #ifdef USE_EINK EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // Skip full refresh for all overlay menus #endif + NotificationRenderer::bannerGeneration++; // Store the message and set the expiration timestamp strncpy(NotificationRenderer::alertBannerMessage, message, 255); NotificationRenderer::alertBannerMessage[255] = '\0'; // Ensure null termination @@ -223,6 +228,8 @@ void Screen::showTextInput(const char *header, const char *initialText, uint32_t std::function textCallback) { LOG_INFO("showTextInput called with header='%s', durationMs=%d", header ? header : "NULL", durationMs); + + NotificationRenderer::bannerGeneration++; // Start OnScreenKeyboardModule session (non-touch variant) OnScreenKeyboardModule::instance().start(header, initialText, durationMs, textCallback); @@ -1741,7 +1748,11 @@ int Screen::handleInputEvent(const InputEvent *event) this->ui->getUiState()->currentFrame == framesetInfo.positions.home) { cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST); } else if (event->inputEvent == INPUT_BROKER_SELECT) { - if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) { + if (batteryCalibrationModule && + this->ui->getUiState()->currentFrame < moduleFrames.size() && + moduleFrames.at(this->ui->getUiState()->currentFrame) == batteryCalibrationModule) { + menuHandler::batteryCalibrationMenu(); + } else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) { menuHandler::homeBaseMenu(); } else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.system) { menuHandler::systemBaseMenu(); diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index c5a4106e775..501fa3b711e 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -21,6 +21,8 @@ #include "modules/AdminModule.h" #include "modules/CannedMessageModule.h" #include "modules/ExternalNotificationModule.h" +#include "modules/BatteryCalibrationModule.h" +#include "modules/BatteryCalibrationSampler.h" #include "modules/KeyVerificationModule.h" #include "modules/TraceRouteModule.h" #include @@ -2440,6 +2442,90 @@ void menuHandler::powerMenu() screen->showOverlayBanner(bannerOptions); } +void menuHandler::batteryCalibrationMenu() +{ + + static const char *optionsArrayIdle[] = { "Back", "Begin Calibration", "Reset OCV Array" }; + static const char *optionsArrayActive[] = { "Back", "Stop Calibration", "Reset OCV Array", "Save OCV & End" }; + + enum optionsNumbers { Back = 0, Start = 1, Reset = 2, Apply = 3 }; + BannerOverlayOptions bannerOptions; + bannerOptions.message = "Battery Calibration Action"; + const bool calibrationActive = batteryCalibrationModule && batteryCalibrationModule->isCalibrationActive(); + bannerOptions.optionsArrayPtr = calibrationActive ? optionsArrayActive : optionsArrayIdle; + bannerOptions.optionsCount = calibrationActive ? 4 : 3; + bannerOptions.bannerCallback = [](int selected) -> void { + if (selected == Start) { + if (batteryCalibrationModule && batteryCalibrationModule->isCalibrationActive()) { + batteryCalibrationModule->stopCalibration(); + IF_SCREEN(screen->showSimpleBanner("Calibration stopped.", 2000)); + } else { + menuHandler::menuQueue = menuHandler::battery_calibration_confirm_menu; + screen->runNow(); + } + } else if (selected == Reset) { + if (batteryCalibrationSampler) { + batteryCalibrationSampler->resetSamples(); + } + config.power.OCV_count = 0; + for (size_t i = 0; i < NUM_OCV_POINTS; ++i) { + config.power.OCV[i] = 0; + } + if (nodeDB) { + nodeDB->saveToDisk(SEGMENT_CONFIG); + } + IF_SCREEN(screen->showSimpleBanner("OCV array reset.\nRebooting...", 2000)); + rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000); + screen->runNow(); + } else if (selected == Apply) { + if (batteryCalibrationModule && batteryCalibrationModule->isCalibrationActive()) { + if (batteryCalibrationModule->persistCalibrationOcv()) { + if (nodeDB) { + nodeDB->saveToDisk(SEGMENT_CONFIG); + } else { + } + batteryCalibrationModule->stopCalibration(); + IF_SCREEN(screen->showSimpleBanner("OCV saved.\nCalibration ended.", 2000)); + } else { + IF_SCREEN(screen->showSimpleBanner("OCV not ready yet.", 2000)); + } + } else { + } + screen->runNow(); + } + }; + screen->showOverlayBanner(bannerOptions); + +} + +void menuHandler::batteryCalibrationConfirmMenu() +{ + static const char *optionsArray[] = { "Back", "Start Calibration" }; + enum optionsNumbers { Back = 0, Start = 1 }; + + BannerOverlayOptions bannerOptions; + bannerOptions.message = "Confirm Battery Calibration\n" + "1) Fully charge battery\n" + "2) Remove charger\n" + "3) Start calibration"; + bannerOptions.optionsArrayPtr = optionsArray; + bannerOptions.optionsCount = 2; + bannerOptions.bannerCallback = [](int selected) -> void { + if (selected == Start) { + if (batteryCalibrationModule) { + batteryCalibrationModule->startCalibration(); + IF_SCREEN(screen->showSimpleBanner("Calibration started.\nUse device as normal.\nDo not charge until battery dies.", 5000)); + } else if (batteryCalibrationSampler) { + batteryCalibrationSampler->resetSamples(); + } + } else { + menuHandler::menuQueue = menuHandler::battery_calibration_menu; + screen->runNow(); + } + }; + screen->showOverlayBanner(bannerOptions); +} + void menuHandler::keyVerificationInitMenu() { screen->showNodePicker("Node to Verify", 30000, @@ -2769,6 +2855,12 @@ void menuHandler::handleMenuSwitch(OLEDDisplay *display) case power_menu: powerMenu(); break; + case battery_calibration_menu: + batteryCalibrationMenu(); + break; + case battery_calibration_confirm_menu: + batteryCalibrationConfirmMenu(); + break; case FrameToggles: FrameToggles_menu(); break; diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index 45fd0bf5f1a..03208300c56 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -43,6 +43,8 @@ class menuHandler bluetooth_toggle_menu, screen_options_menu, power_menu, + battery_calibration_menu, + battery_calibration_confirm_menu, system_base_menu, key_verification_init, key_verification_final_prompt, @@ -105,6 +107,8 @@ class menuHandler static void wifiToggleMenu(); static void screenOptionsMenu(); static void powerMenu(); + static void batteryCalibrationMenu(); + static void batteryCalibrationConfirmMenu(); static void nodeNameLengthMenu(); static void FrameToggles_menu(); static void DisplayUnits_menu(); diff --git a/src/graphics/draw/NotificationRenderer.cpp b/src/graphics/draw/NotificationRenderer.cpp index 8d76b4592f8..f7f8205907f 100644 --- a/src/graphics/draw/NotificationRenderer.cpp +++ b/src/graphics/draw/NotificationRenderer.cpp @@ -47,6 +47,7 @@ uint8_t NotificationRenderer::alertBannerOptions = 0; // last x lines are seelct const char **NotificationRenderer::optionsArrayPtr = nullptr; const int *NotificationRenderer::optionsEnumPtr = nullptr; std::function NotificationRenderer::alertBannerCallback = NULL; +uint32_t NotificationRenderer::bannerGeneration = 0; bool NotificationRenderer::pauseBanner = false; notificationTypeEnum NotificationRenderer::current_notification_type = notificationTypeEnum::none; uint32_t NotificationRenderer::numDigits = 0; @@ -204,8 +205,13 @@ void NotificationRenderer::drawNumberPicker(OLEDDisplay *display, OLEDDisplayUiS return; } if (curSelected == static_cast(numDigits)) { + uint32_t generation = bannerGeneration; alertBannerCallback(currentNumber); - resetBanner(); + if (bannerGeneration == generation) { + resetBanner(); + } else { + inEvent.inputEvent = INPUT_BROKER_NONE; + } return; } @@ -270,9 +276,13 @@ void NotificationRenderer::drawNodePicker(OLEDDisplay *display, OLEDDisplayUiSta inEvent.inputEvent == INPUT_BROKER_USER_PRESS || inEvent.inputEvent == INPUT_BROKER_DOWN_LONG) { curSelected++; } else if (inEvent.inputEvent == INPUT_BROKER_SELECT) { + uint32_t generation = bannerGeneration; alertBannerCallback(selectedNodenum); - resetBanner(); - return; + if (bannerGeneration == generation) { + resetBanner(); + } else { + inEvent.inputEvent = INPUT_BROKER_NONE; + } return; } else if ((inEvent.inputEvent == INPUT_BROKER_CANCEL || inEvent.inputEvent == INPUT_BROKER_ALT_LONG) && alertBannerUntil != 0) { resetBanner(); @@ -387,14 +397,18 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp inEvent.inputEvent == INPUT_BROKER_USER_PRESS || inEvent.inputEvent == INPUT_BROKER_DOWN_LONG) { curSelected++; } else if (inEvent.inputEvent == INPUT_BROKER_SELECT) { + uint32_t generation = bannerGeneration; if (optionsEnumPtr != nullptr) { alertBannerCallback(optionsEnumPtr[curSelected]); optionsEnumPtr = nullptr; } else { alertBannerCallback(curSelected); } - resetBanner(); - return; + if (bannerGeneration == generation) { + resetBanner(); + } else { + inEvent.inputEvent = INPUT_BROKER_NONE; + } return; } else if ((inEvent.inputEvent == INPUT_BROKER_CANCEL || inEvent.inputEvent == INPUT_BROKER_ALT_LONG) && alertBannerUntil != 0) { resetBanner(); diff --git a/src/graphics/draw/NotificationRenderer.h b/src/graphics/draw/NotificationRenderer.h index e51bfa5ab29..c2d3d6190de 100644 --- a/src/graphics/draw/NotificationRenderer.h +++ b/src/graphics/draw/NotificationRenderer.h @@ -24,6 +24,7 @@ class NotificationRenderer static const int *optionsEnumPtr; static uint8_t alertBannerOptions; // last x lines are seelctable options static std::function alertBannerCallback; + static uint32_t bannerGeneration; static uint32_t numDigits; static uint32_t currentNumber; static VirtualKeyboard *virtualKeyboard; diff --git a/src/main.cpp b/src/main.cpp index ea114ea34f6..e6e7d716747 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -891,6 +891,9 @@ void setup() // We do this as early as possible because this loads preferences from flash // but we need to do this after main cpu init (esp32setup), because we need the random seed set nodeDB = new NodeDB; + if (power) { + power->reloadOcvFromConfig(); + } #if HAS_TFT if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { tftSetup(); diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp new file mode 100644 index 00000000000..079d3781c11 --- /dev/null +++ b/src/modules/BatteryCalibrationModule.cpp @@ -0,0 +1,342 @@ +#include "BatteryCalibrationModule.h" +#include "graphics/SharedUIDisplay.h" +#include "graphics/ScreenFonts.h" +#include "power.h" +#include + + +BatteryCalibrationModule *batteryCalibrationModule; + +BatteryCalibrationModule::BatteryCalibrationModule() + : SinglePortModule("battery-calibration", meshtastic_PortNum_PRIVATE_APP) +{ + batteryCalibrationModule = this; +} + +#if HAS_SCREEN +void BatteryCalibrationModule::startCalibration() +{ + calibrationActive = true; + calibrationOcvValid = false; + if (batteryCalibrationSampler) { + batteryCalibrationSampler->resetSamples(); + } +} + +void BatteryCalibrationModule::stopCalibration() +{ + calibrationActive = false; +} +#else +void BatteryCalibrationModule::startCalibration() {} +void BatteryCalibrationModule::stopCalibration() {} +#endif + +bool BatteryCalibrationModule::persistCalibrationOcv() +{ + if (!calibrationOcvValid) { + LOG_INFO("Battery calibration OCV not valid; skipping persistence"); + return false; + } + LOG_INFO("Persisting battery calibration OCV array"); + config.power.OCV_count = NUM_OCV_POINTS; + for (size_t i = 0; i < NUM_OCV_POINTS; ++i) { + config.power.OCV[i] = calibrationOcv[i]; + LOG_INFO("OCV[%u]=%u", static_cast(i), static_cast(calibrationOcv[i])); + } + LOG_INFO("Battery calibration OCV array persisted to config"); + return true; +} + +#if HAS_SCREEN +void BatteryCalibrationModule::handleSampleUpdate() +{ + if (!calibrationActive) { + return; + } + calibrationOcvValid = computeOcvFromSamples(calibrationOcv, NUM_OCV_POINTS); +} +#else +void BatteryCalibrationModule::handleSampleUpdate() {} +#endif + +ProcessMessage BatteryCalibrationModule::handleReceived(const meshtastic_MeshPacket &mp) +{ + (void)mp; + return ProcessMessage::CONTINUE; +} + +#if HAS_SCREEN +bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *ocvOut, size_t ocvCount) +{ + const BatteryCalibrationSampler::BatterySample *samples = nullptr; + uint16_t sampleCount = 0; + uint16_t sampleStart = 0; + if (!batteryCalibrationSampler) { + return false; + } + batteryCalibrationSampler->getSamples(samples, sampleCount, sampleStart); + if (!samples || sampleCount < 2 || ocvCount < 2) { + return false; + } + + auto sampleAt = [&](uint16_t logicalIndex) -> const BatteryCalibrationSampler::BatterySample & { + const uint16_t sampleIndex = + static_cast((sampleStart + logicalIndex) % BatteryCalibrationSampler::kMaxSamples); + return samples[sampleIndex]; + }; + + const uint32_t firstTimestamp = sampleAt(0).timestampMs; + const uint32_t lastTimestamp = sampleAt(static_cast(sampleCount - 1)).timestampMs; + const uint32_t totalMs = (lastTimestamp >= firstTimestamp) ? (lastTimestamp - firstTimestamp) : 0; + const float totalPoints = static_cast(ocvCount - 1); + + for (size_t i = 0; i < ocvCount; ++i) { + const float fraction = totalPoints > 0.0f ? static_cast(i) / totalPoints : 0.0f; + if (totalMs == 0) { + const float samplePos = fraction * static_cast(sampleCount - 1); + const uint16_t lowerIndex = static_cast(samplePos); + const uint16_t upperIndex = static_cast(std::min(lowerIndex + 1, sampleCount - 1)); + const float interp = samplePos - static_cast(lowerIndex); + const uint16_t lowerVoltage = sampleAt(lowerIndex).voltageMv; + const uint16_t upperVoltage = sampleAt(upperIndex).voltageMv; + ocvOut[i] = static_cast(lowerVoltage + interp * (upperVoltage - lowerVoltage)); + continue; + } + + const uint32_t targetTimestamp = firstTimestamp + static_cast(fraction * totalMs); + const BatteryCalibrationSampler::BatterySample *prevSample = &sampleAt(0); + const BatteryCalibrationSampler::BatterySample *nextSample = nullptr; + for (uint16_t j = 1; j < sampleCount; ++j) { + const BatteryCalibrationSampler::BatterySample &candidate = sampleAt(j); + if (candidate.timestampMs >= targetTimestamp) { + nextSample = &candidate; + break; + } + prevSample = &candidate; + } + if (!nextSample) { + ocvOut[i] = sampleAt(static_cast(sampleCount - 1)).voltageMv; + continue; + } + + if (nextSample->timestampMs == prevSample->timestampMs) { + ocvOut[i] = nextSample->voltageMv; + continue; + } + + const float timeFraction = + static_cast(targetTimestamp - prevSample->timestampMs) / + static_cast(nextSample->timestampMs - prevSample->timestampMs); + const float voltage = + static_cast(prevSample->voltageMv) + + timeFraction * (static_cast(nextSample->voltageMv) - static_cast(prevSample->voltageMv)); + ocvOut[i] = static_cast(voltage); + } + return true; +} +#else +bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *, size_t) +{ + return false; +} +#endif + +#if HAS_SCREEN +void BatteryCalibrationModule::computeGraphBounds(OLEDDisplay *display, int16_t x, int16_t y, int16_t &graphX, int16_t &graphY, + int16_t &graphW, int16_t &graphH) +{ + (void)y; + const int *textPositions = graphics::getTextPositions(display); + const int16_t lineY = textPositions[1]; + graphX = x; + graphY = static_cast(lineY + FONT_HEIGHT_SMALL + 2); + graphW = SCREEN_WIDTH; + graphH = static_cast(SCREEN_HEIGHT - graphY); + if (graphH < 0) { + graphH = 0; + } +} + +void BatteryCalibrationModule::drawBatteryGraph(OLEDDisplay *display, int16_t graphX, int16_t graphY, int16_t graphW, int16_t graphH, + const BatteryCalibrationSampler::BatterySample *samples, uint16_t sampleCount, + uint16_t sampleStart, uint32_t minMv, uint32_t maxMv) + { + if (!samples || sampleCount < 2 || graphW <= 1 || graphH <= 1 || maxMv <= minMv) { + return; + } + + const uint32_t rangeMv = maxMv - minMv; + const int32_t xSpan = graphW - 1; + const int32_t ySpan = graphH - 1; + const uint16_t maxIndex = static_cast(sampleCount - 1); + + auto clampY = [&](int16_t yValue) -> int16_t { + if (yValue < graphY) { + return graphY; + } + const int16_t maxY = static_cast(graphY + ySpan); + if (yValue > maxY) { + return maxY; + } + return yValue; + }; + + auto voltageToY = [&](uint16_t voltageMv) -> int16_t { + const uint32_t denom = (rangeMv == 0) ? 1 : rangeMv; + const int32_t scaled = static_cast(static_cast(voltageMv) - static_cast(minMv)) * ySpan / denom; + const int16_t yValue = static_cast(graphY + ySpan - scaled); + return clampY(yValue); + }; + + const uint16_t prevIndex = sampleStart; + int16_t prevX = graphX; + int16_t prevY = voltageToY(samples[prevIndex].voltageMv); + + for (uint16_t i = 1; i < sampleCount; ++i) { + const uint16_t sampleIndex = static_cast((sampleStart + i) % BatteryCalibrationSampler::kMaxSamples); + const int16_t currX = static_cast(graphX + (static_cast(i) * xSpan) / maxIndex); + const int16_t currY = voltageToY(samples[sampleIndex].voltageMv); + display->drawLine(prevX, prevY, currX, currY); + prevX = currX; + prevY = currY; + } +} + +void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) +{ + (void)state; + display->clear(); + display->setTextAlignment(TEXT_ALIGN_LEFT); + display->setFont(FONT_SMALL); + + const char *titleStr = "Battery Calibration"; + + graphics::drawCommonHeader(display, x, y, titleStr); + + char voltageStr[12] = {0}; + char percentStr[8] = {0}; + char durationStr[32] = {0}; + const bool hasBattery = powerStatus && powerStatus->getHasBattery(); + const bool calibrating = calibrationActive; + if (hasBattery) { + const int batV = powerStatus->getBatteryVoltageMv() / 1000; + const int batCv = (powerStatus->getBatteryVoltageMv() % 1000) / 10; + const int batMv = powerStatus->getBatteryVoltageMv(); //just for debug use mV + //snprintf(voltageStr, sizeof(voltageStr), "%01d.%02dV", batV, batCv); + snprintf(voltageStr, sizeof(voltageStr), "%04dmV", batMv); //just for debug use mV + snprintf(percentStr, sizeof(percentStr), "%3d%%", powerStatus->getBatteryChargePercent()); + } else { + snprintf(voltageStr, sizeof(voltageStr), "USB"); + snprintf(percentStr, sizeof(percentStr), "USB"); + } + + const int lineY = graphics::getTextPositions(display)[1]; + display->drawString(x, lineY, voltageStr); + const int16_t percentX = static_cast(x + SCREEN_WIDTH - display->getStringWidth(percentStr)); + display->drawString(percentX, lineY, percentStr); + + uint32_t displayWindowMs = 0; + const BatteryCalibrationSampler::BatterySample *samples = nullptr; + uint16_t sampleCount = 0; + uint16_t sampleStart = 0; + if (batteryCalibrationSampler) { + batteryCalibrationSampler->getSamples(samples, sampleCount, sampleStart); + } + if (samples && sampleCount >= 2) { + const uint16_t firstIndex = sampleStart; + const uint16_t lastIndex = + static_cast((sampleStart + sampleCount - 1) % BatteryCalibrationSampler::kMaxSamples); + const uint32_t firstTimestamp = samples[firstIndex].timestampMs; + const uint32_t lastTimestamp = samples[lastIndex].timestampMs; + displayWindowMs = (lastTimestamp >= firstTimestamp) ? (lastTimestamp - firstTimestamp) : 0; + } + const uint32_t hourMs = 60 * 60 * 1000U; + if (calibrating) { + snprintf(durationStr, sizeof(durationStr), "Calibrating..."); + } else if (displayWindowMs >= hourMs && displayWindowMs % hourMs == 0) { + snprintf(durationStr, sizeof(durationStr), "%luh", static_cast(displayWindowMs / hourMs)); + } else { + snprintf(durationStr, sizeof(durationStr), "%lum", static_cast(displayWindowMs / 60000U)); + } + const int16_t leftWidth = display->getStringWidth(voltageStr); + const int16_t rightWidth = display->getStringWidth(percentStr); + const int16_t durationWidth = display->getStringWidth(durationStr); + const int16_t midStart = static_cast(x + leftWidth); + const int16_t midWidth = static_cast(SCREEN_WIDTH - leftWidth - rightWidth); + int16_t durationX = static_cast(midStart + (midWidth - durationWidth) / 2); + if (durationX < midStart) { + durationX = midStart; + } + if (durationX + durationWidth > percentX) { + durationX = static_cast(percentX - durationWidth); + } + if (durationX >= x && durationX + durationWidth <= x + SCREEN_WIDTH) { + display->drawString(durationX, lineY, durationStr); + } + + const int ocvLineY = graphics::getTextPositions(display)[2]; + char ocvStr[96] = {0}; + if (power) { + const uint16_t *ocvValues = power->getOcvArray(); + if (calibrationActive && calibrationOcvValid) { + ocvValues = calibrationOcv; + } + int offset = snprintf(ocvStr, sizeof(ocvStr), "OCV:"); + for (size_t i = 0; i < NUM_OCV_POINTS && offset > 0 && static_cast(offset) < sizeof(ocvStr); ++i) { + const int written = + snprintf(ocvStr + offset, sizeof(ocvStr) - static_cast(offset), "%s%u", + i == 0 ? "" : ",", ocvValues[i]); + if (written <= 0) { + break; + } + offset += written; + } + } else { + snprintf(ocvStr, sizeof(ocvStr), "OCV:N/A"); + } + display->drawString(x, ocvLineY, ocvStr); + + int16_t graphX = 0; + int16_t graphY = 0; + int16_t graphW = 0; + int16_t graphH = 0; + computeGraphBounds(display, x, y, graphX, graphY, graphW, graphH); + + if (!hasBattery) { + if (graphH > 0) { + const char *placeholder = "No battery"; + const int16_t textX = static_cast(graphX + (graphW - display->getStringWidth(placeholder)) / 2); + const int16_t textY = static_cast(graphY + (graphH - FONT_HEIGHT_SMALL) / 2); + display->drawString(textX, textY, placeholder); + } + return; + } + + uint32_t minMv = 0; + uint32_t maxMv = 0; + const uint16_t *ocvValues = power ? power->getOcvArray() : nullptr; + if (ocvValues) { + minMv = ocvValues[0]; + maxMv = ocvValues[0]; + for (size_t i = 1; i < NUM_OCV_POINTS; ++i) { + minMv = std::min(minMv, ocvValues[i]); + maxMv = std::max(maxMv, ocvValues[i]); + } + constexpr uint32_t marginMv = 200; + minMv = (minMv > marginMv) ? (minMv - marginMv) : 0; + maxMv += marginMv; + } else { + minMv = samples[sampleStart].voltageMv; + maxMv = samples[sampleStart].voltageMv; + for (uint16_t i = 1; i < sampleCount; ++i) { + const uint16_t sampleIndex = static_cast((sampleStart + i) % BatteryCalibrationSampler::kMaxSamples); + const uint16_t voltageMv = samples[sampleIndex].voltageMv; + minMv = std::min(minMv, voltageMv); + maxMv = std::max(maxMv, voltageMv); + } + } + + drawBatteryGraph(display, graphX, graphY, graphW, graphH, samples, sampleCount, sampleStart, minMv, maxMv); +} +#endif \ No newline at end of file diff --git a/src/modules/BatteryCalibrationModule.h b/src/modules/BatteryCalibrationModule.h new file mode 100644 index 00000000000..8b275003dbc --- /dev/null +++ b/src/modules/BatteryCalibrationModule.h @@ -0,0 +1,39 @@ +#pragma once + +#include "SinglePortModule.h" +#include "BatteryCalibrationSampler.h" +#include "power.h" + +class BatteryCalibrationModule : public SinglePortModule +{ + public: + BatteryCalibrationModule(); + void startCalibration(); + void stopCalibration(); + bool isCalibrationActive() const { return calibrationActive; } + bool persistCalibrationOcv(); + void handleSampleUpdate(); + +#if HAS_SCREEN + bool wantUIFrame() override { return true; } + void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override; +#endif + + protected: + ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + + private: + bool computeOcvFromSamples(uint16_t *ocvOut, size_t ocvCount); + bool calibrationActive = false; + bool calibrationOcvValid = false; + uint16_t calibrationOcv[NUM_OCV_POINTS]{}; +#if HAS_SCREEN + void computeGraphBounds(OLEDDisplay *display, int16_t x, int16_t y, int16_t &graphX, int16_t &graphY, int16_t &graphW, + int16_t &graphH); + void drawBatteryGraph(OLEDDisplay *display, int16_t graphX, int16_t graphY, int16_t graphW, int16_t graphH, + const BatteryCalibrationSampler::BatterySample *samples, uint16_t sampleCount, uint16_t sampleStart, + uint32_t minMv, uint32_t maxMv); +#endif + +}; +extern BatteryCalibrationModule *batteryCalibrationModule; \ No newline at end of file diff --git a/src/modules/BatteryCalibrationSampler.cpp b/src/modules/BatteryCalibrationSampler.cpp new file mode 100644 index 00000000000..491fb880b1b --- /dev/null +++ b/src/modules/BatteryCalibrationSampler.cpp @@ -0,0 +1,105 @@ +#include "BatteryCalibrationSampler.h" +#include "configuration.h" +#include "modules/BatteryCalibrationModule.h" + +#if HAS_SCREEN + +#include +#include "mesh/NodeDB.h" +#include "power.h" + +BatteryCalibrationSampler *batteryCalibrationSampler; + +BatteryCalibrationSampler::BatteryCalibrationSampler() : concurrency::OSThread("BatteryCalibrationSampler") +{ + batteryCalibrationSampler = this; + startSampling(); +} + +void BatteryCalibrationSampler::startSampling() +{ + active = true; + enabled = true; + setIntervalFromNow(0); +} + +void BatteryCalibrationSampler::stopSampling() +{ + active = false; + disable(); +} + +void BatteryCalibrationSampler::resetSamples() +{ + sampleCount = 0; + sampleStart = 0; + lastSampleMs = 0; + sampleIntervalMs = kBaseSampleIntervalMs; +} + +void BatteryCalibrationSampler::getSamples(const BatterySample *&samplesOut, uint16_t &countOut, uint16_t &startOut) const +{ + samplesOut = samples; + countOut = sampleCount; + startOut = sampleStart; +} + +void BatteryCalibrationSampler::appendSample(uint16_t voltageMv, uint32_t nowMs) +{ + + lastSampleMs = nowMs; + + if (sampleCount == kMaxSamples) { + downsampleSamples(); + } + + const uint16_t index = static_cast((sampleStart + sampleCount) % kMaxSamples); + sampleCount = static_cast(sampleCount + 1); + + samples[index].voltageMv = voltageMv; + samples[index].timestampMs = nowMs; +} + +void BatteryCalibrationSampler::downsampleSamples() +{ + if (sampleCount < 2) { + return; + } + + const uint16_t newCount = static_cast(sampleCount / 2); + for (uint16_t i = 0; i < newCount; ++i) { + const uint16_t firstIndex = static_cast((sampleStart + (2 * i)) % kMaxSamples); + const uint16_t secondIndex = static_cast((sampleStart + (2 * i + 1)) % kMaxSamples); + const uint32_t avgVoltage = + (static_cast(samples[firstIndex].voltageMv) + static_cast(samples[secondIndex].voltageMv)) / + 2U; + const uint32_t avgTimestamp = (samples[firstIndex].timestampMs + samples[secondIndex].timestampMs) / 2U; + samples[i].voltageMv = static_cast(avgVoltage); + samples[i].timestampMs = avgTimestamp; + } + + sampleCount = newCount; + sampleStart = 0; + sampleIntervalMs = static_cast(sampleIntervalMs * 2U); +} + +int32_t BatteryCalibrationSampler::runOnce() +{ + if (!active) { + return disable(); + } + + const uint32_t nowMs = millis(); + if (!powerStatus || !powerStatus->getHasBattery()) { + resetSamples(); + return sampleIntervalMs; + } + + appendSample(static_cast(powerStatus->getBatteryVoltageMv()), nowMs); + if (batteryCalibrationModule) { + batteryCalibrationModule->handleSampleUpdate(); + } + return sampleIntervalMs; +} + +#endif \ No newline at end of file diff --git a/src/modules/BatteryCalibrationSampler.h b/src/modules/BatteryCalibrationSampler.h new file mode 100644 index 00000000000..025131bedb0 --- /dev/null +++ b/src/modules/BatteryCalibrationSampler.h @@ -0,0 +1,44 @@ +#pragma once + +#include "configuration.h" + +#if HAS_SCREEN + +#include "concurrency/OSThread.h" + +class BatteryCalibrationSampler : private concurrency::OSThread +{ + public: + struct BatterySample { + uint16_t voltageMv; + uint32_t timestampMs; + }; + + static constexpr uint16_t kMaxSamples = 1024; + static constexpr uint32_t kBaseSampleIntervalMs = 5000; + BatteryCalibrationSampler(); + + void startSampling(); + void stopSampling(); + bool isSampling() const { return active; } + void resetSamples(); + void getSamples(const BatterySample *&samplesOut, uint16_t &countOut, uint16_t &startOut) const; + uint32_t getSampleIntervalMs() const { return sampleIntervalMs; } + + protected: + int32_t runOnce() override; + + private: + BatterySample samples[kMaxSamples]{}; + uint16_t sampleCount = 0; + uint16_t sampleStart = 0; + uint32_t lastSampleMs = 0; + uint32_t sampleIntervalMs = kBaseSampleIntervalMs; + bool active = false; + + void appendSample(uint16_t voltageMv, uint32_t nowMs); + void downsampleSamples(); +}; + +extern BatteryCalibrationSampler *batteryCalibrationSampler; +#endif \ No newline at end of file diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index e17868bafd6..bc78d84316c 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -32,6 +32,10 @@ #if !MESHTASTIC_EXCLUDE_CANNEDMESSAGES #include "modules/CannedMessageModule.h" #endif +#if !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION +#include "modules/BatteryCalibrationModule.h" +#include "modules/BatteryCalibrationSampler.h" +#endif #if !MESHTASTIC_EXCLUDE_DETECTIONSENSOR #include "modules/DetectionSensorModule.h" #endif @@ -244,6 +248,10 @@ void setupModules() #if ARCH_PORTDUINO new HostMetricsModule(); #endif +#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION + new BatteryCalibrationModule(); + new BatteryCalibrationSampler(); +#endif #if HAS_TELEMETRY new DeviceTelemetryModule(); #endif diff --git a/src/power.h b/src/power.h index 5f887c36b64..dfd247a5bd9 100644 --- a/src/power.h +++ b/src/power.h @@ -105,8 +105,9 @@ class Power : private concurrency::OSThread void readPowerStatus(); virtual bool setup(); virtual int32_t runOnce() override; + bool reloadOcvFromConfig(); void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; } - const uint16_t OCV[11] = {OCV_ARRAY}; + const uint16_t *getOcvArray() const { return OCV; } protected: meshtastic::PowerStatus *statusHandler; @@ -125,9 +126,11 @@ class Power : private concurrency::OSThread bool serialBatteryInit(); private: + void loadOcvFromConfig(); void shutdown(); void reboot(); // open circuit voltage lookup table + uint16_t OCV[NUM_OCV_POINTS] = {OCV_ARRAY}; uint8_t low_voltage_counter; uint32_t lastLogTime = 0; #ifdef DEBUG_HEAP From bf6727feb3dd229833a1f596d4dced08b762583a Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sat, 24 Jan 2026 17:07:35 -0600 Subject: [PATCH 2/9] fixing capitalization --- src/Power.cpp | 8 ++++---- src/graphics/draw/MenuHandler.cpp | 4 ++-- src/modules/BatteryCalibrationModule.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index eecfad94023..c88730048c7 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -184,16 +184,16 @@ namespace { bool copyOcvFromConfig(uint16_t *dest, size_t len) { - if (config.power.OCV_count == 0) { + if (config.power.ocv_count == 0) { return false; } - if (config.power.OCV_count != len) { - LOG_WARN("Power config OCV array has %u entries, expected %u; using defaults", config.power.OCV_count, + if (config.power.ocv_count != len) { + LOG_WARN("Power config OCV array has %u entries, expected %u; using defaults", config.power.ocv_count, static_cast(len)); return false; } for (size_t i = 0; i < len; ++i) { - dest[i] = static_cast(config.power.OCV[i]); + dest[i] = static_cast(config.power.ocv[i]); } return true; } diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 501fa3b711e..7169b5a8ee1 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -2467,9 +2467,9 @@ void menuHandler::batteryCalibrationMenu() if (batteryCalibrationSampler) { batteryCalibrationSampler->resetSamples(); } - config.power.OCV_count = 0; + config.power.ocv_count = 0; for (size_t i = 0; i < NUM_OCV_POINTS; ++i) { - config.power.OCV[i] = 0; + config.power.ocv[i] = 0; } if (nodeDB) { nodeDB->saveToDisk(SEGMENT_CONFIG); diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp index 079d3781c11..71f924fd0d1 100644 --- a/src/modules/BatteryCalibrationModule.cpp +++ b/src/modules/BatteryCalibrationModule.cpp @@ -39,9 +39,9 @@ bool BatteryCalibrationModule::persistCalibrationOcv() return false; } LOG_INFO("Persisting battery calibration OCV array"); - config.power.OCV_count = NUM_OCV_POINTS; + config.power.ocv_count = NUM_OCV_POINTS; for (size_t i = 0; i < NUM_OCV_POINTS; ++i) { - config.power.OCV[i] = calibrationOcv[i]; + config.power.ocv[i] = calibrationOcv[i]; LOG_INFO("OCV[%u]=%u", static_cast(i), static_cast(calibrationOcv[i])); } LOG_INFO("Battery calibration OCV array persisted to config"); From 454ab058f74bb721b7552503713c864376f0fd38 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sat, 24 Jan 2026 20:19:27 -0600 Subject: [PATCH 3/9] Updated protobufs build for CI tests --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.cpp | 2 +- src/mesh/generated/meshtastic/admin.pb.h | 2 +- src/mesh/generated/meshtastic/apponly.pb.cpp | 2 +- src/mesh/generated/meshtastic/apponly.pb.h | 2 +- src/mesh/generated/meshtastic/atak.pb.cpp | 2 +- src/mesh/generated/meshtastic/atak.pb.h | 2 +- .../generated/meshtastic/cannedmessages.pb.cpp | 2 +- src/mesh/generated/meshtastic/cannedmessages.pb.h | 2 +- src/mesh/generated/meshtastic/channel.pb.cpp | 2 +- src/mesh/generated/meshtastic/channel.pb.h | 2 +- src/mesh/generated/meshtastic/clientonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/clientonly.pb.h | 2 +- src/mesh/generated/meshtastic/config.pb.cpp | 2 +- src/mesh/generated/meshtastic/config.pb.h | 14 ++++++++++---- .../generated/meshtastic/connection_status.pb.cpp | 2 +- .../generated/meshtastic/connection_status.pb.h | 2 +- src/mesh/generated/meshtastic/device_ui.pb.cpp | 2 +- src/mesh/generated/meshtastic/device_ui.pb.h | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 4 ++-- src/mesh/generated/meshtastic/interdevice.pb.cpp | 2 +- src/mesh/generated/meshtastic/interdevice.pb.h | 2 +- src/mesh/generated/meshtastic/localonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/localonly.pb.h | 6 +++--- src/mesh/generated/meshtastic/mesh.pb.cpp | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 +- src/mesh/generated/meshtastic/module_config.pb.cpp | 2 +- src/mesh/generated/meshtastic/module_config.pb.h | 2 +- src/mesh/generated/meshtastic/mqtt.pb.cpp | 2 +- src/mesh/generated/meshtastic/mqtt.pb.h | 2 +- src/mesh/generated/meshtastic/paxcount.pb.cpp | 2 +- src/mesh/generated/meshtastic/paxcount.pb.h | 2 +- src/mesh/generated/meshtastic/portnums.pb.cpp | 2 +- src/mesh/generated/meshtastic/portnums.pb.h | 2 +- src/mesh/generated/meshtastic/powermon.pb.cpp | 2 +- src/mesh/generated/meshtastic/powermon.pb.h | 2 +- .../generated/meshtastic/remote_hardware.pb.cpp | 2 +- src/mesh/generated/meshtastic/remote_hardware.pb.h | 2 +- src/mesh/generated/meshtastic/rtttl.pb.cpp | 2 +- src/mesh/generated/meshtastic/rtttl.pb.h | 2 +- src/mesh/generated/meshtastic/storeforward.pb.cpp | 2 +- src/mesh/generated/meshtastic/storeforward.pb.h | 2 +- src/mesh/generated/meshtastic/telemetry.pb.cpp | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 2 +- src/mesh/generated/meshtastic/xmodem.pb.cpp | 2 +- src/mesh/generated/meshtastic/xmodem.pb.h | 2 +- 47 files changed, 59 insertions(+), 53 deletions(-) diff --git a/protobufs b/protobufs index 4f35a058bf3..47ee7ef4e0c 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 4f35a058bf3938d73d1556e056a2700b55e7bcf4 +Subproject commit 47ee7ef4e0c5851293fa5b34de5ec634491c47c6 diff --git a/src/mesh/generated/meshtastic/admin.pb.cpp b/src/mesh/generated/meshtastic/admin.pb.cpp index e358bc96d35..5ce49e7afc3 100644 --- a/src/mesh/generated/meshtastic/admin.pb.cpp +++ b/src/mesh/generated/meshtastic/admin.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/admin.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index efdead91b42..bb06eb5488f 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/apponly.pb.cpp b/src/mesh/generated/meshtastic/apponly.pb.cpp index 8b1b3da19e2..64d43b7ee1c 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.cpp +++ b/src/mesh/generated/meshtastic/apponly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/apponly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/apponly.pb.h b/src/mesh/generated/meshtastic/apponly.pb.h index f4c33bd7937..dc08d9ff35d 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.h +++ b/src/mesh/generated/meshtastic/apponly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/atak.pb.cpp b/src/mesh/generated/meshtastic/atak.pb.cpp index a0368cf6b22..6dbc69fb4c5 100644 --- a/src/mesh/generated/meshtastic/atak.pb.cpp +++ b/src/mesh/generated/meshtastic/atak.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/atak.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/atak.pb.h b/src/mesh/generated/meshtastic/atak.pb.h index 8533bcbf9de..15a86788b38 100644 --- a/src/mesh/generated/meshtastic/atak.pb.h +++ b/src/mesh/generated/meshtastic/atak.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.cpp b/src/mesh/generated/meshtastic/cannedmessages.pb.cpp index 1f4ebc9271e..9f51e9634d9 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.cpp +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/cannedmessages.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.h b/src/mesh/generated/meshtastic/cannedmessages.pb.h index 8343c4d6ebf..06d14b98f42 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.h +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/channel.pb.cpp b/src/mesh/generated/meshtastic/channel.pb.cpp index 6670a40fc12..52f923b1352 100644 --- a/src/mesh/generated/meshtastic/channel.pb.cpp +++ b/src/mesh/generated/meshtastic/channel.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/channel.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/channel.pb.h b/src/mesh/generated/meshtastic/channel.pb.h index 9dc757ab4a5..d03a8cec9ca 100644 --- a/src/mesh/generated/meshtastic/channel.pb.h +++ b/src/mesh/generated/meshtastic/channel.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/clientonly.pb.cpp b/src/mesh/generated/meshtastic/clientonly.pb.cpp index 8f380a9720f..d99af8cf5d2 100644 --- a/src/mesh/generated/meshtastic/clientonly.pb.cpp +++ b/src/mesh/generated/meshtastic/clientonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/clientonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/clientonly.pb.h b/src/mesh/generated/meshtastic/clientonly.pb.h index 5109e20b20f..bf32d787569 100644 --- a/src/mesh/generated/meshtastic/clientonly.pb.h +++ b/src/mesh/generated/meshtastic/clientonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/config.pb.cpp b/src/mesh/generated/meshtastic/config.pb.cpp index 52a591f3368..2318717e18d 100644 --- a/src/mesh/generated/meshtastic/config.pb.cpp +++ b/src/mesh/generated/meshtastic/config.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index d93f6fafa97..52e4072630a 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED @@ -429,6 +429,10 @@ typedef struct _meshtastic_Config_PowerConfig { uint32_t min_wake_secs; /* I2C address of INA_2XX to use for reading device battery voltage */ uint8_t device_battery_ina_address; + /* Open circuit voltage array (in millivolts) for battery percentage estimation. + Provide NUM_OCV_POINTS entries from full to empty. If unset, device defaults are used. */ + pb_size_t ocv_count; + uint16_t ocv[11]; /* If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled. Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options. */ uint64_t powermon_enables; @@ -729,7 +733,7 @@ extern "C" { #define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}} #define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN} #define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} -#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0} #define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_DeprecatedGpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0, 0} @@ -740,7 +744,7 @@ extern "C" { #define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}} #define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN} #define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} -#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0} #define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_DeprecatedGpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0, 0} @@ -783,6 +787,7 @@ extern "C" { #define meshtastic_Config_PowerConfig_ls_secs_tag 7 #define meshtastic_Config_PowerConfig_min_wake_secs_tag 8 #define meshtastic_Config_PowerConfig_device_battery_ina_address_tag 9 +#define meshtastic_Config_PowerConfig_ocv_tag 10 #define meshtastic_Config_PowerConfig_powermon_enables_tag 32 #define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1 #define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2 @@ -917,6 +922,7 @@ 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) \ X(a, STATIC, SINGULAR, UINT32, device_battery_ina_address, 9) \ +X(a, STATIC, REPEATED, UINT32, ocv, 10) \ X(a, STATIC, SINGULAR, UINT64, powermon_enables, 32) #define meshtastic_Config_PowerConfig_CALLBACK NULL #define meshtastic_Config_PowerConfig_DEFAULT NULL @@ -1040,7 +1046,7 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg; #define meshtastic_Config_NetworkConfig_IpV4Config_size 20 #define meshtastic_Config_NetworkConfig_size 204 #define meshtastic_Config_PositionConfig_size 62 -#define meshtastic_Config_PowerConfig_size 52 +#define meshtastic_Config_PowerConfig_size 96 #define meshtastic_Config_SecurityConfig_size 178 #define meshtastic_Config_SessionkeyConfig_size 0 #define meshtastic_Config_size 207 diff --git a/src/mesh/generated/meshtastic/connection_status.pb.cpp b/src/mesh/generated/meshtastic/connection_status.pb.cpp index b0df459ad3a..d1495bb8324 100644 --- a/src/mesh/generated/meshtastic/connection_status.pb.cpp +++ b/src/mesh/generated/meshtastic/connection_status.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/connection_status.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/connection_status.pb.h b/src/mesh/generated/meshtastic/connection_status.pb.h index 55559dcefb4..c433e370b1c 100644 --- a/src/mesh/generated/meshtastic/connection_status.pb.h +++ b/src/mesh/generated/meshtastic/connection_status.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/device_ui.pb.cpp b/src/mesh/generated/meshtastic/device_ui.pb.cpp index 01940265f95..b5a37408fb8 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.cpp +++ b/src/mesh/generated/meshtastic/device_ui.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/device_ui.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/device_ui.pb.h b/src/mesh/generated/meshtastic/device_ui.pb.h index b99fb10b93b..d23675090f2 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.h +++ b/src/mesh/generated/meshtastic/device_ui.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.cpp b/src/mesh/generated/meshtastic/deviceonly.pb.cpp index 5a96957027d..ea3f79eb625 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.cpp +++ b/src/mesh/generated/meshtastic/deviceonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/deviceonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 57e7df8fc0d..04b05c3c2d2 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED @@ -361,7 +361,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_NodeDatabase_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size -#define meshtastic_BackupPreferences_size 2362 +#define meshtastic_BackupPreferences_size 2406 #define meshtastic_ChannelFile_size 718 #define meshtastic_DeviceState_size 1737 #define meshtastic_NodeInfoLite_size 196 diff --git a/src/mesh/generated/meshtastic/interdevice.pb.cpp b/src/mesh/generated/meshtastic/interdevice.pb.cpp index e3913f78c9d..7ed583cc6a1 100644 --- a/src/mesh/generated/meshtastic/interdevice.pb.cpp +++ b/src/mesh/generated/meshtastic/interdevice.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/interdevice.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/interdevice.pb.h b/src/mesh/generated/meshtastic/interdevice.pb.h index c381438ebe6..8bc22a1f4ba 100644 --- a/src/mesh/generated/meshtastic/interdevice.pb.h +++ b/src/mesh/generated/meshtastic/interdevice.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/localonly.pb.cpp b/src/mesh/generated/meshtastic/localonly.pb.cpp index 34391df73e1..0a752a5a80a 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.cpp +++ b/src/mesh/generated/meshtastic/localonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/localonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index f11b1341946..8a190ca652b 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED @@ -192,8 +192,8 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; #define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size -#define meshtastic_LocalConfig_size 749 +#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size +#define meshtastic_LocalConfig_size 793 #define meshtastic_LocalModuleConfig_size 758 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/mesh.pb.cpp b/src/mesh/generated/meshtastic/mesh.pb.cpp index 7f1a738c652..3aa59448771 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.cpp +++ b/src/mesh/generated/meshtastic/mesh.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index aeae4bd8456..47acfb2c753 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/module_config.pb.cpp b/src/mesh/generated/meshtastic/module_config.pb.cpp index bb57c3f2db0..6d4e48dc50d 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.cpp +++ b/src/mesh/generated/meshtastic/module_config.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index 46a7164d246..cf81e2bc9b7 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/mqtt.pb.cpp b/src/mesh/generated/meshtastic/mqtt.pb.cpp index 2c32ef2e47e..74536cb79d1 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.cpp +++ b/src/mesh/generated/meshtastic/mqtt.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/mqtt.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/mqtt.pb.h b/src/mesh/generated/meshtastic/mqtt.pb.h index c5b10f1f586..922be711dd9 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.h +++ b/src/mesh/generated/meshtastic/mqtt.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/paxcount.pb.cpp b/src/mesh/generated/meshtastic/paxcount.pb.cpp index ff738bde906..40328814711 100644 --- a/src/mesh/generated/meshtastic/paxcount.pb.cpp +++ b/src/mesh/generated/meshtastic/paxcount.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/paxcount.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/paxcount.pb.h b/src/mesh/generated/meshtastic/paxcount.pb.h index 06078aef795..b6b51fdd5e9 100644 --- a/src/mesh/generated/meshtastic/paxcount.pb.h +++ b/src/mesh/generated/meshtastic/paxcount.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_PAXCOUNT_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_PAXCOUNT_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/portnums.pb.cpp b/src/mesh/generated/meshtastic/portnums.pb.cpp index 15a6ba372f0..8fca9af793e 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.cpp +++ b/src/mesh/generated/meshtastic/portnums.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/portnums.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/portnums.pb.h b/src/mesh/generated/meshtastic/portnums.pb.h index d31daa4b25c..e1a52a4d20f 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.h +++ b/src/mesh/generated/meshtastic/portnums.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/powermon.pb.cpp b/src/mesh/generated/meshtastic/powermon.pb.cpp index 8838e165fc0..6a9b7551ada 100644 --- a/src/mesh/generated/meshtastic/powermon.pb.cpp +++ b/src/mesh/generated/meshtastic/powermon.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/powermon.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/powermon.pb.h b/src/mesh/generated/meshtastic/powermon.pb.h index 3072b8ac55f..a1c145f230a 100644 --- a/src/mesh/generated/meshtastic/powermon.pb.h +++ b/src/mesh/generated/meshtastic/powermon.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_POWERMON_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_POWERMON_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.cpp b/src/mesh/generated/meshtastic/remote_hardware.pb.cpp index 8942104b5ac..239950e7ef3 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.cpp +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/remote_hardware.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.h b/src/mesh/generated/meshtastic/remote_hardware.pb.h index 9ab3413c3fd..ade250e932d 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.h +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/rtttl.pb.cpp b/src/mesh/generated/meshtastic/rtttl.pb.cpp index c994741f34a..61ad8b73f64 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.cpp +++ b/src/mesh/generated/meshtastic/rtttl.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/rtttl.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/rtttl.pb.h b/src/mesh/generated/meshtastic/rtttl.pb.h index b6e152dbf88..0572265f7a3 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.h +++ b/src/mesh/generated/meshtastic/rtttl.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/storeforward.pb.cpp b/src/mesh/generated/meshtastic/storeforward.pb.cpp index 82db566a190..71a232bf613 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.cpp +++ b/src/mesh/generated/meshtastic/storeforward.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/storeforward.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/storeforward.pb.h b/src/mesh/generated/meshtastic/storeforward.pb.h index 75cff52058b..44ffd098c7d 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.h +++ b/src/mesh/generated/meshtastic/storeforward.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/telemetry.pb.cpp b/src/mesh/generated/meshtastic/telemetry.pb.cpp index 345d7a15725..fa055a7bb1b 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.cpp +++ b/src/mesh/generated/meshtastic/telemetry.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/telemetry.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 131dd9949cb..7c082d4689e 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/xmodem.pb.cpp b/src/mesh/generated/meshtastic/xmodem.pb.cpp index 09ae41d35b0..3960ccdaa03 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.cpp +++ b/src/mesh/generated/meshtastic/xmodem.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #include "meshtastic/xmodem.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/xmodem.pb.h b/src/mesh/generated/meshtastic/xmodem.pb.h index 3410fda0f4b..76edc0df654 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.h +++ b/src/mesh/generated/meshtastic/xmodem.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9.1 */ +/* Generated by nanopb-0.4.9 */ #ifndef PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED From f78159dff560a0ed677da0373fdbefaf8dc87526 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sat, 24 Jan 2026 20:31:29 -0600 Subject: [PATCH 4/9] Use explicit sample indices to prevent scope error --- src/modules/BatteryCalibrationModule.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp index 71f924fd0d1..ba59e3e6288 100644 --- a/src/modules/BatteryCalibrationModule.cpp +++ b/src/modules/BatteryCalibrationModule.cpp @@ -108,12 +108,14 @@ bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *ocvOut, size_t oc const BatteryCalibrationSampler::BatterySample *prevSample = &sampleAt(0); const BatteryCalibrationSampler::BatterySample *nextSample = nullptr; for (uint16_t j = 1; j < sampleCount; ++j) { - const BatteryCalibrationSampler::BatterySample &candidate = sampleAt(j); - if (candidate.timestampMs >= targetTimestamp) { - nextSample = &candidate; + const uint16_t sampleIndex = + static_cast((sampleStart + j) % BatteryCalibrationSampler::kMaxSamples); + const BatteryCalibrationSampler::BatterySample *candidate = &samples[sampleIndex]; + if (candidate->timestampMs >= targetTimestamp) { + nextSample = candidate; break; } - prevSample = &candidate; + prevSample = candidate; } if (!nextSample) { ocvOut[i] = sampleAt(static_cast(sampleCount - 1)).voltageMv; @@ -339,4 +341,4 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat drawBatteryGraph(display, graphX, graphY, graphW, graphH, samples, sampleCount, sampleStart, minMv, maxMv); } -#endif \ No newline at end of file +#endif From 5217175126c119c46fc0699bb41d0613908a9633 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sun, 25 Jan 2026 11:37:36 -0600 Subject: [PATCH 5/9] Removing OCV array debug from screen --- src/modules/BatteryCalibrationModule.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp index ba59e3e6288..dfea264d337 100644 --- a/src/modules/BatteryCalibrationModule.cpp +++ b/src/modules/BatteryCalibrationModule.cpp @@ -277,28 +277,6 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat display->drawString(durationX, lineY, durationStr); } - const int ocvLineY = graphics::getTextPositions(display)[2]; - char ocvStr[96] = {0}; - if (power) { - const uint16_t *ocvValues = power->getOcvArray(); - if (calibrationActive && calibrationOcvValid) { - ocvValues = calibrationOcv; - } - int offset = snprintf(ocvStr, sizeof(ocvStr), "OCV:"); - for (size_t i = 0; i < NUM_OCV_POINTS && offset > 0 && static_cast(offset) < sizeof(ocvStr); ++i) { - const int written = - snprintf(ocvStr + offset, sizeof(ocvStr) - static_cast(offset), "%s%u", - i == 0 ? "" : ",", ocvValues[i]); - if (written <= 0) { - break; - } - offset += written; - } - } else { - snprintf(ocvStr, sizeof(ocvStr), "OCV:N/A"); - } - display->drawString(x, ocvLineY, ocvStr); - int16_t graphX = 0; int16_t graphY = 0; int16_t graphW = 0; From f50ca19cc557e5f1934c7672171caa10ead4f388 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Sun, 25 Jan 2026 11:47:32 -0600 Subject: [PATCH 6/9] Made display more user friendly --- src/modules/BatteryCalibrationModule.cpp | 41 +++++++++++++----------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp index dfea264d337..0aee1d34b64 100644 --- a/src/modules/BatteryCalibrationModule.cpp +++ b/src/modules/BatteryCalibrationModule.cpp @@ -217,7 +217,6 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat graphics::drawCommonHeader(display, x, y, titleStr); char voltageStr[12] = {0}; - char percentStr[8] = {0}; char durationStr[32] = {0}; const bool hasBattery = powerStatus && powerStatus->getHasBattery(); const bool calibrating = calibrationActive; @@ -227,16 +226,12 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat const int batMv = powerStatus->getBatteryVoltageMv(); //just for debug use mV //snprintf(voltageStr, sizeof(voltageStr), "%01d.%02dV", batV, batCv); snprintf(voltageStr, sizeof(voltageStr), "%04dmV", batMv); //just for debug use mV - snprintf(percentStr, sizeof(percentStr), "%3d%%", powerStatus->getBatteryChargePercent()); } else { snprintf(voltageStr, sizeof(voltageStr), "USB"); - snprintf(percentStr, sizeof(percentStr), "USB"); } const int lineY = graphics::getTextPositions(display)[1]; display->drawString(x, lineY, voltageStr); - const int16_t percentX = static_cast(x + SCREEN_WIDTH - display->getStringWidth(percentStr)); - display->drawString(percentX, lineY, percentStr); uint32_t displayWindowMs = 0; const BatteryCalibrationSampler::BatterySample *samples = nullptr; @@ -254,29 +249,37 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat displayWindowMs = (lastTimestamp >= firstTimestamp) ? (lastTimestamp - firstTimestamp) : 0; } const uint32_t hourMs = 60 * 60 * 1000U; - if (calibrating) { - snprintf(durationStr, sizeof(durationStr), "Calibrating..."); - } else if (displayWindowMs >= hourMs && displayWindowMs % hourMs == 0) { + if (displayWindowMs >= hourMs && displayWindowMs % hourMs == 0) { snprintf(durationStr, sizeof(durationStr), "%luh", static_cast(displayWindowMs / hourMs)); } else { snprintf(durationStr, sizeof(durationStr), "%lum", static_cast(displayWindowMs / 60000U)); } + const int16_t leftWidth = display->getStringWidth(voltageStr); - const int16_t rightWidth = display->getStringWidth(percentStr); const int16_t durationWidth = display->getStringWidth(durationStr); - const int16_t midStart = static_cast(x + leftWidth); - const int16_t midWidth = static_cast(SCREEN_WIDTH - leftWidth - rightWidth); - int16_t durationX = static_cast(midStart + (midWidth - durationWidth) / 2); - if (durationX < midStart) { - durationX = midStart; - } - if (durationX + durationWidth > percentX) { - durationX = static_cast(percentX - durationWidth); - } - if (durationX >= x && durationX + durationWidth <= x + SCREEN_WIDTH) { + const int16_t durationX = static_cast(x + SCREEN_WIDTH - durationWidth); + if (durationX >= x + leftWidth) { display->drawString(durationX, lineY, durationStr); } + if (calibrating) { + const char *calibratingLabel = "Calibrating..."; + const int16_t rightWidth = durationWidth; + const int16_t labelWidth = display->getStringWidth(calibratingLabel); + const int16_t midStart = static_cast(x + leftWidth); + const int16_t midWidth = static_cast(SCREEN_WIDTH - leftWidth - rightWidth); + int16_t labelX = static_cast(midStart + (midWidth - labelWidth) / 2); + if (labelX < midStart) { + labelX = midStart; + } + if (labelX + labelWidth > durationX) { + labelX = static_cast(durationX - labelWidth); + } + if (labelX >= x && labelX + labelWidth <= x + SCREEN_WIDTH) { + display->drawString(labelX, lineY, calibratingLabel); + } + } + int16_t graphX = 0; int16_t graphY = 0; int16_t graphW = 0; From 67c9a5671d9c94665d5c2dc34839e99742bc25a4 Mon Sep 17 00:00:00 2001 From: nwilde1590 Date: Sun, 25 Jan 2026 18:52:39 -0600 Subject: [PATCH 7/9] Trunk formatting updates --- src/Power.cpp | 2 +- src/PowerFSM.cpp | 2 +- src/graphics/Screen.cpp | 7 ++-- src/graphics/draw/MenuHandler.cpp | 14 ++++---- src/graphics/draw/NotificationRenderer.cpp | 6 ++-- src/modules/BatteryCalibrationModule.cpp | 36 +++++++++---------- src/modules/BatteryCalibrationModule.h | 3 +- src/modules/BatteryCalibrationSampler.cpp | 5 ++- .../nrf52840/heltec_mesh_node_t114/variant.h | 2 +- 9 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index c88730048c7..c011741323b 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -179,7 +179,7 @@ Power *power; using namespace meshtastic; -// pulls saved OCV array from config +// pulls saved OCV array from config namespace { bool copyOcvFromConfig(uint16_t *dest, size_t len) diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index eb29b21aaf1..3de8a424b06 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -68,7 +68,7 @@ static void sdsEnter() static void lowBattSDSEnter() { LOG_POWERFSM("State: Lower batt SDS"); -// Save OCV array to persistent memory if in battery calibration +// Save OCV array to persistent memory if in battery calibration #if HAS_SCREEN && !MESHTASTIC_EXCLUDE_BATTERY_CALIBRATION if (batteryCalibrationModule && batteryCalibrationModule->persistCalibrationOcv()) { nodeDB->saveToDisk(SEGMENT_CONFIG); diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index f45356d9def..98ecba534ec 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -156,7 +156,7 @@ void Screen::showOverlayBanner(BannerOverlayOptions banner_overlay_options) #ifdef USE_EINK EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); // Skip full refresh for all overlay menus #endif - NotificationRenderer::bannerGeneration++; // bugfix for external modules + NotificationRenderer::bannerGeneration++; // bugfix for external modules // Store the message and set the expiration timestamp strncpy(NotificationRenderer::alertBannerMessage, banner_overlay_options.message, 255); NotificationRenderer::alertBannerMessage[255] = '\0'; // Ensure null termination @@ -228,7 +228,7 @@ void Screen::showTextInput(const char *header, const char *initialText, uint32_t std::function textCallback) { LOG_INFO("showTextInput called with header='%s', durationMs=%d", header ? header : "NULL", durationMs); - + NotificationRenderer::bannerGeneration++; // Start OnScreenKeyboardModule session (non-touch variant) @@ -1748,8 +1748,7 @@ int Screen::handleInputEvent(const InputEvent *event) this->ui->getUiState()->currentFrame == framesetInfo.positions.home) { cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST); } else if (event->inputEvent == INPUT_BROKER_SELECT) { - if (batteryCalibrationModule && - this->ui->getUiState()->currentFrame < moduleFrames.size() && + if (batteryCalibrationModule && this->ui->getUiState()->currentFrame < moduleFrames.size() && moduleFrames.at(this->ui->getUiState()->currentFrame) == batteryCalibrationModule) { menuHandler::batteryCalibrationMenu(); } else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) { diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 7169b5a8ee1..562a0dfa780 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -19,10 +19,10 @@ #include "mesh/Default.h" #include "mesh/MeshTypes.h" #include "modules/AdminModule.h" -#include "modules/CannedMessageModule.h" -#include "modules/ExternalNotificationModule.h" #include "modules/BatteryCalibrationModule.h" #include "modules/BatteryCalibrationSampler.h" +#include "modules/CannedMessageModule.h" +#include "modules/ExternalNotificationModule.h" #include "modules/KeyVerificationModule.h" #include "modules/TraceRouteModule.h" #include @@ -2445,8 +2445,8 @@ void menuHandler::powerMenu() void menuHandler::batteryCalibrationMenu() { - static const char *optionsArrayIdle[] = { "Back", "Begin Calibration", "Reset OCV Array" }; - static const char *optionsArrayActive[] = { "Back", "Stop Calibration", "Reset OCV Array", "Save OCV & End" }; + static const char *optionsArrayIdle[] = {"Back", "Begin Calibration", "Reset OCV Array"}; + static const char *optionsArrayActive[] = {"Back", "Stop Calibration", "Reset OCV Array", "Save OCV & End"}; enum optionsNumbers { Back = 0, Start = 1, Reset = 2, Apply = 3 }; BannerOverlayOptions bannerOptions; @@ -2495,12 +2495,11 @@ void menuHandler::batteryCalibrationMenu() } }; screen->showOverlayBanner(bannerOptions); - } void menuHandler::batteryCalibrationConfirmMenu() { - static const char *optionsArray[] = { "Back", "Start Calibration" }; + static const char *optionsArray[] = {"Back", "Start Calibration"}; enum optionsNumbers { Back = 0, Start = 1 }; BannerOverlayOptions bannerOptions; @@ -2514,7 +2513,8 @@ void menuHandler::batteryCalibrationConfirmMenu() if (selected == Start) { if (batteryCalibrationModule) { batteryCalibrationModule->startCalibration(); - IF_SCREEN(screen->showSimpleBanner("Calibration started.\nUse device as normal.\nDo not charge until battery dies.", 5000)); + IF_SCREEN(screen->showSimpleBanner( + "Calibration started.\nUse device as normal.\nDo not charge until battery dies.", 5000)); } else if (batteryCalibrationSampler) { batteryCalibrationSampler->resetSamples(); } diff --git a/src/graphics/draw/NotificationRenderer.cpp b/src/graphics/draw/NotificationRenderer.cpp index f7f8205907f..4167a544711 100644 --- a/src/graphics/draw/NotificationRenderer.cpp +++ b/src/graphics/draw/NotificationRenderer.cpp @@ -282,7 +282,8 @@ void NotificationRenderer::drawNodePicker(OLEDDisplay *display, OLEDDisplayUiSta resetBanner(); } else { inEvent.inputEvent = INPUT_BROKER_NONE; - } return; + } + return; } else if ((inEvent.inputEvent == INPUT_BROKER_CANCEL || inEvent.inputEvent == INPUT_BROKER_ALT_LONG) && alertBannerUntil != 0) { resetBanner(); @@ -408,7 +409,8 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp resetBanner(); } else { inEvent.inputEvent = INPUT_BROKER_NONE; - } return; + } + return; } else if ((inEvent.inputEvent == INPUT_BROKER_CANCEL || inEvent.inputEvent == INPUT_BROKER_ALT_LONG) && alertBannerUntil != 0) { resetBanner(); diff --git a/src/modules/BatteryCalibrationModule.cpp b/src/modules/BatteryCalibrationModule.cpp index 0aee1d34b64..3a2631393f1 100644 --- a/src/modules/BatteryCalibrationModule.cpp +++ b/src/modules/BatteryCalibrationModule.cpp @@ -1,14 +1,12 @@ #include "BatteryCalibrationModule.h" -#include "graphics/SharedUIDisplay.h" #include "graphics/ScreenFonts.h" +#include "graphics/SharedUIDisplay.h" #include "power.h" #include - BatteryCalibrationModule *batteryCalibrationModule; -BatteryCalibrationModule::BatteryCalibrationModule() - : SinglePortModule("battery-calibration", meshtastic_PortNum_PRIVATE_APP) +BatteryCalibrationModule::BatteryCalibrationModule() : SinglePortModule("battery-calibration", meshtastic_PortNum_PRIVATE_APP) { batteryCalibrationModule = this; } @@ -81,8 +79,7 @@ bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *ocvOut, size_t oc } auto sampleAt = [&](uint16_t logicalIndex) -> const BatteryCalibrationSampler::BatterySample & { - const uint16_t sampleIndex = - static_cast((sampleStart + logicalIndex) % BatteryCalibrationSampler::kMaxSamples); + const uint16_t sampleIndex = static_cast((sampleStart + logicalIndex) % BatteryCalibrationSampler::kMaxSamples); return samples[sampleIndex]; }; @@ -108,8 +105,7 @@ bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *ocvOut, size_t oc const BatteryCalibrationSampler::BatterySample *prevSample = &sampleAt(0); const BatteryCalibrationSampler::BatterySample *nextSample = nullptr; for (uint16_t j = 1; j < sampleCount; ++j) { - const uint16_t sampleIndex = - static_cast((sampleStart + j) % BatteryCalibrationSampler::kMaxSamples); + const uint16_t sampleIndex = static_cast((sampleStart + j) % BatteryCalibrationSampler::kMaxSamples); const BatteryCalibrationSampler::BatterySample *candidate = &samples[sampleIndex]; if (candidate->timestampMs >= targetTimestamp) { nextSample = candidate; @@ -127,9 +123,8 @@ bool BatteryCalibrationModule::computeOcvFromSamples(uint16_t *ocvOut, size_t oc continue; } - const float timeFraction = - static_cast(targetTimestamp - prevSample->timestampMs) / - static_cast(nextSample->timestampMs - prevSample->timestampMs); + const float timeFraction = static_cast(targetTimestamp - prevSample->timestampMs) / + static_cast(nextSample->timestampMs - prevSample->timestampMs); const float voltage = static_cast(prevSample->voltageMv) + timeFraction * (static_cast(nextSample->voltageMv) - static_cast(prevSample->voltageMv)); @@ -160,10 +155,10 @@ void BatteryCalibrationModule::computeGraphBounds(OLEDDisplay *display, int16_t } } -void BatteryCalibrationModule::drawBatteryGraph(OLEDDisplay *display, int16_t graphX, int16_t graphY, int16_t graphW, int16_t graphH, - const BatteryCalibrationSampler::BatterySample *samples, uint16_t sampleCount, - uint16_t sampleStart, uint32_t minMv, uint32_t maxMv) - { +void BatteryCalibrationModule::drawBatteryGraph(OLEDDisplay *display, int16_t graphX, int16_t graphY, int16_t graphW, + int16_t graphH, const BatteryCalibrationSampler::BatterySample *samples, + uint16_t sampleCount, uint16_t sampleStart, uint32_t minMv, uint32_t maxMv) +{ if (!samples || sampleCount < 2 || graphW <= 1 || graphH <= 1 || maxMv <= minMv) { return; } @@ -186,7 +181,8 @@ void BatteryCalibrationModule::drawBatteryGraph(OLEDDisplay *display, int16_t gr auto voltageToY = [&](uint16_t voltageMv) -> int16_t { const uint32_t denom = (rangeMv == 0) ? 1 : rangeMv; - const int32_t scaled = static_cast(static_cast(voltageMv) - static_cast(minMv)) * ySpan / denom; + const int32_t scaled = + static_cast(static_cast(voltageMv) - static_cast(minMv)) * ySpan / denom; const int16_t yValue = static_cast(graphY + ySpan - scaled); return clampY(yValue); }; @@ -223,9 +219,9 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat if (hasBattery) { const int batV = powerStatus->getBatteryVoltageMv() / 1000; const int batCv = (powerStatus->getBatteryVoltageMv() % 1000) / 10; - const int batMv = powerStatus->getBatteryVoltageMv(); //just for debug use mV - //snprintf(voltageStr, sizeof(voltageStr), "%01d.%02dV", batV, batCv); - snprintf(voltageStr, sizeof(voltageStr), "%04dmV", batMv); //just for debug use mV + const int batMv = powerStatus->getBatteryVoltageMv(); // just for debug use mV + // snprintf(voltageStr, sizeof(voltageStr), "%01d.%02dV", batV, batCv); + snprintf(voltageStr, sizeof(voltageStr), "%04dmV", batMv); // just for debug use mV } else { snprintf(voltageStr, sizeof(voltageStr), "USB"); } @@ -279,7 +275,7 @@ void BatteryCalibrationModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiStat display->drawString(labelX, lineY, calibratingLabel); } } - + int16_t graphX = 0; int16_t graphY = 0; int16_t graphW = 0; diff --git a/src/modules/BatteryCalibrationModule.h b/src/modules/BatteryCalibrationModule.h index 8b275003dbc..81ed54fe756 100644 --- a/src/modules/BatteryCalibrationModule.h +++ b/src/modules/BatteryCalibrationModule.h @@ -1,7 +1,7 @@ #pragma once -#include "SinglePortModule.h" #include "BatteryCalibrationSampler.h" +#include "SinglePortModule.h" #include "power.h" class BatteryCalibrationModule : public SinglePortModule @@ -34,6 +34,5 @@ class BatteryCalibrationModule : public SinglePortModule const BatteryCalibrationSampler::BatterySample *samples, uint16_t sampleCount, uint16_t sampleStart, uint32_t minMv, uint32_t maxMv); #endif - }; extern BatteryCalibrationModule *batteryCalibrationModule; \ No newline at end of file diff --git a/src/modules/BatteryCalibrationSampler.cpp b/src/modules/BatteryCalibrationSampler.cpp index 491fb880b1b..fe862b26909 100644 --- a/src/modules/BatteryCalibrationSampler.cpp +++ b/src/modules/BatteryCalibrationSampler.cpp @@ -4,9 +4,9 @@ #if HAS_SCREEN -#include #include "mesh/NodeDB.h" #include "power.h" +#include BatteryCalibrationSampler *batteryCalibrationSampler; @@ -71,8 +71,7 @@ void BatteryCalibrationSampler::downsampleSamples() const uint16_t firstIndex = static_cast((sampleStart + (2 * i)) % kMaxSamples); const uint16_t secondIndex = static_cast((sampleStart + (2 * i + 1)) % kMaxSamples); const uint32_t avgVoltage = - (static_cast(samples[firstIndex].voltageMv) + static_cast(samples[secondIndex].voltageMv)) / - 2U; + (static_cast(samples[firstIndex].voltageMv) + static_cast(samples[secondIndex].voltageMv)) / 2U; const uint32_t avgTimestamp = (samples[firstIndex].timestampMs + samples[secondIndex].timestampMs) / 2U; samples[i].voltageMv = static_cast(avgVoltage); samples[i].timestampMs = avgTimestamp; diff --git a/variants/nrf52840/heltec_mesh_node_t114/variant.h b/variants/nrf52840/heltec_mesh_node_t114/variant.h index fb7f61ac744..cf14b5e04c7 100644 --- a/variants/nrf52840/heltec_mesh_node_t114/variant.h +++ b/variants/nrf52840/heltec_mesh_node_t114/variant.h @@ -156,7 +156,7 @@ No longer populated on PCB // The bluetooth transmit power on the nRF52840 is adjustable from -20dB to +8dB in steps of 4dB // so NRF52_BLE_TX_POWER can be set to -20, -16, -12, -8, -4, 0 (default), 4, and 8. -//#define NRF52_BLE_TX_POWER 8 +// #define NRF52_BLE_TX_POWER 8 /* * GPS pins From 2ade35e443eba0c58fe5de9f2f767d90fa0562d9 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Wed, 28 Jan 2026 16:12:00 -0600 Subject: [PATCH 8/9] Revert generated protobufs to develop branch --- src/mesh/generated/meshtastic/admin.pb.cpp | 11 +- src/mesh/generated/meshtastic/admin.pb.h | 105 +++++++++++++++++- src/mesh/generated/meshtastic/apponly.pb.cpp | 2 +- src/mesh/generated/meshtastic/apponly.pb.h | 2 +- src/mesh/generated/meshtastic/atak.pb.cpp | 2 +- src/mesh/generated/meshtastic/atak.pb.h | 2 +- .../meshtastic/cannedmessages.pb.cpp | 2 +- .../generated/meshtastic/cannedmessages.pb.h | 2 +- src/mesh/generated/meshtastic/channel.pb.cpp | 2 +- src/mesh/generated/meshtastic/channel.pb.h | 2 +- .../generated/meshtastic/clientonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/clientonly.pb.h | 2 +- src/mesh/generated/meshtastic/config.pb.cpp | 2 +- src/mesh/generated/meshtastic/config.pb.h | 14 +-- .../meshtastic/connection_status.pb.cpp | 2 +- .../meshtastic/connection_status.pb.h | 2 +- .../generated/meshtastic/device_ui.pb.cpp | 2 +- src/mesh/generated/meshtastic/device_ui.pb.h | 2 +- .../generated/meshtastic/deviceonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 4 +- .../generated/meshtastic/interdevice.pb.cpp | 2 +- .../generated/meshtastic/interdevice.pb.h | 2 +- .../generated/meshtastic/localonly.pb.cpp | 2 +- src/mesh/generated/meshtastic/localonly.pb.h | 6 +- src/mesh/generated/meshtastic/mesh.pb.cpp | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 +- .../generated/meshtastic/module_config.pb.cpp | 2 +- .../generated/meshtastic/module_config.pb.h | 2 +- src/mesh/generated/meshtastic/mqtt.pb.cpp | 2 +- src/mesh/generated/meshtastic/mqtt.pb.h | 2 +- src/mesh/generated/meshtastic/paxcount.pb.cpp | 2 +- src/mesh/generated/meshtastic/paxcount.pb.h | 2 +- src/mesh/generated/meshtastic/portnums.pb.cpp | 2 +- src/mesh/generated/meshtastic/portnums.pb.h | 2 +- src/mesh/generated/meshtastic/powermon.pb.cpp | 2 +- src/mesh/generated/meshtastic/powermon.pb.h | 2 +- .../meshtastic/remote_hardware.pb.cpp | 2 +- .../generated/meshtastic/remote_hardware.pb.h | 2 +- src/mesh/generated/meshtastic/rtttl.pb.cpp | 2 +- src/mesh/generated/meshtastic/rtttl.pb.h | 2 +- .../generated/meshtastic/storeforward.pb.cpp | 2 +- .../generated/meshtastic/storeforward.pb.h | 2 +- .../generated/meshtastic/telemetry.pb.cpp | 5 +- src/mesh/generated/meshtastic/telemetry.pb.h | 43 ++++++- src/mesh/generated/meshtastic/xmodem.pb.cpp | 2 +- src/mesh/generated/meshtastic/xmodem.pb.h | 2 +- 46 files changed, 207 insertions(+), 59 deletions(-) diff --git a/src/mesh/generated/meshtastic/admin.pb.cpp b/src/mesh/generated/meshtastic/admin.pb.cpp index 5ce49e7afc3..01d3fa91020 100644 --- a/src/mesh/generated/meshtastic/admin.pb.cpp +++ b/src/mesh/generated/meshtastic/admin.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/admin.pb.h" #if PB_PROTO_HEADER_VERSION != 40 @@ -27,6 +27,15 @@ PB_BIND(meshtastic_SharedContact, meshtastic_SharedContact, AUTO) PB_BIND(meshtastic_KeyVerificationAdmin, meshtastic_KeyVerificationAdmin, AUTO) +PB_BIND(meshtastic_SensorConfig, meshtastic_SensorConfig, AUTO) + + +PB_BIND(meshtastic_SCD4X_config, meshtastic_SCD4X_config, AUTO) + + +PB_BIND(meshtastic_SEN5X_config, meshtastic_SEN5X_config, AUTO) + + diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index bb06eb5488f..f545ed9bf44 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED @@ -171,6 +171,48 @@ typedef struct _meshtastic_KeyVerificationAdmin { uint32_t security_number; } meshtastic_KeyVerificationAdmin; +typedef struct _meshtastic_SCD4X_config { + /* Set Automatic self-calibration enabled */ + bool has_set_asc; + bool set_asc; + /* Recalibration target CO2 concentration in ppm (FRC or ASC) */ + bool has_set_target_co2_conc; + uint32_t set_target_co2_conc; + /* Reference temperature in degC */ + bool has_set_temperature; + float set_temperature; + /* Altitude of sensor in meters above sea level. 0 - 3000m (overrides ambient pressure) */ + bool has_set_altitude; + uint32_t set_altitude; + /* Sensor ambient pressure in Pa. 70000 - 120000 Pa (overrides altitude) */ + bool has_set_ambient_pressure; + uint32_t set_ambient_pressure; + /* Perform a factory reset of the sensor */ + bool has_factory_reset; + bool factory_reset; + /* Power mode for sensor (true for low power, false for normal) */ + bool has_set_power_mode; + bool set_power_mode; +} meshtastic_SCD4X_config; + +typedef struct _meshtastic_SEN5X_config { + /* Reference temperature in degC */ + bool has_set_temperature; + float set_temperature; + /* One-shot mode (true for low power - one-shot mode, false for normal - continuous mode) */ + bool has_set_one_shot_mode; + bool set_one_shot_mode; +} meshtastic_SEN5X_config; + +typedef struct _meshtastic_SensorConfig { + /* SCD4X CO2 Sensor configuration */ + bool has_scd4x_config; + meshtastic_SCD4X_config scd4x_config; + /* SEN5X PM Sensor configuration */ + bool has_sen5x_config; + meshtastic_SEN5X_config sen5x_config; +} meshtastic_SensorConfig; + typedef PB_BYTES_ARRAY_T(8) meshtastic_AdminMessage_session_passkey_t; /* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. This message is used to do settings operations to both remote AND local nodes. @@ -303,6 +345,8 @@ typedef struct _meshtastic_AdminMessage { bool nodedb_reset; /* Tell the node to reset into the OTA Loader */ meshtastic_AdminMessage_OTAEvent ota_request; + /* Parameters and sensor configuration */ + meshtastic_SensorConfig sensor_config; }; /* The node generates this key and sends it with any get_x_response packets. The client MUST include the same key with any set_x commands. Key expires after 300 seconds. @@ -351,6 +395,9 @@ extern "C" { #define meshtastic_KeyVerificationAdmin_message_type_ENUMTYPE meshtastic_KeyVerificationAdmin_MessageType + + + /* Initializer values for message structs */ #define meshtastic_AdminMessage_init_default {0, {0}, {0, {0}}} #define meshtastic_AdminMessage_InputEvent_init_default {0, 0, 0, 0} @@ -359,6 +406,9 @@ extern "C" { #define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}} #define meshtastic_SharedContact_init_default {0, false, meshtastic_User_init_default, 0, 0} #define meshtastic_KeyVerificationAdmin_init_default {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0} +#define meshtastic_SensorConfig_init_default {false, meshtastic_SCD4X_config_init_default, false, meshtastic_SEN5X_config_init_default} +#define meshtastic_SCD4X_config_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_SEN5X_config_init_default {false, 0, false, 0} #define meshtastic_AdminMessage_init_zero {0, {0}, {0, {0}}} #define meshtastic_AdminMessage_InputEvent_init_zero {0, 0, 0, 0} #define meshtastic_AdminMessage_OTAEvent_init_zero {_meshtastic_OTAMode_MIN, {0, {0}}} @@ -366,6 +416,9 @@ extern "C" { #define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}} #define meshtastic_SharedContact_init_zero {0, false, meshtastic_User_init_zero, 0, 0} #define meshtastic_KeyVerificationAdmin_init_zero {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0} +#define meshtastic_SensorConfig_init_zero {false, meshtastic_SCD4X_config_init_zero, false, meshtastic_SEN5X_config_init_zero} +#define meshtastic_SCD4X_config_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_SEN5X_config_init_zero {false, 0, false, 0} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_AdminMessage_InputEvent_event_code_tag 1 @@ -387,6 +440,17 @@ extern "C" { #define meshtastic_KeyVerificationAdmin_remote_nodenum_tag 2 #define meshtastic_KeyVerificationAdmin_nonce_tag 3 #define meshtastic_KeyVerificationAdmin_security_number_tag 4 +#define meshtastic_SCD4X_config_set_asc_tag 1 +#define meshtastic_SCD4X_config_set_target_co2_conc_tag 2 +#define meshtastic_SCD4X_config_set_temperature_tag 3 +#define meshtastic_SCD4X_config_set_altitude_tag 4 +#define meshtastic_SCD4X_config_set_ambient_pressure_tag 5 +#define meshtastic_SCD4X_config_factory_reset_tag 6 +#define meshtastic_SCD4X_config_set_power_mode_tag 7 +#define meshtastic_SEN5X_config_set_temperature_tag 1 +#define meshtastic_SEN5X_config_set_one_shot_mode_tag 2 +#define meshtastic_SensorConfig_scd4x_config_tag 1 +#define meshtastic_SensorConfig_sen5x_config_tag 2 #define meshtastic_AdminMessage_get_channel_request_tag 1 #define meshtastic_AdminMessage_get_channel_response_tag 2 #define meshtastic_AdminMessage_get_owner_request_tag 3 @@ -443,6 +507,7 @@ extern "C" { #define meshtastic_AdminMessage_factory_reset_config_tag 99 #define meshtastic_AdminMessage_nodedb_reset_tag 100 #define meshtastic_AdminMessage_ota_request_tag 102 +#define meshtastic_AdminMessage_sensor_config_tag 103 #define meshtastic_AdminMessage_session_passkey_tag 101 /* Struct field encoding specification for nanopb */ @@ -503,7 +568,8 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,shutdown_seconds,shutdown_se X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_config,factory_reset_config), 99) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,nodedb_reset,nodedb_reset), 100) \ X(a, STATIC, SINGULAR, BYTES, session_passkey, 101) \ -X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ota_request,ota_request), 102) +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ota_request,ota_request), 102) \ +X(a, STATIC, ONEOF, MESSAGE, (payload_variant,sensor_config,sensor_config), 103) #define meshtastic_AdminMessage_CALLBACK NULL #define meshtastic_AdminMessage_DEFAULT NULL #define meshtastic_AdminMessage_payload_variant_get_channel_response_MSGTYPE meshtastic_Channel @@ -525,6 +591,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ota_request,ota_request), 10 #define meshtastic_AdminMessage_payload_variant_add_contact_MSGTYPE meshtastic_SharedContact #define meshtastic_AdminMessage_payload_variant_key_verification_MSGTYPE meshtastic_KeyVerificationAdmin #define meshtastic_AdminMessage_payload_variant_ota_request_MSGTYPE meshtastic_AdminMessage_OTAEvent +#define meshtastic_AdminMessage_payload_variant_sensor_config_MSGTYPE meshtastic_SensorConfig #define meshtastic_AdminMessage_InputEvent_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, event_code, 1) \ @@ -571,6 +638,31 @@ X(a, STATIC, OPTIONAL, UINT32, security_number, 4) #define meshtastic_KeyVerificationAdmin_CALLBACK NULL #define meshtastic_KeyVerificationAdmin_DEFAULT NULL +#define meshtastic_SensorConfig_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, MESSAGE, scd4x_config, 1) \ +X(a, STATIC, OPTIONAL, MESSAGE, sen5x_config, 2) +#define meshtastic_SensorConfig_CALLBACK NULL +#define meshtastic_SensorConfig_DEFAULT NULL +#define meshtastic_SensorConfig_scd4x_config_MSGTYPE meshtastic_SCD4X_config +#define meshtastic_SensorConfig_sen5x_config_MSGTYPE meshtastic_SEN5X_config + +#define meshtastic_SCD4X_config_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, BOOL, set_asc, 1) \ +X(a, STATIC, OPTIONAL, UINT32, set_target_co2_conc, 2) \ +X(a, STATIC, OPTIONAL, FLOAT, set_temperature, 3) \ +X(a, STATIC, OPTIONAL, UINT32, set_altitude, 4) \ +X(a, STATIC, OPTIONAL, UINT32, set_ambient_pressure, 5) \ +X(a, STATIC, OPTIONAL, BOOL, factory_reset, 6) \ +X(a, STATIC, OPTIONAL, BOOL, set_power_mode, 7) +#define meshtastic_SCD4X_config_CALLBACK NULL +#define meshtastic_SCD4X_config_DEFAULT NULL + +#define meshtastic_SEN5X_config_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, FLOAT, set_temperature, 1) \ +X(a, STATIC, OPTIONAL, BOOL, set_one_shot_mode, 2) +#define meshtastic_SEN5X_config_CALLBACK NULL +#define meshtastic_SEN5X_config_DEFAULT NULL + extern const pb_msgdesc_t meshtastic_AdminMessage_msg; extern const pb_msgdesc_t meshtastic_AdminMessage_InputEvent_msg; extern const pb_msgdesc_t meshtastic_AdminMessage_OTAEvent_msg; @@ -578,6 +670,9 @@ extern const pb_msgdesc_t meshtastic_HamParameters_msg; extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg; extern const pb_msgdesc_t meshtastic_SharedContact_msg; extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg; +extern const pb_msgdesc_t meshtastic_SensorConfig_msg; +extern const pb_msgdesc_t meshtastic_SCD4X_config_msg; +extern const pb_msgdesc_t meshtastic_SEN5X_config_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg @@ -587,6 +682,9 @@ extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg; #define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg #define meshtastic_SharedContact_fields &meshtastic_SharedContact_msg #define meshtastic_KeyVerificationAdmin_fields &meshtastic_KeyVerificationAdmin_msg +#define meshtastic_SensorConfig_fields &meshtastic_SensorConfig_msg +#define meshtastic_SCD4X_config_fields &meshtastic_SCD4X_config_msg +#define meshtastic_SEN5X_config_fields &meshtastic_SEN5X_config_msg /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size @@ -596,6 +694,9 @@ extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg; #define meshtastic_HamParameters_size 31 #define meshtastic_KeyVerificationAdmin_size 25 #define meshtastic_NodeRemoteHardwarePinsResponse_size 496 +#define meshtastic_SCD4X_config_size 29 +#define meshtastic_SEN5X_config_size 7 +#define meshtastic_SensorConfig_size 40 #define meshtastic_SharedContact_size 127 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/apponly.pb.cpp b/src/mesh/generated/meshtastic/apponly.pb.cpp index 64d43b7ee1c..8b1b3da19e2 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.cpp +++ b/src/mesh/generated/meshtastic/apponly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/apponly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/apponly.pb.h b/src/mesh/generated/meshtastic/apponly.pb.h index dc08d9ff35d..f4c33bd7937 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.h +++ b/src/mesh/generated/meshtastic/apponly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/atak.pb.cpp b/src/mesh/generated/meshtastic/atak.pb.cpp index 6dbc69fb4c5..a0368cf6b22 100644 --- a/src/mesh/generated/meshtastic/atak.pb.cpp +++ b/src/mesh/generated/meshtastic/atak.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/atak.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/atak.pb.h b/src/mesh/generated/meshtastic/atak.pb.h index 15a86788b38..8533bcbf9de 100644 --- a/src/mesh/generated/meshtastic/atak.pb.h +++ b/src/mesh/generated/meshtastic/atak.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.cpp b/src/mesh/generated/meshtastic/cannedmessages.pb.cpp index 9f51e9634d9..1f4ebc9271e 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.cpp +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/cannedmessages.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.h b/src/mesh/generated/meshtastic/cannedmessages.pb.h index 06d14b98f42..8343c4d6ebf 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.h +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/channel.pb.cpp b/src/mesh/generated/meshtastic/channel.pb.cpp index 52f923b1352..6670a40fc12 100644 --- a/src/mesh/generated/meshtastic/channel.pb.cpp +++ b/src/mesh/generated/meshtastic/channel.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/channel.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/channel.pb.h b/src/mesh/generated/meshtastic/channel.pb.h index d03a8cec9ca..9dc757ab4a5 100644 --- a/src/mesh/generated/meshtastic/channel.pb.h +++ b/src/mesh/generated/meshtastic/channel.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/clientonly.pb.cpp b/src/mesh/generated/meshtastic/clientonly.pb.cpp index d99af8cf5d2..8f380a9720f 100644 --- a/src/mesh/generated/meshtastic/clientonly.pb.cpp +++ b/src/mesh/generated/meshtastic/clientonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/clientonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/clientonly.pb.h b/src/mesh/generated/meshtastic/clientonly.pb.h index bf32d787569..5109e20b20f 100644 --- a/src/mesh/generated/meshtastic/clientonly.pb.h +++ b/src/mesh/generated/meshtastic/clientonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/config.pb.cpp b/src/mesh/generated/meshtastic/config.pb.cpp index 2318717e18d..52a591f3368 100644 --- a/src/mesh/generated/meshtastic/config.pb.cpp +++ b/src/mesh/generated/meshtastic/config.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index 52e4072630a..d93f6fafa97 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CONFIG_PB_H_INCLUDED @@ -429,10 +429,6 @@ typedef struct _meshtastic_Config_PowerConfig { uint32_t min_wake_secs; /* I2C address of INA_2XX to use for reading device battery voltage */ uint8_t device_battery_ina_address; - /* Open circuit voltage array (in millivolts) for battery percentage estimation. - Provide NUM_OCV_POINTS entries from full to empty. If unset, device defaults are used. */ - pb_size_t ocv_count; - uint16_t ocv[11]; /* If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled. Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options. */ uint64_t powermon_enables; @@ -733,7 +729,7 @@ extern "C" { #define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}} #define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN} #define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} -#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0} +#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_DeprecatedGpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0, 0} @@ -744,7 +740,7 @@ extern "C" { #define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}} #define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0, _meshtastic_Config_DeviceConfig_BuzzerMode_MIN} #define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} -#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0} +#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0, 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_DeprecatedGpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0, 0} @@ -787,7 +783,6 @@ extern "C" { #define meshtastic_Config_PowerConfig_ls_secs_tag 7 #define meshtastic_Config_PowerConfig_min_wake_secs_tag 8 #define meshtastic_Config_PowerConfig_device_battery_ina_address_tag 9 -#define meshtastic_Config_PowerConfig_ocv_tag 10 #define meshtastic_Config_PowerConfig_powermon_enables_tag 32 #define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1 #define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2 @@ -922,7 +917,6 @@ 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) \ X(a, STATIC, SINGULAR, UINT32, device_battery_ina_address, 9) \ -X(a, STATIC, REPEATED, UINT32, ocv, 10) \ X(a, STATIC, SINGULAR, UINT64, powermon_enables, 32) #define meshtastic_Config_PowerConfig_CALLBACK NULL #define meshtastic_Config_PowerConfig_DEFAULT NULL @@ -1046,7 +1040,7 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg; #define meshtastic_Config_NetworkConfig_IpV4Config_size 20 #define meshtastic_Config_NetworkConfig_size 204 #define meshtastic_Config_PositionConfig_size 62 -#define meshtastic_Config_PowerConfig_size 96 +#define meshtastic_Config_PowerConfig_size 52 #define meshtastic_Config_SecurityConfig_size 178 #define meshtastic_Config_SessionkeyConfig_size 0 #define meshtastic_Config_size 207 diff --git a/src/mesh/generated/meshtastic/connection_status.pb.cpp b/src/mesh/generated/meshtastic/connection_status.pb.cpp index d1495bb8324..b0df459ad3a 100644 --- a/src/mesh/generated/meshtastic/connection_status.pb.cpp +++ b/src/mesh/generated/meshtastic/connection_status.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/connection_status.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/connection_status.pb.h b/src/mesh/generated/meshtastic/connection_status.pb.h index c433e370b1c..55559dcefb4 100644 --- a/src/mesh/generated/meshtastic/connection_status.pb.h +++ b/src/mesh/generated/meshtastic/connection_status.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_CONNECTION_STATUS_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/device_ui.pb.cpp b/src/mesh/generated/meshtastic/device_ui.pb.cpp index b5a37408fb8..01940265f95 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.cpp +++ b/src/mesh/generated/meshtastic/device_ui.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/device_ui.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/device_ui.pb.h b/src/mesh/generated/meshtastic/device_ui.pb.h index d23675090f2..b99fb10b93b 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.h +++ b/src/mesh/generated/meshtastic/device_ui.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.cpp b/src/mesh/generated/meshtastic/deviceonly.pb.cpp index ea3f79eb625..5a96957027d 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.cpp +++ b/src/mesh/generated/meshtastic/deviceonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/deviceonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 04b05c3c2d2..57e7df8fc0d 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED @@ -361,7 +361,7 @@ extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Maximum encoded size of messages (where known) */ /* meshtastic_NodeDatabase_size depends on runtime parameters */ #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size -#define meshtastic_BackupPreferences_size 2406 +#define meshtastic_BackupPreferences_size 2362 #define meshtastic_ChannelFile_size 718 #define meshtastic_DeviceState_size 1737 #define meshtastic_NodeInfoLite_size 196 diff --git a/src/mesh/generated/meshtastic/interdevice.pb.cpp b/src/mesh/generated/meshtastic/interdevice.pb.cpp index 7ed583cc6a1..e3913f78c9d 100644 --- a/src/mesh/generated/meshtastic/interdevice.pb.cpp +++ b/src/mesh/generated/meshtastic/interdevice.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/interdevice.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/interdevice.pb.h b/src/mesh/generated/meshtastic/interdevice.pb.h index 8bc22a1f4ba..c381438ebe6 100644 --- a/src/mesh/generated/meshtastic/interdevice.pb.h +++ b/src/mesh/generated/meshtastic/interdevice.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/localonly.pb.cpp b/src/mesh/generated/meshtastic/localonly.pb.cpp index 0a752a5a80a..34391df73e1 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.cpp +++ b/src/mesh/generated/meshtastic/localonly.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/localonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index 8a190ca652b..f11b1341946 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED @@ -192,8 +192,8 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; #define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size -#define meshtastic_LocalConfig_size 793 +#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size +#define meshtastic_LocalConfig_size 749 #define meshtastic_LocalModuleConfig_size 758 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/mesh.pb.cpp b/src/mesh/generated/meshtastic/mesh.pb.cpp index 3aa59448771..7f1a738c652 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.cpp +++ b/src/mesh/generated/meshtastic/mesh.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 47acfb2c753..aeae4bd8456 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/module_config.pb.cpp b/src/mesh/generated/meshtastic/module_config.pb.cpp index 6d4e48dc50d..bb57c3f2db0 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.cpp +++ b/src/mesh/generated/meshtastic/module_config.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index cf81e2bc9b7..46a7164d246 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MODULE_CONFIG_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/mqtt.pb.cpp b/src/mesh/generated/meshtastic/mqtt.pb.cpp index 74536cb79d1..2c32ef2e47e 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.cpp +++ b/src/mesh/generated/meshtastic/mqtt.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/mqtt.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/mqtt.pb.h b/src/mesh/generated/meshtastic/mqtt.pb.h index 922be711dd9..c5b10f1f586 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.h +++ b/src/mesh/generated/meshtastic/mqtt.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/paxcount.pb.cpp b/src/mesh/generated/meshtastic/paxcount.pb.cpp index 40328814711..ff738bde906 100644 --- a/src/mesh/generated/meshtastic/paxcount.pb.cpp +++ b/src/mesh/generated/meshtastic/paxcount.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/paxcount.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/paxcount.pb.h b/src/mesh/generated/meshtastic/paxcount.pb.h index b6b51fdd5e9..06078aef795 100644 --- a/src/mesh/generated/meshtastic/paxcount.pb.h +++ b/src/mesh/generated/meshtastic/paxcount.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_PAXCOUNT_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_PAXCOUNT_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/portnums.pb.cpp b/src/mesh/generated/meshtastic/portnums.pb.cpp index 8fca9af793e..15a6ba372f0 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.cpp +++ b/src/mesh/generated/meshtastic/portnums.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/portnums.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/portnums.pb.h b/src/mesh/generated/meshtastic/portnums.pb.h index e1a52a4d20f..d31daa4b25c 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.h +++ b/src/mesh/generated/meshtastic/portnums.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_PORTNUMS_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/powermon.pb.cpp b/src/mesh/generated/meshtastic/powermon.pb.cpp index 6a9b7551ada..8838e165fc0 100644 --- a/src/mesh/generated/meshtastic/powermon.pb.cpp +++ b/src/mesh/generated/meshtastic/powermon.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/powermon.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/powermon.pb.h b/src/mesh/generated/meshtastic/powermon.pb.h index a1c145f230a..3072b8ac55f 100644 --- a/src/mesh/generated/meshtastic/powermon.pb.h +++ b/src/mesh/generated/meshtastic/powermon.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_POWERMON_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_POWERMON_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.cpp b/src/mesh/generated/meshtastic/remote_hardware.pb.cpp index 239950e7ef3..8942104b5ac 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.cpp +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/remote_hardware.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.h b/src/mesh/generated/meshtastic/remote_hardware.pb.h index ade250e932d..9ab3413c3fd 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.h +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_REMOTE_HARDWARE_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/rtttl.pb.cpp b/src/mesh/generated/meshtastic/rtttl.pb.cpp index 61ad8b73f64..c994741f34a 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.cpp +++ b/src/mesh/generated/meshtastic/rtttl.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/rtttl.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/rtttl.pb.h b/src/mesh/generated/meshtastic/rtttl.pb.h index 0572265f7a3..b6e152dbf88 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.h +++ b/src/mesh/generated/meshtastic/rtttl.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_RTTTL_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/storeforward.pb.cpp b/src/mesh/generated/meshtastic/storeforward.pb.cpp index 71a232bf613..82db566a190 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.cpp +++ b/src/mesh/generated/meshtastic/storeforward.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/storeforward.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/storeforward.pb.h b/src/mesh/generated/meshtastic/storeforward.pb.h index 44ffd098c7d..75cff52058b 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.h +++ b/src/mesh/generated/meshtastic/storeforward.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_STOREFORWARD_PB_H_INCLUDED diff --git a/src/mesh/generated/meshtastic/telemetry.pb.cpp b/src/mesh/generated/meshtastic/telemetry.pb.cpp index fa055a7bb1b..fff75ebc191 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.cpp +++ b/src/mesh/generated/meshtastic/telemetry.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/telemetry.pb.h" #if PB_PROTO_HEADER_VERSION != 40 @@ -33,6 +33,9 @@ PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, 2) PB_BIND(meshtastic_Nau7802Config, meshtastic_Nau7802Config, AUTO) +PB_BIND(meshtastic_SEN5XState, meshtastic_SEN5XState, AUTO) + + diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 7c082d4689e..dc9d876dcc6 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_INCLUDED @@ -435,6 +435,25 @@ typedef struct _meshtastic_Nau7802Config { float calibrationFactor; } meshtastic_Nau7802Config; +/* SEN5X State, for saving to flash */ +typedef struct _meshtastic_SEN5XState { + /* Last cleaning time for SEN5X */ + uint32_t last_cleaning_time; + /* Last cleaning time for SEN5X - valid flag */ + bool last_cleaning_valid; + /* Config flag for one-shot mode (see admin.proto) */ + bool one_shot_mode; + /* Last VOC state time for SEN55 */ + bool has_voc_state_time; + uint32_t voc_state_time; + /* Last VOC state validity flag for SEN55 */ + bool has_voc_state_valid; + bool voc_state_valid; + /* VOC state array (8x uint8t) for SEN55 */ + bool has_voc_state_array; + uint64_t voc_state_array; +} meshtastic_SEN5XState; + #ifdef __cplusplus extern "C" { @@ -455,6 +474,7 @@ extern "C" { + /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} @@ -465,6 +485,7 @@ extern "C" { #define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""} #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_Nau7802Config_init_default {0, 0} +#define meshtastic_SEN5XState_init_default {0, 0, 0, false, 0, false, 0, false, 0} #define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} @@ -474,6 +495,7 @@ extern "C" { #define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} #define meshtastic_Nau7802Config_init_zero {0, 0} +#define meshtastic_SEN5XState_init_zero {0, 0, 0, false, 0, false, 0, false, 0} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_DeviceMetrics_battery_level_tag 1 @@ -581,6 +603,12 @@ extern "C" { #define meshtastic_Telemetry_host_metrics_tag 8 #define meshtastic_Nau7802Config_zeroOffset_tag 1 #define meshtastic_Nau7802Config_calibrationFactor_tag 2 +#define meshtastic_SEN5XState_last_cleaning_time_tag 1 +#define meshtastic_SEN5XState_last_cleaning_valid_tag 2 +#define meshtastic_SEN5XState_one_shot_mode_tag 3 +#define meshtastic_SEN5XState_voc_state_time_tag 4 +#define meshtastic_SEN5XState_voc_state_valid_tag 5 +#define meshtastic_SEN5XState_voc_state_array_tag 6 /* Struct field encoding specification for nanopb */ #define meshtastic_DeviceMetrics_FIELDLIST(X, a) \ @@ -731,6 +759,16 @@ X(a, STATIC, SINGULAR, FLOAT, calibrationFactor, 2) #define meshtastic_Nau7802Config_CALLBACK NULL #define meshtastic_Nau7802Config_DEFAULT NULL +#define meshtastic_SEN5XState_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, last_cleaning_time, 1) \ +X(a, STATIC, SINGULAR, BOOL, last_cleaning_valid, 2) \ +X(a, STATIC, SINGULAR, BOOL, one_shot_mode, 3) \ +X(a, STATIC, OPTIONAL, UINT32, voc_state_time, 4) \ +X(a, STATIC, OPTIONAL, BOOL, voc_state_valid, 5) \ +X(a, STATIC, OPTIONAL, FIXED64, voc_state_array, 6) +#define meshtastic_SEN5XState_CALLBACK NULL +#define meshtastic_SEN5XState_DEFAULT NULL + extern const pb_msgdesc_t meshtastic_DeviceMetrics_msg; extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg; extern const pb_msgdesc_t meshtastic_PowerMetrics_msg; @@ -740,6 +778,7 @@ extern const pb_msgdesc_t meshtastic_HealthMetrics_msg; extern const pb_msgdesc_t meshtastic_HostMetrics_msg; extern const pb_msgdesc_t meshtastic_Telemetry_msg; extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; +extern const pb_msgdesc_t meshtastic_SEN5XState_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_DeviceMetrics_fields &meshtastic_DeviceMetrics_msg @@ -751,6 +790,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_HostMetrics_fields &meshtastic_HostMetrics_msg #define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg #define meshtastic_Nau7802Config_fields &meshtastic_Nau7802Config_msg +#define meshtastic_SEN5XState_fields &meshtastic_SEN5XState_msg /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size @@ -762,6 +802,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_LocalStats_size 87 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 81 +#define meshtastic_SEN5XState_size 27 #define meshtastic_Telemetry_size 272 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/xmodem.pb.cpp b/src/mesh/generated/meshtastic/xmodem.pb.cpp index 3960ccdaa03..09ae41d35b0 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.cpp +++ b/src/mesh/generated/meshtastic/xmodem.pb.cpp @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #include "meshtastic/xmodem.pb.h" #if PB_PROTO_HEADER_VERSION != 40 diff --git a/src/mesh/generated/meshtastic/xmodem.pb.h b/src/mesh/generated/meshtastic/xmodem.pb.h index 76edc0df654..3410fda0f4b 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.h +++ b/src/mesh/generated/meshtastic/xmodem.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.9 */ +/* Generated by nanopb-0.4.9.1 */ #ifndef PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_XMODEM_PB_H_INCLUDED From 356a4e155f0d924b9525e2d8b7aca3ebcd323323 Mon Sep 17 00:00:00 2001 From: noahwilde <47438354+noahwilde@users.noreply.github.com> Date: Fri, 6 Feb 2026 15:07:52 -0600 Subject: [PATCH 9/9] Stopping calibration when resetting --- src/graphics/draw/MenuHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 7a7601cd82e..8bd9bdd9a47 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -2422,6 +2422,7 @@ void menuHandler::batteryCalibrationMenu() } else if (selected == Reset) { if (batteryCalibrationSampler) { batteryCalibrationSampler->resetSamples(); + batteryCalibrationModule->stopCalibration(); } config.power.ocv_count = 0; for (size_t i = 0; i < NUM_OCV_POINTS; ++i) { @@ -2470,6 +2471,7 @@ void menuHandler::batteryCalibrationConfirmMenu() if (batteryCalibrationModule) { batteryCalibrationModule->startCalibration(); IF_SCREEN(screen->showSimpleBanner( + "Calibration started.\nUse device as normal.\nDo not charge until battery dies.", 5000)); } else if (batteryCalibrationSampler) { batteryCalibrationSampler->resetSamples();