diff --git a/firmware/mcp_adc.c b/firmware/mcp_adc.c index 9aaa43d..ae531ae 100644 --- a/firmware/mcp_adc.c +++ b/firmware/mcp_adc.c @@ -40,15 +40,17 @@ void mcpadc_init(uint8_t mode) uint8_t mcpadc_has_new_data(void) { /* this assumes that the first RDY bit read after the sample data indicates the old/new state of the sample we just read */ +#if ADC_ENABLE_18_BIT_MODE if(curmode & ADC_BITS_MASK == ADC_BITS_18) { i2c_read(ADC_ADDR, 4, r); - curmode = r[4]; + curmode = r[3]; } else +#endif { i2c_read(ADC_ADDR, 3, r); - curmode = r[3]; + curmode = r[2]; } if(~curmode & ADC_NEW_SAMPLE) {curmode &= ADC_READ_DATA;} return ~curmode & ADC_READ_DATA;