a few debug prints

master
Paul Goeser 15 years ago
parent c545171271
commit 03526f8343

@ -13,6 +13,7 @@ float avg_noise[CHANNELCOUNT];
void process_thermocouple_value(int16_t raw_data, uint8_t channel){
dbgLog("procthermval, val %i, chan %i",raw_data,channel);
// This function does everything that needs to be done to raw adc values
float a = raw_data;
a -= sensordata[channel].offset;

@ -56,33 +56,29 @@ int __attribute__((noreturn)) main(void) {
int16_t data;
for(;;){
dbgLog("loop iteration\n");
// measure temps 5*2 times
for(int i=0; i<5; i++) {
for(uint8_t i=0; i<5; i++) {
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);
while(!mcpadc_has_new_data()) _delay_ms(10);
mcpadc_get_data(); // first data after switch to trash
while(!mcpadc_has_new_data()) _delay_ms(1);
while(!mcpadc_has_new_data()) _delay_ms(10);
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)){
filter_average_noise(active_sensor);
temperatures[active_sensor] = filter_average_result(active_sensor);
}
}
dbgLog("a");
}
// measure 2 offsets
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);
while(!mcpadc_has_new_data()) _delay_ms(10);
mcpadc_get_data(); // first data after switch to trash
while(!mcpadc_has_new_data()) _delay_ms(1);
while(!mcpadc_has_new_data()) _delay_ms(10);
data = mcpadc_get_data();
process_ambient_value(data);
@ -93,9 +89,9 @@ int __attribute__((noreturn)) main(void) {
// measure ambient
muxer_set(5);
while(!mcpadc_has_new_data()) _delay_ms(1);
while(!mcpadc_has_new_data()) _delay_ms(10);
mcpadc_get_data(); // first data after switch to trash
while(!mcpadc_has_new_data()) _delay_ms(1);
while(!mcpadc_has_new_data()) _delay_ms(10);
data = mcpadc_get_data();
process_ambient_value(data);

Loading…
Cancel
Save