comparison main.c @ 97:bf707a3775d2

change default comms_wake
author Matt Johnston <matt@ucc.asn.au>
date Mon, 16 Jul 2012 22:58:25 +0800
parents f18fd4257296
children 2ba9065e7c4f
comparison
equal deleted inserted replaced
95:fd9cfa6829fd 97:bf707a3775d2
65 uint8_t rem; 65 uint8_t rem;
66 }; 66 };
67 67
68 // eeprom-settable parameters. all timeouts should 68 // eeprom-settable parameters. all timeouts should
69 // be a multiple of TICK (6 seconds probably) 69 // be a multiple of TICK (6 seconds probably)
70 static uint16_t measure_wake = 120; 70 static uint16_t measure_wake = 138; // not a divisor of comms_wake
71 static uint16_t comms_wake = 3600; 71 static uint16_t comms_wake = 3600;
72 static uint8_t wake_secs = 30; 72 static uint8_t wake_secs = 30;
73 73
74 // ---- Atomic guards required accessing these variables 74 // ---- Atomic guards required accessing these variables
75 static uint32_t clock_epoch; 75 static uint32_t clock_epoch;
795 // debounce 795 // debounce
796 _delay_ms(200); 796 _delay_ms(200);
797 need_comms = 1; 797 need_comms = 1;
798 comms_timeout = wake_secs; 798 comms_timeout = wake_secs;
799 button_pressed = 0; 799 button_pressed = 0;
800 continue;
801 }
802
803 if (need_comms)
804 {
805 need_comms = 0;
806 do_comms();
807 continue;
800 } 808 }
801 809
802 if (need_measurement) 810 if (need_measurement)
803 { 811 {
804 need_measurement = 0; 812 need_measurement = 0;
805 do_measurement(); 813 do_measurement();
806 continue; 814 continue;
807 } 815 }
808 816
809 if (need_comms)
810 {
811 need_comms = 0;
812 do_comms();
813 continue;
814 }
815
816 deep_sleep(); 817 deep_sleep();
817 } 818 }
818 819
819 return 0; /* never reached */ 820 return 0; /* never reached */
820 } 821 }