From 57a7d6f5d442391280ffdfba286f1953928dde5c Mon Sep 17 00:00:00 2001 From: Richard Meadows Date: Thu, 3 Mar 2016 19:33:11 +0000 Subject: [PATCH] [cold-out] fix so it uses actual thermistor reading --- firmware/src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firmware/src/main.c b/firmware/src/main.c index 4f0d6b5..a997bc6 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -43,6 +43,7 @@ #include "pips.h" #include "xosc.h" #include "sequencer.h" +#include "thermistor.h" #define CALLSIGN "UBSEDS14" #define APRS_COMMENT "" @@ -266,6 +267,7 @@ void lf_tick(uint32_t tick) int main(void) { uint32_t n = 1; + float external_temperature; /* Init */ init(INIT_NORMAL); @@ -291,8 +293,9 @@ int main(void) start_adc_sequence(); while (is_adc_sequence_done() == 0); /* wait for adc */ - if ((get_thermistor() < COLD_OUT_TEMPERATURE) && - (cold_out_count++ < COLD_OUT_COUNT_MAX)) { + external_temperature = thermistor_ratio_to_temperature(get_thermistor()); /* read */ + if ((external_temperature < COLD_OUT_TEMPERATURE) && /* check temperature */ + (cold_out_count++ < COLD_OUT_COUNT_MAX)) { /* and max iterations */ in_cold_out = 1; /* cold */ } else {