Closed ethanjli closed 3 years ago
It turns out that this can't only be done with a simple boolean flag in each service, because each service needs to know when it's been given the parameters/alarm limits from the backend. We'll instead need to make the store have boolean flags tracking whether certain state segments have been initialized, and then we'll only run dependent services if those state segments have been initialized.
Just like how #312 removes default initialization of state such as ParametersRequest and AlarmLimitsRequest in the frontend, in the firmware we'll also need to avoid default initialization. Right now, because we have default initialization, each time the backend loads its stored values of ParametersRequest, AlarmLimitsRequest, etc., from file, and sends them to a microcontroller which has just started, the firmware will generate a useless LogEvent about this. Instead, the microcontroller's ParametersService and AlarmLimitsService should start with ParametersRequest and AlarmLimitsRequest as uninitialized, and only generate log events after they're initialized. This could probably be done with a simple boolean flag in each service.