From 471efc2f73bce50c68aaff8c52d47ad8096f0af4 Mon Sep 17 00:00:00 2001 From: Marcos Chaparro Date: Mon, 22 Feb 2021 20:26:39 -0300 Subject: [PATCH] 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 --- commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands.c b/commands.c index 839ffc55..299612b8 100644 --- a/commands.c +++ b/commands.c @@ -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: