|
|
@ -226,8 +226,14 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
"Remaining time (s)\n" //
|
|
|
|
); |
|
|
|
} |
|
|
|
static string formattimeS(int sec) { return fmt::format("{:0>2}:{:0>2}:{:0>2}", sec / 3600, sec % 3600 / 60, sec % 60); } |
|
|
|
void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& context) { |
|
|
|
static string formattimeS(int sec) { |
|
|
|
if (sec >= 0) { |
|
|
|
return fmt::format("{:0>2}:{:0>2}:{:0>2}", sec / 3600, sec % 3600 / 60, sec % 60); |
|
|
|
} else { |
|
|
|
return fmt::format("--:--:--"); |
|
|
|
} |
|
|
|
} |
|
|
|
void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionContext& context) { |
|
|
|
auto* sensors = &m_context.h2o2data.h2o2sensor_data[0]; |
|
|
|
auto ds = m_deviceIoControlService; |
|
|
|
float dvalue = 0; |
|
|
@ -236,25 +242,28 @@ void DisinfectionCtrlService::dumpDisinfectionLogsToCSV(DisinfectionCon |
|
|
|
} else { |
|
|
|
dvalue = m_context.dvalue; |
|
|
|
} |
|
|
|
|
|
|
|
int remaintime = getEstimatedRemainingTimeS(); |
|
|
|
|
|
|
|
context.csvlogger->write( |
|
|
|
fmt::format("{}," //
|
|
|
|
"{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
"{:.2f},{:.2f},{:.2f}," //
|
|
|
|
"{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
"{}," //
|
|
|
|
"{}\n" //
|
|
|
|
, |
|
|
|
getTime(), //
|
|
|
|
sensors[0].h2o2, sensors[0].temp, sensors[0].humid, sensors[0].saturation, //
|
|
|
|
// sensors[1].h2o2, sensors[1].temp, sensors[1].humid, sensors[1].saturation, //
|
|
|
|
// sensors[2].h2o2, sensors[2].temp, sensors[2].humid, sensors[2].saturation, //
|
|
|
|
dvalue, m_context.m_nowLoglevel, m_context.m_targetLoglevel, //
|
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), //
|
|
|
|
formattimeS(m_context.m_remaintime))); |
|
|
|
"{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
"{:.2f},{:.2f},{:.2f}," //
|
|
|
|
"{},{},{},{}," //
|
|
|
|
// "{},{},{},{}," //
|
|
|
|
"{}," //
|
|
|
|
"{}\n" //
|
|
|
|
, |
|
|
|
getTime(), //
|
|
|
|
sensors[0].h2o2, sensors[0].temp, sensors[0].humid, sensors[0].saturation, //
|
|
|
|
// sensors[1].h2o2, sensors[1].temp, sensors[1].humid, sensors[1].saturation, //
|
|
|
|
// sensors[2].h2o2, sensors[2].temp, sensors[2].humid, sensors[2].saturation, //
|
|
|
|
dvalue, m_context.m_nowLoglevel, m_context.m_targetLoglevel, //
|
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getGPM(), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), //
|
|
|
|
formattimeS(remaintime))); |
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::finishDisinfection(DisinfectionContext& context) { |
|
|
@ -322,7 +331,7 @@ void DisinfectionCtrlService::dumpDisinfectionLogs(DisinfectionContext& context) |
|
|
|
ds->heatingStrip_getstate(), ds->airBlower_getstate(), ds->airCompressor_getstate(), ds->sprayLiquidPump_getRPM(), //
|
|
|
|
ds->getPressureSensorData(1), ds->getPressureSensorData(2), ds->getPressureSensorData(3), ds->getPressureSensorData(4), //
|
|
|
|
m_deviceIoControlService->getDisinfectantVolume_g(), //
|
|
|
|
m_context.m_remaintime); |
|
|
|
getEstimatedRemainingTimeS()); |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
@ -530,7 +539,11 @@ int32_t DisinfectionCtrlService::getEstimatedRemainingTimeS() { |
|
|
|
if (m_context.m_state == kpreheat) { |
|
|
|
return getPreHeatRaminTimeS(); |
|
|
|
} else if (m_context.m_state == kdisinfection || m_context.m_state == kdisinfection_take_a_break) { |
|
|
|
return m_context.m_remaintime; |
|
|
|
if (m_context.dvalue > 0) { |
|
|
|
return m_context.m_remaintime; |
|
|
|
} else { |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|