Correct version of EEPROM header for settings and write check for overtemperature

This commit is contained in:
Mario Hüttel 2021-02-02 20:50:30 +01:00
parent 50ad31d58a
commit e614eaa23b
2 changed files with 15 additions and 1 deletions

View File

@ -42,6 +42,7 @@
#include <helper-macros/helper-macros.h> #include <helper-macros/helper-macros.h>
#include <stm-periph/rcc-manager.h> #include <stm-periph/rcc-manager.h>
#include <reflow-controller/temp-converter.h> #include <reflow-controller/temp-converter.h>
#include <reflow-controller/adc-meas.h>
/** /**
* @brief Macro that checks if a given @ref error_flag is persistent * @brief Macro that checks if a given @ref error_flag is persistent
@ -563,6 +564,7 @@ static void safety_controller_process_active_timing_mons()
/** /**
* @brief safety_controller_process_monitor_checks * @brief safety_controller_process_monitor_checks
* Process the analog and timing monitors and set the relevant flags in case of a monitor outside its limits. * Process the analog and timing monitors and set the relevant flags in case of a monitor outside its limits.
* Furthermore, the PT1000 resistance is checked for overtemperature
* *
* The checking of the analog monitors will only be armed after a startup delay of 1000 ms to allow the values to stabilize. * The checking of the analog monitors will only be armed after a startup delay of 1000 ms to allow the values to stabilize.
*/ */
@ -572,6 +574,7 @@ static void safety_controller_process_monitor_checks(void)
struct analog_monitor_info amon_info; struct analog_monitor_info amon_info;
uint32_t idx; uint32_t idx;
uint32_t analog_mon_count; uint32_t analog_mon_count;
float pt1000_val = 1000000.0f;
if (!startup_completed && systick_get_global_tick() >= 1000) if (!startup_completed && systick_get_global_tick() >= 1000)
startup_completed = true; startup_completed = true;
@ -589,6 +592,11 @@ static void safety_controller_process_monitor_checks(void)
} }
} }
adc_pt1000_get_current_resistance(&pt1000_val);
if (pt1000_val > safety_controller_overtemp_config.overtemp_equiv_resistance) {
safety_controller_report_error(ERR_FLAG_OVERTEMP);
}
safety_controller_process_active_timing_mons(); safety_controller_process_active_timing_mons();
} }

View File

@ -24,7 +24,7 @@
#include <string.h> #include <string.h>
#define EEPROM_HEADER_MAGIC 0xA5 #define EEPROM_HEADER_MAGIC 0xA5
#define EEPROM_HEADER_COMP_VER 0xFF #define EEPROM_HEADER_COMP_VER 0x01
static const uint8_t expected_header[2] = {EEPROM_HEADER_MAGIC, EEPROM_HEADER_COMP_VER}; static const uint8_t expected_header[2] = {EEPROM_HEADER_MAGIC, EEPROM_HEADER_COMP_VER};
@ -36,6 +36,12 @@ struct eeprom_calibration_settings {
uint32_t crc; uint32_t crc;
}; };
#define EEPROM_OVER_TEMP_CONFIG_BASE_ADDR (EEPROM_CALIBRATION_BASE_ADDR + sizeof(struct eeprom_calibration_settings))
struct eeprom_over_temp_config {
float over_temperature;
float over_temperature_redundant;
};
static bool check_eeprom_header(void) static bool check_eeprom_header(void)
{ {
uint8_t header[2] = {0}; uint8_t header[2] = {0};