cleanup after rebasing

This commit is contained in:
Lorow
2025-10-18 21:23:40 +02:00
parent 26d91abfd4
commit d67c0251fa
3 changed files with 23 additions and 12 deletions
@@ -138,7 +138,7 @@ CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, co
{ {
newMode = StreamingMode::WIFI; newMode = StreamingMode::WIFI;
} }
else if (modeStr == "setup" || modeStr == "auto")) else if (modeStr == "setup" || modeStr == "auto")
{ {
newMode = StreamingMode::SETUP; newMode = StreamingMode::SETUP;
} }
@@ -212,8 +212,13 @@ CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry)
return CommandResult::getErrorResult("MonitoringManager unavailable"); return CommandResult::getErrorResult("MonitoringManager unavailable");
} }
float ma = mon->getCurrentMilliAmps(); float ma = mon->getCurrentMilliAmps();
auto result = std::format("{{ \"led_current_ma\": {:.3f} }}", static_cast<double>(ma)); const auto json = nlohmann::json
return CommandResult::getSuccessResult(result); {
{
"led_current_ma", std::format("{:.3f}", static_cast<double>(ma))
}
}
return CommandResult::getSuccessResult(json);
#else #else
return CommandResult::getErrorResult("Monitoring disabled"); return CommandResult::getErrorResult("Monitoring disabled");
#endif #endif
@@ -221,11 +226,17 @@ CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry)
CommandResult getInfoCommand(std::shared_ptr<DependencyRegistry> /*registry*/) CommandResult getInfoCommand(std::shared_ptr<DependencyRegistry> /*registry*/)
{ {
const char* who = CONFIG_GENERAL_BOARD; const char *who = CONFIG_GENERAL_BOARD;
const char* ver = CONFIG_GENERAL_VERSION; const char *ver = CONFIG_GENERAL_VERSION;
// Ensure non-null strings // Ensure non-null strings
if (!who) who = ""; if (!who)
if (!ver) ver = ""; who = "";
auto result = std::format("{{ \"who_am_i\": \"{}\", \"version\": \"{}\" }}", who, ver); if (!ver)
return CommandResult::getSuccessResult(result); ver = "";
const auto json = nlohmann::json{
{"who_am_i", who},
{"version", ver},
};
return CommandResult::getSuccessResult(json);
} }
+3 -3
View File
@@ -36,7 +36,7 @@
#define BLINK_GPIO (gpio_num_t) CONFIG_LED_DEBUG_GPIO #define BLINK_GPIO (gpio_num_t) CONFIG_LED_DEBUG_GPIO
#else #else
// Use an invalid / unused GPIO when debug LED disabled to avoid accidental toggles // Use an invalid / unused GPIO when debug LED disabled to avoid accidental toggles
#define BLINK_GPIO (gpio_num_t) -1 #define BLINK_GPIO (gpio_num_t) - 1
#endif #endif
#define CONFIG_LED_C_PIN_GPIO (gpio_num_t) CONFIG_LED_EXTERNAL_GPIO #define CONFIG_LED_C_PIN_GPIO (gpio_num_t) CONFIG_LED_EXTERNAL_GPIO
@@ -112,8 +112,8 @@ void launch_streaming()
} }
else if (deviceMode == StreamingMode::SETUP) else if (deviceMode == StreamingMode::SETUP)
{ {
// we're still in setup, the user didn't select anything yet, let's give a bit of time for them to make a choice // we're still in setup, the user didn't select anything yet, let's give a bit of time for them to make a choice
ESP_LOGI("[MAIN]", "No mode was selected, staying in SETUP mode. WiFi streaming will be enabled still. \nPlease select another mode if you'd like."); ESP_LOGI("[MAIN]", "No mode was selected, staying in SETUP mode. WiFi streaming will be enabled still. \nPlease select another mode if you'd like.");
} }
else else
{ {
View File