|
|
|
|
@ -47,7 +47,9 @@ void softinit() {
|
|
|
|
|
stdout = &mystdout;
|
|
|
|
|
printf("======= starting logging\n");
|
|
|
|
|
mcpadc_init(ADC_GAIN_2|ADC_CONV_CONT|ADC_BITS_16);
|
|
|
|
|
offset_init();
|
|
|
|
|
// offset_init();
|
|
|
|
|
sensordata[0].offset = -400;
|
|
|
|
|
sensordata[1].offset = +478;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,25 +62,22 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
|
|
|
|
|
int16_t data;
|
|
|
|
|
for(;;){
|
|
|
|
|
printf("====== loop iteration\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// measure temps 5*2 times
|
|
|
|
|
for(uint8_t i=0; i<1; i++) {
|
|
|
|
|
printf("====== now measuring temps\n");
|
|
|
|
|
for(uint8_t i=0; i<5; i++) {
|
|
|
|
|
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two probes atm
|
|
|
|
|
printf("=== active sensor: %i\n",active_sensor);
|
|
|
|
|
// printf("=== active sensor: %i\n",active_sensor);
|
|
|
|
|
muxer_set(active_sensor);
|
|
|
|
|
for(uint8_t j=0; j<4; ++j){
|
|
|
|
|
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);
|
|
|
|
|
mcpadc_get_data(); // first data after switch to trash
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(10);
|
|
|
|
|
_delay_ms(1000);
|
|
|
|
|
data = mcpadc_get_data();
|
|
|
|
|
process_thermocouple_value(data,active_sensor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// measure 2 offsets
|
|
|
|
|
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++)
|
|
|
|
|
if(offset_measure[active_sensor]) {
|
|
|
|
|
@ -95,15 +94,15 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
offset_count[active_sensor]++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
// measure ambient
|
|
|
|
|
printf("====== now measuring ambient\n");
|
|
|
|
|
muxer_set(4);
|
|
|
|
|
_delay_ms(300);
|
|
|
|
|
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);
|
|
|
|
|
mcpadc_get_data(); // first data after switch to trash
|
|
|
|
|
// while(!mcpadc_has_new_data()) _delay_ms(10);
|
|
|
|
|
// mcpadc_get_data(); // first data after switch to trash
|
|
|
|
|
_delay_ms(100);
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(10);
|
|
|
|
|
data = mcpadc_get_data();
|
|
|
|
|
process_ambient_value(data);
|
|
|
|
|
|