|
|
@ -28,6 +28,7 @@ int32_t Hardware::readSwitchGroup() { |
|
|
|
id |= m_switch_group2.read() << 2; |
|
|
|
id |= m_switch_group3.read() << 3; |
|
|
|
id |= m_switch_group4.read() << 4; |
|
|
|
return id; |
|
|
|
} |
|
|
|
|
|
|
|
void Hardware::setAlarmLight(bool r, bool g, bool y) { |
|
|
@ -163,7 +164,7 @@ int32_t Hardware::h2o2_sensor_data(report_h2o2_data_t* readdata) { |
|
|
|
// float ma = mv / 150.0;
|
|
|
|
// float ppm = (ma - 4) / (20 - 4) * 2000;
|
|
|
|
int32_t h2o2ma = (h2o2adcVal / 4095.0 * 3.3 * 1000) / 150.0; |
|
|
|
int32_t h2o2ppm = (h2o2ma - 4) / (20 - 4) * 2000; |
|
|
|
int32_t h2o2ppm = (h2o2ma - 4) * 1.0 / (20 - 4) * 2000; |
|
|
|
|
|
|
|
readdata->sensor_error = ecode != 0; |
|
|
|
readdata->h2o2 = h2o2ppm; |
|
|
@ -228,12 +229,13 @@ void Hardware::onH2O2CaptureThread() { |
|
|
|
void Hardware::onAlarmLightThread() { |
|
|
|
while (1) { |
|
|
|
osDelay(500); |
|
|
|
|
|
|
|
if (m_alarmLightState == kdisconnected) { |
|
|
|
static bool state; |
|
|
|
setAlarmLight(false, state, false); |
|
|
|
state = !state; |
|
|
|
} else if (m_alarmLightState == kconnected) { |
|
|
|
setAlarmLight(true, true, false); |
|
|
|
setAlarmLight(false, true, false); |
|
|
|
} else if (m_alarmLightState == kerror) { |
|
|
|
setAlarmLight(true, false, false); |
|
|
|
} |
|
|
|