mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-24 00:23:45 +02:00
- Updated README to reflect changes in device mode terminology from "Auto" to "Setup".
- Changed configuration macros from CONFIG_GENERAL_DEFAULT_WIRED_MODE to CONFIG_GENERAL_INCLUDE_UVC_MODE across multiple files. - Introduced new command for retrieving LED current in CommandManager. - Added MonitoringManager and CurrentMonitor classes to handle LED current monitoring. - Updated Kconfig to include options for LED current monitoring. - Modified main application logic to integrate MonitoringManager and handle new device modes. - Adjusted CMakeLists and source files to include new monitoring components.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "device_commands.hpp"
|
||||
#include "LEDManager.hpp"
|
||||
#include "MonitoringManager.hpp"
|
||||
#include "esp_mac.h"
|
||||
#include <cstdio>
|
||||
|
||||
@@ -171,9 +172,9 @@ CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, st
|
||||
{
|
||||
newMode = StreamingMode::WIFI;
|
||||
}
|
||||
else if (strcmp(modeStr, "auto") == 0)
|
||||
else if (strcmp(modeStr, "setup") == 0 || strcmp(modeStr, "auto") == 0)
|
||||
{
|
||||
newMode = StreamingMode::AUTO;
|
||||
newMode = StreamingMode::SETUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -203,8 +204,8 @@ CommandResult getDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
case StreamingMode::WIFI:
|
||||
modeStr = "WiFi";
|
||||
break;
|
||||
case StreamingMode::AUTO:
|
||||
modeStr = "Auto";
|
||||
case StreamingMode::SETUP:
|
||||
modeStr = "Setup";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -231,3 +232,19 @@ CommandResult getSerialNumberCommand(std::shared_ptr<DependencyRegistry> /*regis
|
||||
auto result = std::format("{{ \"serial\": \"{}\", \"mac\": \"{}\" }}", serial_no_sep, mac_colon);
|
||||
return CommandResult::getSuccessResult(result);
|
||||
}
|
||||
|
||||
CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
#if CONFIG_MONITORING_LED_CURRENT
|
||||
auto mon = registry->resolve<MonitoringManager>(DependencyType::monitoring_manager);
|
||||
if (!mon)
|
||||
{
|
||||
return CommandResult::getErrorResult("MonitoringManager unavailable");
|
||||
}
|
||||
float ma = mon->getCurrentMilliAmps();
|
||||
auto result = std::format("{{ \"led_current_ma\": {:.3f} }}", static_cast<double>(ma));
|
||||
return CommandResult::getSuccessResult(result);
|
||||
#else
|
||||
return CommandResult::getErrorResult("Monitoring disabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -22,4 +22,7 @@ CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, st
|
||||
|
||||
CommandResult getDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
CommandResult getSerialNumberCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
CommandResult getSerialNumberCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
// Monitoring
|
||||
CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
Reference in New Issue
Block a user