Allow read-only motor config and app config

Defining HW_MCCONF_READ_ONLY and HW_APPCONF_READ_ONLY turns the configs
in read-only mode.

In some applications its better to block the user from playing with
critical settings. With these switches the controller can be flashed
with a hardcoded config that user can only change with a full firmware
update.

Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
This commit is contained in:
Marcos Chaparro 2021-02-22 20:26:39 -03:00
parent 9a0973cba1
commit 471efc2f73
1 changed files with 4 additions and 0 deletions

View File

@ -452,6 +452,7 @@ void commands_process_packet(unsigned char *data, unsigned int len,
} break;
case COMM_SET_MCCONF: {
#ifndef HW_MCCONF_READ_ONLY
mc_configuration *mcconf = mempools_alloc_mcconf();
*mcconf = *mc_interface_get_configuration();
@ -484,6 +485,7 @@ void commands_process_packet(unsigned char *data, unsigned int len,
}
mempools_free_mcconf(mcconf);
#endif
} break;
case COMM_GET_MCCONF:
@ -501,6 +503,7 @@ void commands_process_packet(unsigned char *data, unsigned int len,
} break;
case COMM_SET_APPCONF: {
#ifndef HW_APPCONF_READ_ONLY
app_configuration *appconf = mempools_alloc_appconf();
*appconf = *app_get_configuration();
@ -526,6 +529,7 @@ void commands_process_packet(unsigned char *data, unsigned int len,
}
mempools_free_appconf(appconf);
#endif
} break;
case COMM_GET_APPCONF: