X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fao_adc.c;h=b0bfceb1c570ffc9b48b76bbef9d20e91d02103d;hp=26209dcf1381904b5d68bd597db535e0ba3b7940;hb=05bb953830604721c9a49dd56256b86f3666b5ff;hpb=210dbaa23cdacf3a6f2d6e23493e96ee2ac9bca7 diff --git a/src/ao_adc.c b/src/ao_adc.c index 26209dcf..b0bfceb1 100644 --- a/src/ao_adc.c +++ b/src/ao_adc.c @@ -51,7 +51,11 @@ ao_adc_isr(void) interrupt 1 a[1] = ADCH; if (sequence < 5) { /* start next channel conversion */ - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | (sequence + 1); + sequence++; + /* skip channel 2, we don't have a temp sensor on v0.2 */ + if (sequence == 2) + sequence++; + ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | sequence; } else { /* record this conversion series */ ao_adc_ring[ao_adc_head].tick = ao_time(); @@ -61,13 +65,13 @@ ao_adc_isr(void) interrupt 1 } static void -ao_adc_dump(void) +ao_adc_dump(void) __reentrant { - __xdata struct ao_adc packet; + static __xdata struct ao_adc packet; ao_adc_get(&packet); - printf("tick: %5u accel: %4d pres: %4d temp: %4d batt: %4d drogue: %4d main: %4d\n", - packet.tick, packet.accel >> 4, packet.pres >> 4, packet.temp >> 4, - packet.v_batt >> 4, packet.sense_d >> 4, packet.sense_m >> 4); + printf("tick: %5u accel: %5d pres: %5d temp: %5d batt: %5d drogue: %5d main: %5d\n", + packet.tick, packet.accel, packet.pres, packet.temp, + packet.v_batt, packet.sense_d, packet.sense_m); } __code struct ao_cmds ao_adc_cmds[] = { @@ -80,7 +84,7 @@ ao_adc_init(void) { ADCCFG = ((1 << 0) | /* acceleration */ (1 << 1) | /* pressure */ - (1 << 2) | /* temperature */ +/* (1 << 2) | v0.1 temperature */ (1 << 3) | /* battery voltage */ (1 << 4) | /* drogue sense */ (1 << 5)); /* main sense */