fix ec
This commit is contained in:
parent
3527b7ed99
commit
5f0f19c58d
14
include/ec.h
14
include/ec.h
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue