Add reset command
This commit is contained in:
parent
a35ae616df
commit
08ca59099d
3 changed files with 16 additions and 1 deletions
|
@ -334,6 +334,8 @@ auto message::parser::StateVisitor::operator()(state::Command) -> State {
|
||||||
return state::CommandHelp{};
|
return state::CommandHelp{};
|
||||||
case static_cast<uint8_t>(protocol::Command::Version):
|
case static_cast<uint8_t>(protocol::Command::Version):
|
||||||
return state::CommandVersion{};
|
return state::CommandVersion{};
|
||||||
|
case static_cast<uint8_t>(protocol::Command::Reset):
|
||||||
|
return state::CommandReset{};
|
||||||
default:
|
default:
|
||||||
// invalidCallback("Command: Invalid index");
|
// invalidCallback("Command: Invalid index");
|
||||||
return state::Invalid{};
|
return state::Invalid{};
|
||||||
|
@ -388,6 +390,15 @@ auto message::parser::StateVisitor::operator()(state::CommandVersion) -> State {
|
||||||
return state::Complete{};
|
return state::Complete{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto message::parser::StateVisitor::operator()(state::CommandReset) -> State {
|
||||||
|
if (stream.available_bytes() > 0) {
|
||||||
|
// invalidCallback("CommandVersion: Too many bytes left");
|
||||||
|
return state::Invalid{};
|
||||||
|
}
|
||||||
|
|
||||||
|
return state::Invalid{};
|
||||||
|
}
|
||||||
|
|
||||||
auto message::parser::StateVisitor::operator()(state::Complete) -> State {
|
auto message::parser::StateVisitor::operator()(state::Complete) -> State {
|
||||||
return state::Complete{};
|
return state::Complete{};
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct CommandExitConsoleFlashing {};
|
||||||
struct CommandPairBluetooth {};
|
struct CommandPairBluetooth {};
|
||||||
struct CommandHelp {};
|
struct CommandHelp {};
|
||||||
struct CommandVersion {};
|
struct CommandVersion {};
|
||||||
|
struct CommandReset {};
|
||||||
struct Complete {};
|
struct Complete {};
|
||||||
} // namespace state
|
} // namespace state
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ using State = etl::variant<
|
||||||
state::LightControlIncrease, state::LightControlDecrease, state::Command,
|
state::LightControlIncrease, state::LightControlDecrease, state::Command,
|
||||||
state::CommandRequestLightData, state::CommandEnterConsoleFlashing,
|
state::CommandRequestLightData, state::CommandEnterConsoleFlashing,
|
||||||
state::CommandExitConsoleFlashing, state::CommandPairBluetooth,
|
state::CommandExitConsoleFlashing, state::CommandPairBluetooth,
|
||||||
state::CommandHelp, state::CommandVersion, state::Complete>;
|
state::CommandHelp, state::CommandVersion, state::CommandReset,
|
||||||
|
state::Complete>;
|
||||||
|
|
||||||
void parse(message::Message *message,
|
void parse(message::Message *message,
|
||||||
freertos::Queue<LightController::LightAction> &lightActionQueue);
|
freertos::Queue<LightController::LightAction> &lightActionQueue);
|
||||||
|
@ -86,6 +88,7 @@ public:
|
||||||
State operator()(state::CommandPairBluetooth);
|
State operator()(state::CommandPairBluetooth);
|
||||||
State operator()(state::CommandHelp);
|
State operator()(state::CommandHelp);
|
||||||
State operator()(state::CommandVersion);
|
State operator()(state::CommandVersion);
|
||||||
|
State operator()(state::CommandReset);
|
||||||
|
|
||||||
State operator()(state::Complete);
|
State operator()(state::Complete);
|
||||||
State operator()(state::Invalid);
|
State operator()(state::Invalid);
|
||||||
|
|
|
@ -47,6 +47,7 @@ enum class Command : uint8_t {
|
||||||
PairBluetooth = 0x3,
|
PairBluetooth = 0x3,
|
||||||
Help = 0x4,
|
Help = 0x4,
|
||||||
Version = 0x5,
|
Version = 0x5,
|
||||||
|
Reset = 0x6,
|
||||||
};
|
};
|
||||||
|
|
||||||
using Submode = etl::variant<Mode, Message, Settings, LightControl, Command>;
|
using Submode = etl::variant<Mode, Message, Settings, LightControl, Command>;
|
||||||
|
|
Reference in a new issue