Moved the lambdas to actual functions to avoid them dissapearing after setup.

This commit is contained in:
2024-09-25 18:47:12 -04:00
parent 59bafb2549
commit a5652102a0
3 changed files with 39 additions and 34 deletions

View File

@@ -3,7 +3,7 @@
CommandHandler::CommandHandler(){
for(uint32_t i = 0; i < MAX_COMMAND_SIZE; i++){
commandCallbacks[i] = nullptr;
commandCallbackIDs[i] = 0;
commandCallbackIDs[i] = -1;
}
}
@@ -30,6 +30,10 @@ bool CommandHandler::RemoveCommand(uint32_t commandID){
}
CommandHandler::CommandStatus CommandHandler::ProcessCommand(uint32_t * command, uint32_t commandSize){
if(commandSize == 0){
return CommandStatus::INVALID;
}
uint32_t commandID{command[0]};
// get a pointer to the second element in the array because the first element is the command ID
uint32_t * args{&(command[1])};

View File

@@ -39,8 +39,6 @@ public:
private:
static constexpr uint32_t MAX_COMMAND_SIZE{10};
// pointer to the head of the command array
uint32_t * command{nullptr};
// an array of command callbacks
CommandCallback commandCallbacks[MAX_COMMAND_SIZE];