This commit is contained in:
interfisch 2024-06-25 21:41:12 +02:00
parent 3527b7ed99
commit 5f0f19c58d
1 changed files with 8 additions and 6 deletions

View File

@ -158,18 +158,18 @@ void ec_loop(unsigned long loopmillis) {
case MEASURE: case MEASURE:
if (ec_measurementReady()) { if (ec_measurementReady()) {
//Serial.println("DEBUG: Measurement Ready"); //Serial.println("DEBUG: Measurement Ready");
float ec_adc;
float ec_adc_adjusted;
float ec;
float ec25;
ec_releaseRelay(); ec_releaseRelay();
ec_adc=getMean(ec_array,EC_ARRAY_SIZE); ec_adc=getMean(ec_array,EC_ARRAY_SIZE);
//Serial.print("ec_adc="); Serial.println(ec_adc);
if (isValueArrayOK(ec_calib_array,EC_CALIB_ARRAY_SIZE,EC_ADC_UNAVAILABLE)){ if (isValueArrayOK(ec_calib_array,EC_CALIB_ARRAY_SIZE,EC_ADC_UNAVAILABLE)){
ec_calib_adc=getMean(ec_calib_array,EC_CALIB_ARRAY_SIZE); ec_calib_adc=getMean(ec_calib_array,EC_CALIB_ARRAY_SIZE);
//Serial.print("ec_calib_adc="); Serial.println(ec_calib_adc);
ec_adc_adjusted=mapf(ec_adc,0,ec_calib_adc,0,ec_reference_adc); ec_adc_adjusted=mapf(ec_adc,0,ec_calib_adc,0,ec_reference_adc);
//Serial.print("ec_adc_adjusted="); Serial.println(ec_adc_adjusted);
ec=ec_getECfromADC(ec_adc_adjusted, ec_calibration_polynom, sizeof(ec_calibration_polynom), ec_calibration_linearize_below_adc, ec_calibration_linear_lowADC, ec_calibration_linear_lowEC); ec=ec_getECfromADC(ec_adc_adjusted, ec_calibration_polynom, sizeof(ec_calibration_polynom), ec_calibration_linearize_below_adc, ec_calibration_linear_lowADC, ec_calibration_linear_lowEC);
//Serial.print("ec="); Serial.println(ec);
ec25=ec_calculateEC25(ec,tempC_reservoir); ec25=ec_calculateEC25(ec,tempC_reservoir);
@ -201,7 +201,9 @@ void ec_loop(unsigned long loopmillis) {
//Serial.print("Get ADC Reading"); //Serial.print("Get ADC Reading");
uint16_t value = ADS.readADC(EC_ADS_CHANNEL); uint16_t value = ADS.readADC(EC_ADS_CHANNEL);
//Serial.print(". Write to pos "); //Serial.print(". Write to pos ");
//Serial.println(ec_array_pos); //Serial.print(ec_array_pos);
//Serial.print(" = ");
//Serial.println(value);