diff --git a/stm-firmware/settings/settings-eeprom.c b/stm-firmware/settings/settings-eeprom.c index 974fb97..60041f1 100644 --- a/stm-firmware/settings/settings-eeprom.c +++ b/stm-firmware/settings/settings-eeprom.c @@ -1,22 +1,22 @@ /* Reflow Oven Controller -* -* Copyright (C) 2020 Mario Hüttel -* -* This file is part of the Reflow Oven Controller Project. -* -* The reflow oven controller is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* The Reflow Oven Control Firmware is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with the reflow oven controller project. -* If not, see . -*/ + * + * Copyright (C) 2020 Mario Hüttel + * + * This file is part of the Reflow Oven Controller Project. + * + * The reflow oven controller is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * The Reflow Oven Control Firmware is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the reflow oven controller project. + * If not, see . + */ #include #include @@ -37,6 +37,7 @@ struct eeprom_calibration_settings { }; #define EEPROM_OVER_TEMP_CONFIG_BASE_ADDR (EEPROM_CALIBRATION_BASE_ADDR + sizeof(struct eeprom_calibration_settings)) + struct eeprom_over_temp_config { float over_temperature; uint32_t over_temp_crc; @@ -54,7 +55,7 @@ static bool check_eeprom_header(void) return true; } -static void settings_eeprom_zero() +static void settings_eeprom_zero(void) { settings_eeprom_save_calibration(0.0f, 0.0f, false); settings_eeprom_save_overtemp_limit(0.0f, false); @@ -62,7 +63,7 @@ static void settings_eeprom_zero() bool settings_eeprom_detect_and_prepare(void) { - bool eeprom_ready = false;; + bool eeprom_ready = false; int res; @@ -77,7 +78,10 @@ bool settings_eeprom_detect_and_prepare(void) if (check_eeprom_header() == false) { /* Try to write a new header and check it again */ spi_eeprom_write(0, expected_header, sizeof(expected_header)); - while (spi_eeprom_write_in_progress()); + + while (spi_eeprom_write_in_progress()) + ; + if (check_eeprom_header() == false) { goto ret_deinit_crc; } else {