Shell update command: Take file name as argument
This commit is contained in:
parent
3381840bba
commit
6273c68821
@ -632,8 +632,30 @@ shellmatta_retCode_t shell_cmd_update(const shellmatta_handle_t handle, const ch
|
||||
(void)handle;
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
shellmatta_retCode_t opt_stat;
|
||||
char option;
|
||||
char *argument;
|
||||
uint32_t arg_len;
|
||||
const char *update_file = NULL;
|
||||
|
||||
updater_update_from_file("update.hex");
|
||||
const shellmatta_opt_long_t options[] = {
|
||||
{NULL, '\0', SHELLMATTA_OPT_ARG_NONE},
|
||||
};
|
||||
|
||||
while (1) {
|
||||
opt_stat = shellmatta_opt_long(handle, options, &option, &argument, &arg_len);
|
||||
if (opt_stat != SHELLMATTA_OK)
|
||||
break;
|
||||
switch (option) {
|
||||
case '\0':
|
||||
update_file = argument;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updater_update_from_file(update_file);
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
@ -872,7 +894,7 @@ static shellmatta_cmd_t cmd[21] = {
|
||||
{
|
||||
.cmd = "save-calibration",
|
||||
.cmdAlias = "save-cal",
|
||||
.helpText = "",
|
||||
.helpText = "Permanently save the calibration to EEPROM",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_save_cal,
|
||||
.next = &cmd[13],
|
||||
@ -920,8 +942,8 @@ static shellmatta_cmd_t cmd[21] = {
|
||||
{
|
||||
.cmd = "update",
|
||||
.cmdAlias = NULL,
|
||||
.helpText = "Update Firmware. The updater searches for a file called update.hex",
|
||||
.usageText = "update",
|
||||
.helpText = "Update Firmware from HEX file",
|
||||
.usageText = "update </path/to/update.hex>",
|
||||
.cmdFct = shell_cmd_update,
|
||||
.next = &cmd[19],
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user