|
@ -1,4 +1,12 @@ |
|
|
#include "disinfection_ctl_service.hpp"
|
|
|
#include "disinfection_ctl_service.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
#include "configs/gconfig.hpp"
|
|
|
|
|
|
#include "iflytop/components/uart_printer/uart_printer.hpp"
|
|
|
|
|
|
#include "service/device_state_service.hpp"
|
|
|
|
|
|
|
|
|
using namespace iflytop; |
|
|
using namespace iflytop; |
|
|
using namespace std; |
|
|
using namespace std; |
|
|
/**
|
|
|
/**
|
|
@ -199,9 +207,11 @@ void DisinfectionCtrlService::initContext(DisinfectionContext& context, |
|
|
|
|
|
|
|
|
m_context.m_state = kpreheat; |
|
|
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_zcanHost->warning_light_ctrl_c1002(1, 0, 0, 1, 0); |
|
|
|
|
|
// usleep(100 * 1000);
|
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
m_deviceIoControlService->heartingPlate_setPower(true); |
|
|
context.csvlogger = m_disinfectionLogsManager->createNewLogger(context.m_disinfectionID); |
|
|
context.csvlogger = m_disinfectionLogsManager->createNewLogger(context.m_disinfectionID); |
|
|
|
|
|
|
|
@ -337,6 +347,43 @@ void DisinfectionCtrlService::dumpDisinfectionLogs(DisinfectionContext& context) |
|
|
getEstimatedRemainingTimeS()); |
|
|
getEstimatedRemainingTimeS()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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)));
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* @brief |
|
|
* @brief |
|
|
* 消毒中状态处理 |
|
|
* 消毒中状态处理 |
|
@ -483,8 +530,7 @@ void DisinfectionCtrlService::changeDisinfectionParameter(int injection_pump_spe |
|
|
m_context.continued_humi = continued_humi; |
|
|
m_context.continued_humi = continued_humi; |
|
|
m_context.injection_pump_speed_changed = true; |
|
|
m_context.injection_pump_speed_changed = true; |
|
|
|
|
|
|
|
|
logger->info("changeDisinfectionParameter {} {} {} {} {} {} {}", injection_pump_speed, stoped_gs, continued_gs, stoped_satur, continued_satur, stoped_humi, |
|
|
|
|
|
continued_humi); |
|
|
|
|
|
|
|
|
logger->info("changeDisinfectionParameter {} {} {} {} {} {} {}", injection_pump_speed, stoped_gs, continued_gs, stoped_satur, continued_satur, stoped_humi, continued_humi); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void DisinfectionCtrlService::startDisinfection(int loglevel, //
|
|
|
void DisinfectionCtrlService::startDisinfection(int loglevel, //
|
|
@ -519,6 +565,7 @@ void DisinfectionCtrlService::startDisinfection(int loglevel, // |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printfDisinfectionContextResult(); |
|
|
//
|
|
|
//
|
|
|
finishDisinfection(m_context); |
|
|
finishDisinfection(m_context); |
|
|
})); |
|
|
})); |
|
@ -591,6 +638,14 @@ void DisinfectionCtrlService::startReplenishingFluids(int stopatg) { |
|
|
m_disinfectionThread->join(); |
|
|
m_disinfectionThread->join(); |
|
|
m_disinfectionThread = nullptr; |
|
|
m_disinfectionThread = nullptr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int maxg = GET_SERVICE(GConfig)->get_disinfectantBucketCapacity_g(); |
|
|
|
|
|
|
|
|
|
|
|
if (stopatg > maxg) { |
|
|
|
|
|
logger->warn("start Replenishing fail, stopatg {} > maxg {}", stopatg, maxg); |
|
|
|
|
|
stopatg = maxg; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int32_t nowvolume = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
int32_t nowvolume = m_deviceIoControlService->getDisinfectantVolume_g(); |
|
|
if (nowvolume > stopatg) { |
|
|
if (nowvolume > stopatg) { |
|
|
logger->warn("start Replenishing fail, nowvolume {} > stopatg {}", nowvolume, stopatg); |
|
|
logger->warn("start Replenishing fail, nowvolume {} > stopatg {}", nowvolume, stopatg); |
|
|