Decrease telemetry rate on the pad to 1/sec instead of 20/sec
[fw/altos] / ao_timer.c
index 716befe658f567acd06f14dfd4f1b0503c007bef..a6a7646f5a22c0b48aeb7ff0cbb0245ddea30467 100644 (file)
 
 static volatile __data uint16_t ao_tick_count;
 
-uint16_t ao_time(void)
+uint16_t ao_time(void) __critical
 {
-       uint16_t ret;
-       __critical {
-               ret = ao_tick_count;
-       }
-       return ret;
+       return ao_tick_count;
 }
 
 void
@@ -46,7 +42,7 @@ volatile __data uint8_t       ao_adc_count;
 void ao_timer_isr(void) interrupt 9
 {
        ++ao_tick_count;
-       if (++ao_adc_count >= ao_adc_interval) {
+       if (++ao_adc_count == ao_adc_interval) {
                ao_adc_count = 0;
                ao_adc_poll();
        }
@@ -57,6 +53,7 @@ void
 ao_timer_set_adc_interval(uint8_t interval) __critical
 {
        ao_adc_interval = interval;
+       ao_adc_count = 0;
 }
 
 void