Add switch_mode_and_restart command to CommandManager for manufacturing#22
Open
bwmp wants to merge 5 commits intoEyeTrackVR:mainfrom
Open
Add switch_mode_and_restart command to CommandManager for manufacturing#22bwmp wants to merge 5 commits intoEyeTrackVR:mainfrom
bwmp wants to merge 5 commits intoEyeTrackVR:mainfrom
Conversation
actual functioning start_streaming command
lorow
reviewed
Dec 31, 2025
Comment on lines
+149
to
+186
| if (!json.contains("mode") || !json["mode"].is_string()) | ||
| { | ||
| return CommandResult::getErrorResult("Invalid payload - missing mode"); | ||
| } | ||
|
|
||
| auto modeStr = json["mode"].get<std::string>(); | ||
| StreamingMode newMode; | ||
|
|
||
| ESP_LOGI("[DEVICE_COMMANDS]", "Switch mode and restart command received with mode: %s", modeStr.c_str()); | ||
|
|
||
| if (modeStr == "uvc") | ||
| { | ||
| newMode = StreamingMode::UVC; | ||
| } | ||
| else if (modeStr == "wifi") | ||
| { | ||
| newMode = StreamingMode::WIFI; | ||
| } | ||
| else if (modeStr == "setup" || modeStr == "auto") | ||
| { | ||
| newMode = StreamingMode::SETUP; | ||
| } | ||
| else | ||
| { | ||
| return CommandResult::getErrorResult("Invalid mode - use 'uvc', 'wifi', or 'auto'"); | ||
| } | ||
|
|
||
| const auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config); | ||
| StreamingMode currentMode = projectConfig->getDeviceMode(); | ||
|
|
||
| if (currentMode == newMode) | ||
| { | ||
| ESP_LOGI("[DEVICE_COMMANDS]", "Device already in mode: %d, no restart needed", (int)currentMode); | ||
| return CommandResult::getSuccessResult("Device already in requested mode"); | ||
| } | ||
|
|
||
| ESP_LOGI("[DEVICE_COMMANDS]", "Setting device mode to: %d and scheduling restart", (int)newMode); | ||
| projectConfig->setDeviceMode(newMode); |
Member
There was a problem hiding this comment.
I get the idea behind this command and why it's needed, I completely agree with that. But do we have to duplicate the already existing switchModeCommand()? Is there something preventing us from just calling that command in here and then scheduling the restart right away, while returning what switchModeCommand returned?
| source: | ||
| type: idf | ||
| version: 5.4.2 | ||
| version: 5.5.1 |
Member
There was a problem hiding this comment.
Love me the update, thanks for upping the version. I'll have to copy the sdkconfig into the sdkconfig.base_defaults in boards/ later
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
actual functioning start_streaming command