Mercurial > templog
diff main.c @ 117:eecd2612a68e
stay on
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 05 Oct 2012 22:48:49 +0800 |
parents | 9afff8f29844 |
children | bb0c946460f3 |
line wrap: on
line diff
--- a/main.c Fri Oct 05 22:24:47 2012 +0800 +++ b/main.c Fri Oct 05 22:48:49 2012 +0800 @@ -164,6 +164,20 @@ static void deep_sleep(); +// 0 or 1 +static uint8_t +is_fridge_on() +{ + if (PORT_FRIDGE & _BV(PIN_FRIDGE)) + { + return 1; + } + else + { + return 0; + } +} + // Very first setup static void setup_chip() @@ -348,6 +362,7 @@ fprintf_P(crc_stdout, PSTR("fridge=%.1f\n"), fridge_setpoint/10.0); fprintf_P(crc_stdout, PSTR("fridge_diff=%.1f\n"), fridge_difference/10.0); fprintf_P(crc_stdout, PSTR("fridge_delay=%hu\n"), fridge_delay); + fprintf_P(crc_stdout, PSTR("fridge_status=%hhu\n"), is_fridge_on()); fprintf_P(crc_stdout, PSTR("tick_secs=%d\n"), TICK); fprintf_P(crc_stdout, PSTR("tick_wake=%d\n"), SLEEP_COMPARE); fprintf_P(crc_stdout, PSTR("maxsens=%hhu\n"), MAX_SENSORS); @@ -396,6 +411,7 @@ printf_P(PSTR("tick_wake=%hhu\n"), SLEEP_COMPARE); _delay_ms(100); comms_timeout = 0; + stay_awake = 0; } static void @@ -841,7 +857,7 @@ simple_ds18b20_start_meas(NULL); // sleep rather than using a long delay - deep_sleep(); + idle_sleep(); //_delay_ms(DS18B20_TCONV_12BIT); if (n_measurements == max_measurements) @@ -967,6 +983,8 @@ need_comms = 1; need_measurement = 1; + stay_awake = 1; + for(;;) { if (button_pressed)