From: Nathael Pajani Date: Mon, 11 Mar 2024 15:33:15 +0000 (+0100) Subject: Fix temp table problem causing forced mode on startup X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=0538abd18e198194bcb53dc6bdf594d1ef299886;p=soft%2Flpc122x%2Fscialys Fix temp table problem causing forced mode on startup --- diff --git a/v10/config.c b/v10/config.c index c35240b..ee3a574 100644 --- a/v10/config.c +++ b/v10/config.c @@ -281,6 +281,8 @@ const struct max31855_sensor_config thermocouple = { /* Configure external components */ int external_components_config(uint32_t uart) { + int i = 0; + /* RTC : must be done first to be able to access RTC RAM for uSD init */ scialys_time_config(I2C0, RTC_ADDR); scialys_time_init_check(uart); @@ -291,6 +293,11 @@ int external_components_config(uint32_t uart) /* Thermocouple configuration */ max31855_sensor_config(&thermocouple); + /* Fill the water temp table so the average value is accurate */ + for (i = 0; i < WTA_NB_VAL; i++) { + water_temp_update(uart); + msleep(5); + } /* TMP101 sensor config on power board */ power_board_present = power_board_temp_sensor_config(uart); diff --git a/v10/sensors.c b/v10/sensors.c index cb43d15..d4ca459 100644 --- a/v10/sensors.c +++ b/v10/sensors.c @@ -146,9 +146,10 @@ int interface_board_temp_sensor_config(uint32_t uart) /***************************************************************************** */ /* Update water tank temperature */ +static int water_centi_average[WTA_NB_VAL] = {0}; + int water_temp_update(uint32_t uart) { - static int water_centi_average[WTA_NB_VAL]; static int wta_idx = 0; int water_centi_degrees = 0; int ret = 0, i = 0;