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: main.cpp
- Revision:
- 42:03cbc2a6f63b
- Parent:
- 41:978c2d85a0e7
- Child:
- 43:cc47a2e6ae07
--- a/main.cpp Fri Sep 21 19:23:45 2018 +0000 +++ b/main.cpp Sat Sep 22 08:32:20 2018 +0000 @@ -1,7 +1,6 @@ #include "stm32f103c8t6.h" #include "mbed.h" #include "mbed_events.h" -#include <stdio.h> #include "DS1820.h" #include "PinDetect.h" #include "Watchdog.h" @@ -17,6 +16,8 @@ Watchdog wd; unsigned int eeprom_config_value; extern char working_mode; +extern int temp_error[]; +extern float temp[]; Serial pc(PA_2, PA_3); // (TX, RX) Pin definition char a[128] = ""; // RX command buffer @@ -73,8 +74,20 @@ __disable_irq(); + if (strcmp(a,"AT check setup")==0) { + pc.printf("RAM=%u FLASH=%u OK\r\n", eeprom_config_value, readEEPROMWord(0)); + } else if (strcmp(a,"AT get status")==0) { + pc.printf("%d|%d|%d|%d|%d\r\n", temp_error[0], temp_error[1], temp_error[2], temp_error[3], temp_error[4]); + } else if (strcmp(a,"AT get temp")==0) { + pc.printf("%3.1f|%3.1f|%3.1f|%3.1f|%3.1f\r\n", temp[0], temp[1], temp[2], temp[3], temp[4]); + } else if (strcmp(a,"AT get mode")==0) { + pc.printf("%d\r\n", working_mode); + } else { + pc.printf("Bad request\r\n"); + }; + // command was recieved - + /* if (a[0]=='A' && a[1]=='T') { if ( a[2]=='\0') { @@ -90,7 +103,7 @@ }; // process_command(a); - + */ __enable_irq(); // ready for new command