STM32F103C8T6_WIFI_Heating_system
Dependencies: mbed mbed-STM32F103C8T6 eeprom_flash Watchdog PinDetect DS1820
- Bluepill STM32F103C8T6 Heating system
- _This project is core part of bigger heating system project!_
Features
- Reading temperature from four DS18B20 sensors
- Making a decision about switching on/off heater and pomp
- Executing simple user commands from UART
- Storing state parameters to program memory (EEPROM emulation)
Diff: temp_controller/temp_controller.cpp
- Revision:
- 50:94730b99ea41
- Parent:
- 49:f9f65a2fc92f
- Child:
- 52:20d6bf661fd6
diff -r f9f65a2fc92f -r 94730b99ea41 temp_controller/temp_controller.cpp --- a/temp_controller/temp_controller.cpp Sun Sep 23 19:59:48 2018 +0000 +++ b/temp_controller/temp_controller.cpp Mon Sep 24 13:47:03 2018 +0000 @@ -122,8 +122,11 @@ // save new config if it was changed - if (readEEPROMWord(0)!= eeprom_config_value) { + if (readEEPROMWord(0) != eeprom_config_value || + readEEPROMWord(4) != (unsigned int)working_mode) { save_new_config(); + //pc.printf("Tram=%x Teeprom=%x\r\n", readEEPROMWord(0), eeprom_config_value); + //pc.printf("Mram=%x Meeprom=%x\r\n", readEEPROMWord(4), working_mode); }; @@ -185,6 +188,7 @@ enableEEPROMWriting(); writeEEPROMWord(0,eeprom_config_value); + writeEEPROMWord(4,(unsigned int)working_mode); disableEEPROMWriting(); }; @@ -204,6 +208,19 @@ return v; }; + + +unsigned int get_mode_config_value(){ + + unsigned int v = readEEPROMWord(4); + if ( v > 6 ) { + // if eeprom mode value is not initialized + // set default value 0x01; ECO mode + v = 1; + }; + return v; +}; + void set_pomp_and_heater_by(float * work_temp) { // temp config array = outdoor|litos|mebel|hot_water|back_water