diff options
author | Maximilien Cuony <maximilien@theglu.org> | 2016-04-18 20:46:53 +0200 |
---|---|---|
committer | Maximilien Cuony <maximilien@theglu.org> | 2016-04-18 20:46:53 +0200 |
commit | a66ca57c01c3ced4c4ada0dc09040e8eb620efaa (patch) | |
tree | 0f260e1b2036f3847ef8e4d4aea621cd382ec749 /src/fsm/main.c | |
parent | 5927d922ee95f3e3eeed99302b25094aeec1d622 (diff) | |
download | glutte-o-matic-a66ca57c01c3ced4c4ada0dc09040e8eb620efaa.tar.gz glutte-o-matic-a66ca57c01c3ced4c4ada0dc09040e8eb620efaa.tar.bz2 glutte-o-matic-a66ca57c01c3ced4c4ada0dc09040e8eb620efaa.zip |
Temperature
Diffstat (limited to 'src/fsm/main.c')
-rw-r--r-- | src/fsm/main.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/fsm/main.c b/src/fsm/main.c index b7da4e6..94c15e0 100644 --- a/src/fsm/main.c +++ b/src/fsm/main.c @@ -41,9 +41,8 @@ #include "fsm.h" #include "common.h" #include "usart.h" -#if DS18B20_ENABLED -#include "ds18b20.h" -#endif +#include "delay.h" +#include "temperature.h" #include "vc.h" #define GPIOD_BOARD_LED_GREEN GPIO_Pin_12 @@ -75,6 +74,7 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask, int main(void) { init(); + delay_init(); usart_init(); usart_debug_puts("\r\n******* glutt-o-matique version " GIT_VERSION " *******\r\n"); @@ -123,10 +123,8 @@ static void launcher_task(void *pvParameters) usart_debug_puts("GPS init\r\n"); gps_init(); -#if DS18B20_ENABLED usart_debug_puts("DS18B20 init\r\n"); - ds18b20_init(); -#endif + temperature_init(); usart_debug_puts("TaskButton init\r\n"); @@ -219,15 +217,14 @@ static void detect_button_press(void *pvParameters) last_pin_high_count != pin_high_count) { tm_trigger = 1; usart_debug_puts("Bouton bleu\r\n"); -#if DS18B20_ENABLED - float temp = 0.0f; - if (ds18b20_gettemp(&temp)) { - usart_debug("Temperature %d\r\n", temp); - } -#else - if (0) {} -#endif - else { + + if (temperature_valid()) { + + float temp = temperature_get(); + + usart_debug("Temperature %f\r\n", temp); + + } else { usart_debug_puts("No temp\r\n"); } } |