diff --git a/Libs/Dronecan b/Libs/Dronecan index 6be0f6c4..c4db8c75 160000 --- a/Libs/Dronecan +++ b/Libs/Dronecan @@ -1 +1 @@ -Subproject commit 6be0f6c482e134002ff66454ab9f1733f2f7e00f +Subproject commit c4db8c755d30188dc088ab96d7183e5817139dea diff --git a/Libs/libparams b/Libs/libparams index 57daab94..fe7d62ba 160000 --- a/Libs/libparams +++ b/Libs/libparams @@ -1 +1 @@ -Subproject commit 57daab9431889df2c12645f3b1b0d0ec7b3a472d +Subproject commit fe7d62ba117679c4ed519e6f6f294b36c350a411 diff --git a/Src/modules/application/application.cpp b/Src/modules/application/application.cpp index c219b352..6edf69af 100644 --- a/Src/modules/application/application.cpp +++ b/Src/modules/application/application.cpp @@ -73,10 +73,14 @@ static int8_t init_board_periphery() { if (paramsLoad() != 0) { return -1; } - if (!paramsIsCrcValid()) { - (void)paramsSave(); + bool is_erased = false; + (void)paramsIsErased(&is_erased); + + if (!paramsIsCrcValid() && is_erased) { + (void)paramsResetToDefault(); } + #if defined(CAN1_TERMINATOR_Pin) && defined(CAN2_TERMINATOR_Pin) auto teminator_param = paramsGetIntegerValue(IntParamsIndexes::PARAM_SYSTEM_CAN_TEMINATOR); diff --git a/Src/modules/system/main.cpp b/Src/modules/system/main.cpp index 011d12e0..7c88c9fb 100644 --- a/Src/modules/system/main.cpp +++ b/Src/modules/system/main.cpp @@ -12,7 +12,9 @@ REGISTER_MODULE(SystemModule) void SystemModule::init() { need_notification = paramsGetIntegerValue(IntParamsIndexes::PARAM_LOG_LEVEL) <= 1; - set_health(Status::OK); + set_health(paramsIsCrcValid() + ? Status::OK + : Status::MINOR_FAILURE); set_mode(Mode::STANDBY); }