From: Fredrik Tolf Date: Thu, 5 Jul 2007 01:24:34 +0000 (+0000) Subject: Save last set temperature. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=9a754855ff4e519205567ab96780b3ccb998a9d0;p=kokare.git Save last set temperature. --- diff --git a/kokare.c b/kokare.c index b81842e..0170237 100644 --- a/kokare.c +++ b/kokare.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -266,13 +267,21 @@ int main(void) int state, cur, run, rstate, delta; unsigned long utime; - state = 0; - cur = 100; + state = 1; + cur = eeprom_read_byte(0); + if(cur < 0) + cur = 0; + if(cur > 100) + cur = 100; run = 0; rstate = 0; + utime = getticks(); init(); sei(); - display(0, 0, 0); + if(cur < 100) + display(cur, 0, 0); + else + dsp[0] = dsp[1] = SEGG; while(1) { mnow = getticks(); @@ -321,8 +330,10 @@ int main(void) } utime = mnow; } - if(mnow - utime > 1000000) + if(mnow - utime > 2000000) { state = 0; + eeprom_write_byte(0, cur); + } if(sstate == 2) { run = !run; sstate = 0;