more cali fixes
This commit is contained in:
@ -135,12 +135,16 @@ void loop() {
|
|||||||
|
|
||||||
switch (calibrationState) {
|
switch (calibrationState) {
|
||||||
case e_CAL_IDLE:
|
case e_CAL_IDLE:
|
||||||
|
for (uint8_t i = 0; i < NUM_OF_CHANNELS; i++) {
|
||||||
|
ads1210[i].setCalOffset(0.0);
|
||||||
|
ads1210[i].setCalFactor(1.0);
|
||||||
|
}
|
||||||
calibrationState = e_CAL_RUNNING;
|
calibrationState = e_CAL_RUNNING;
|
||||||
break;
|
break;
|
||||||
case e_CAL_RUNNING:
|
case e_CAL_RUNNING:
|
||||||
calibrationCycleCnt++;
|
calibrationCycleCnt++;
|
||||||
for (uint8_t i = 0; i < NUM_OF_CHANNELS; i++) {
|
for (uint8_t i = 0; i < NUM_OF_CHANNELS; i++) {
|
||||||
calibrationValueSum[i] += ads1210[i].getRRaw();
|
calibrationValueSum[i] += ads1210[i].getR();
|
||||||
}
|
}
|
||||||
if (calibrationCycleCnt >= CALIBRATION_CYCLES) {
|
if (calibrationCycleCnt >= CALIBRATION_CYCLES) {
|
||||||
calibrationState = e_CAL_SET;
|
calibrationState = e_CAL_SET;
|
||||||
|
@ -94,7 +94,7 @@ void ADS1210::exec() {
|
|||||||
|
|
||||||
m_u = (((float)m_value) / ((float)vMax)) * U_REF;
|
m_u = (((float)m_value) / ((float)vMax)) * U_REF;
|
||||||
m_rRaw = ((((float)vMax) / ((float)m_value)) - 1.0) * R_REF;
|
m_rRaw = ((((float)vMax) / ((float)m_value)) - 1.0) * R_REF;
|
||||||
m_r = (m_rRaw + m_calOffset) * m_calFactor;
|
m_r = (m_rRaw - m_calOffset) * m_calFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user