ambient works, rest somewhat broken

master
Paul Goeser 15 years ago
parent cc69509eba
commit 26cf5fb069

@ -34,10 +34,11 @@ void process_offset_value(int16_t raw_data, uint8_t channel){
}
void process_ambient_value(int16_t raw_data){
// 9.625mV after amp per °C
// old value: 9.625mV after amp per °C
// new: 9.313 after amp per °C
float a = raw_data;
a = a * 0.03125; //adc to mV after amp
a = a / 9.625;
a = a / 9.313;
ambient_temp = a;
printf("ambient: %3.3f°C (lastval %i)\n", a, raw_data);
}

@ -72,7 +72,6 @@ int __attribute__((noreturn)) main(void) {
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two probes atm
printf("=== active sensor: %i\n",active_sensor);
muxer_set(active_sensor);
_delay_ms(1000);
while(!mcpadc_has_new_data()) _delay_ms(10);
mcpadc_get_data(); // first data after switch to trash
while(!mcpadc_has_new_data()) _delay_ms(10);
@ -101,7 +100,7 @@ int __attribute__((noreturn)) main(void) {
// measure ambient
printf("====== now measuring ambient\n");
muxer_set(5);
muxer_set(4);
while(!mcpadc_has_new_data()) _delay_ms(10);
mcpadc_get_data(); // first data after switch to trash
while(!mcpadc_has_new_data()) _delay_ms(10);

@ -26,8 +26,8 @@ void muxer_set(uint8_t channel){
uint8_t inline muxer_channel_to_selectbits(uint8_t channel){
static uint8_t table[] = {2,1,0,3};
if(channel>=4){
static uint8_t table[] = {2,1,0,3,5,7,6,4};
if(channel>=8){
return 0;
}
return(table[channel]);

Loading…
Cancel
Save