diff --git a/stm-firmware/shell.c b/stm-firmware/shell.c index f8f5ea8..1a3226b 100644 --- a/stm-firmware/shell.c +++ b/stm-firmware/shell.c @@ -36,6 +36,7 @@ #include #include #include +#include #ifndef GIT_VER #define GIT_VER "VERSION NOT SET" @@ -407,6 +408,24 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl return SHELLMATTA_OK; } +static shellmatta_retCode_t shell_cmd_save_cal(const shellmatta_handle_t handle, const char *arguments, + uint32_t length) + +{ + (void)length; + (void)arguments; + int res; + + /* TODO: Change this */ + res = settings_save_calibration(0.0f, 0.0f); + if (res) { + shellmatta_printf(handle, "Error saving %d\r\n", res); + } else { + shellmatta_printf(handle, "Saved!\r\n"); + } + + return SHELLMATTA_OK; +} //typedef struct shellmatta_cmd //{ // char *cmd; /**< command name */ @@ -417,7 +436,7 @@ static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handl // struct shellmatta_cmd *next; /**< pointer to next command or NULL */ //} shellmatta_cmd_t; -static shellmatta_cmd_t cmd[13] = { +static shellmatta_cmd_t cmd[14] = { { .cmd = "version", .cmdAlias = "ver", @@ -520,8 +539,16 @@ static shellmatta_cmd_t cmd[13] = { .helpText = "", .usageText = "", .cmdFct = shell_cmd_read_flags, + .next = &cmd[13], + }, + { + .cmd = "save-calibration", + .cmdAlias = "save-cal", + .helpText = "", + .usageText = "", + .cmdFct = shell_cmd_save_cal, .next = NULL, - } + }, }; shellmatta_handle_t shell_init(shellmatta_write_t write_func)