Skip to content

Commit

Permalink
Add basic TScode handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
MauAbata committed Sep 1, 2021
1 parent 5db3660 commit 364e683
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "UpdateHelper.h"
#include "config.h"

#include "tscode.h"
#include "eom_tscode_handler.h"

#include <SD.h>

Expand Down Expand Up @@ -362,16 +362,16 @@ namespace Console {
Serial.println(response);
}

tscode_command_response_t cmd_callback(tscode_command_t* cmd, char* response, size_t resp_len) {
_tscode_print_command(cmd);

switch (cmd->type) {
case EXIT_TSCODE_MODE:
/**
* Intercept TS-code commands to see if we're changing modes, otherwise pass to global handler.
*/
tscode_command_response_t tscode_handler(tscode_command_t* cmd, char* response, size_t resp_len) {
if (cmd->type == EXIT_TSCODE_MODE) {
tscode_mode = 0;
break;
}

return TSCODE_RESPONSE_OK;
return TSCODE_RESPONSE_OK;
} else {
return eom_tscode_handler(cmd, response, resp_len);
}
}

/**
Expand All @@ -394,7 +394,7 @@ namespace Console {
}
} else {
char response[121] = "";
tscode_process_buffer(buffer, cmd_callback, response, 120);
tscode_process_buffer(buffer, tscode_handler, response, 120);
Serial.println(response);
}

Expand Down

0 comments on commit 364e683

Please sign in to comment.