|
|
|
|
@ -50,6 +50,7 @@ void softinit() {
|
|
|
|
|
mcpadc_init(ADC_GAIN_2|ADC_CONV_CONT|ADC_BITS_16);
|
|
|
|
|
dbg_init();
|
|
|
|
|
stdout = &mystdout;
|
|
|
|
|
printf("======= starting logging\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -61,12 +62,13 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
|
|
|
|
|
int16_t data;
|
|
|
|
|
for(;;){
|
|
|
|
|
printf("loop iteration\n");
|
|
|
|
|
printf("====== loop iteration\n");
|
|
|
|
|
|
|
|
|
|
// measure temps 5*2 times
|
|
|
|
|
for(uint8_t i=0; i<5; i++) {
|
|
|
|
|
printf("starting temp measuring\n");
|
|
|
|
|
printf("====== now measuring temps\n");
|
|
|
|
|
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);
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(10);
|
|
|
|
|
mcpadc_get_data(); // first data after switch to trash
|
|
|
|
|
@ -78,10 +80,10 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("now measuring offsets\n");
|
|
|
|
|
printf("====== now measuring offsets\n");
|
|
|
|
|
// measure 2 offsets
|
|
|
|
|
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two offsets atm
|
|
|
|
|
printf("active sensor: %i",active_sensor);
|
|
|
|
|
printf("=== active sensor: %i\n",active_sensor);
|
|
|
|
|
muxer_set(active_sensor);
|
|
|
|
|
offset_measure_start(active_sensor);
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(10);
|
|
|
|
|
@ -96,31 +98,13 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// measure ambient
|
|
|
|
|
printf("====== now measuring ambient\n");
|
|
|
|
|
muxer_set(5);
|
|
|
|
|
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);
|
|
|
|
|
data = mcpadc_get_data();
|
|
|
|
|
process_ambient_value(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* SOFTTIMER(1,8000) { // maybe measure coldjunction comp
|
|
|
|
|
|
|
|
|
|
/* // first measure ntc offset?! maybe? */
|
|
|
|
|
/* offset_measure_start(active_sensor); */
|
|
|
|
|
/* while(!mcpadc_has_new_data()) _delay_ms(1); */
|
|
|
|
|
/* mcpadc_get_data(); // first data after switch to trash */
|
|
|
|
|
/* while(!mcpadc_has_new_data()) _delay_ms(1); */
|
|
|
|
|
|
|
|
|
|
/* data = mcpadc_get_data(); */
|
|
|
|
|
/* offset_measure_stop(); */
|
|
|
|
|
|
|
|
|
|
/* // now measure temp-data */
|
|
|
|
|
/* while(!mcpadc_has_new_data()) _delay_ms(1); */
|
|
|
|
|
/* mcpadc_get_data(); // first data after switch to trash */
|
|
|
|
|
/* while(!mcpadc_has_new_data()) _delay_ms(1); */
|
|
|
|
|
|
|
|
|
|
/* data = mcpadc_get_data(); */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|