|
|
|
|
@ -54,19 +54,19 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
|
|
|
|
|
muxer_set(1);
|
|
|
|
|
|
|
|
|
|
uint8_t active_sensor = 0;
|
|
|
|
|
int16_t data;
|
|
|
|
|
for(;;){
|
|
|
|
|
|
|
|
|
|
// measure temps 5*2 times
|
|
|
|
|
for(int i=0; i<5; i++) {
|
|
|
|
|
for(int active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two probes atm
|
|
|
|
|
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two probes atm
|
|
|
|
|
muxer_set(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();
|
|
|
|
|
process_thermocouple_value(data,active_sensor);
|
|
|
|
|
float f = filter_voltage_to_temp(((float)data) * 0.000625 );
|
|
|
|
|
filter_average_input(active_sensor, f);
|
|
|
|
|
if(filter_average_done(active_sensor,16)){
|
|
|
|
|
@ -77,7 +77,7 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// measure 2 offsets
|
|
|
|
|
for(int active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two offsets atm
|
|
|
|
|
for(uint8_t active_sensor=0; active_sensor<2; active_sensor++) { // only measuring two offsets atm
|
|
|
|
|
muxer_set(active_sensor);
|
|
|
|
|
offset_measure_start(active_sensor);
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(1);
|
|
|
|
|
@ -85,12 +85,22 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(1);
|
|
|
|
|
|
|
|
|
|
data = mcpadc_get_data();
|
|
|
|
|
process_ambient_value(data);
|
|
|
|
|
// TODO: what to do with the offset?
|
|
|
|
|
|
|
|
|
|
offset_measure_stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// measure ambient
|
|
|
|
|
muxer_set(5);
|
|
|
|
|
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();
|
|
|
|
|
process_ambient_value(data);
|
|
|
|
|
|
|
|
|
|
SOFTTIMER(1,8000) { // maybe measure coldjunction comp
|
|
|
|
|
|
|
|
|
|
/* SOFTTIMER(1,8000) { // maybe measure coldjunction comp
|
|
|
|
|
muxer_set(23); // TODO: channel for ntc?!
|
|
|
|
|
|
|
|
|
|
// first measure ntc offset?! maybe?
|
|
|
|
|
@ -108,7 +118,7 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
while(!mcpadc_has_new_data()) _delay_ms(1);
|
|
|
|
|
|
|
|
|
|
data = mcpadc_get_data();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|