|
|
@ -1,4 +1,13 @@ |
|
|
|
#include "disinfection_ctl_service.hpp"
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "configs/gconfig.hpp"
|
|
|
|
#include "configs/project_setting.hpp"
|
|
|
|
#include "iflytop/components/uart_printer/uart_printer.hpp"
|
|
|
|
#include "service/device_state_service.hpp"
|
|
|
|
|
|
|
|
using namespace iflytop; |
|
|
|
using namespace std; |
|
|
|
/**
|
|
|
@ -89,7 +98,7 @@ static bool zfeq(float a, float b, float eps = 0.01) { |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
float DisinfectionCtrlService::getDisinfectionDValue(float ppm) { //
|
|
|
|
float DisinfectionCtrlService::getDisinfectionDValue(float ppm) { //
|
|
|
|
return m_dvalueComputer.computeDValue(ppm); |
|
|
|
} |
|
|
|
float DisinfectionCtrlService::computeNowLogLevel(DisinfectionContext& context) { |
|
|
@ -172,7 +181,8 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
|
|
|
|
m_context.m_state = kpreheat; |
|
|
|
|
|
|
|
m_context.m_starttp = zsteady_clock().now(); |
|
|
|
m_context.m_starttp = zsteady_clock().now(); |
|
|
|
m_context.m_starttp_str = getTime(); |
|
|
|
|
|
|
|
m_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 1, 0); |
|
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
@ -488,13 +498,50 @@ void DisinfectionCtrlService::startDisinfection(int loglevel, // |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
printfDisinfectionContextResult(); |
|
|
|
//
|
|
|
|
finishDisinfection(m_context); |
|
|
|
})); |
|
|
|
//
|
|
|
|
} |
|
|
|
|
|
|
|
void DisinfectionCtrlService::printfDisinfectionContextResult() { |
|
|
|
/**
|
|
|
|
* @brief |
|
|
|
* = = = = = = = = = = = = = = = |
|
|
|
* 全思美特 |
|
|
|
* 操作人 XXXXX |
|
|
|
* 开始时间 2021-03-10 10:00:00 |
|
|
|
* 结束时间 2021-03-10 10:00:00 |
|
|
|
* 总耗时 01:59 |
|
|
|
* 目标LOG 6 |
|
|
|
* 实际LOG 6 |
|
|
|
* = = = = = = = = = = = = = = = |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
auto dio = m_deviceIoControlService; |
|
|
|
auto ds = GET_SERVICE(DeviceStateService); |
|
|
|
m_context.m_endtp_str = getTime(); |
|
|
|
int totaltime = zsteady_clock().elapsedTimeS(m_context.m_starttp) / 60; |
|
|
|
|
|
|
|
dio->printerPrintf(fmt::format("= = = = = = = = = = = = = = = \n")); |
|
|
|
dio->printerPrintf(fmt::format(" 全思美特\n")); |
|
|
|
dio->printerPrintf(fmt::format("操作人 {}\n", ds->getLoginUid())); |
|
|
|
dio->printerPrintf(fmt::format("开始时间 {}\n", m_context.m_starttp_str)); |
|
|
|
dio->printerPrintf(fmt::format("结束时间 {}\n", m_context.m_endtp_str)); |
|
|
|
dio->printerPrintf(fmt::format("总耗时 {}:{}\n", totaltime / 60, totaltime % 60)); |
|
|
|
dio->printerPrintf(fmt::format("目标LOG {}\n", (int)m_context.m_targetLoglevel)); |
|
|
|
dio->printerPrintf(fmt::format("实际LOG {}\n", (int)m_context.m_nowLoglevel)); |
|
|
|
dio->printerPrintf(fmt::format("= = = = = = = = = = = = = = = \n")); |
|
|
|
dio->printerPrintf(fmt::format("\n")); |
|
|
|
dio->printerPrintf(fmt::format("\n")); |
|
|
|
dio->printerPrintf(fmt::format("\n")); |
|
|
|
|
|
|
|
// getTime
|
|
|
|
// dio->printerPrintf(fmt::format("开始时间 {}\n", zsteady_clock().formatTime(m_context.m_starttp)));
|
|
|
|
} |
|
|
|
|
|
|
|
int DisinfectionCtrlService::getDisinfectionWorkState() { return m_context.m_state; } |
|
|
|
|
|
|
|
void DisinfectionCtrlService::stopDisinfection() { |
|
|
@ -562,6 +609,14 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
|
m_disinfectionThread = nullptr; |
|
|
|
} |
|
|
|
int32_t nowvolume = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
|
|
|
|
|
int maxg = DISINFECTANT_BUCKET_CAPACITY; |
|
|
|
|
|
|
|
if (stopatg > maxg) { |
|
|
|
logger->warn("start Replenishing fail, stopatg {} > maxg {}", stopatg, maxg); |
|
|
|
stopatg = maxg; |
|
|
|
} |
|
|
|
|
|
|
|
if (nowvolume > stopatg) { |
|
|
|
logger->warn("start Replenishing fail, nowvolume {} > stopatg {}", nowvolume, stopatg); |
|
|
|
return; |
|
|
|