From c98a98423d7a86bc578814e86aa4709895c515bf Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 7 Dec 2024 12:17:11 +0800 Subject: [PATCH] 2.0.9 --- README.md | 6 ++- appsrc/appconfig/basic/zappversion.hpp | 2 +- appsrc/baseservice/db/device_ext_setting_dao.cpp | 2 +- appsrc/service/app_core.cpp | 2 + appsrc/service/disinfection_logs_service.cpp | 2 +- appsrc/service/setting/ext_setting_mgr_service.cpp | 8 +-- appsrc/service/setting/ext_setting_mgr_service.hpp | 1 + appsrc/service/test_page_api_service.cpp | 0 appsrc/service/test_page_api_service.hpp | 46 ----------------- appsrc/service/test_page_mgr_service.cpp | 26 +++++----- appsrc/service/test_page_service_v2.cpp | 60 ++++++++++++++++++++++ appsrc/service/test_page_service_v2.hpp | 54 +++++++++++++++++++ 12 files changed, 143 insertions(+), 66 deletions(-) delete mode 100644 appsrc/service/test_page_api_service.cpp delete mode 100644 appsrc/service/test_page_api_service.hpp create mode 100644 appsrc/service/test_page_service_v2.cpp create mode 100644 appsrc/service/test_page_service_v2.hpp diff --git a/README.md b/README.md index 79384d3..e13b6ba 100644 --- a/README.md +++ b/README.md @@ -120,12 +120,16 @@ VERSION 2.0.3 VERSION 2.0.4 1. 修复部分BUG +VERSION 2.0.9 + 1. 修改默认打印机串口地址 + 2. 增加testPageServiceV2 + 3. 修复测试页面下加液排液没有关闭气阀导致的漏液 + TODO: 1. 设备使用时间维护(UI接口已经准备好,考虑是否使用文件袋放在设备中的方案) 2. 升级方案 3. 系统垃圾自动方案 4. 部署方案 - diff --git a/appsrc/appconfig/basic/zappversion.hpp b/appsrc/appconfig/basic/zappversion.hpp index 75ef06e..6c2e858 100644 --- a/appsrc/appconfig/basic/zappversion.hpp +++ b/appsrc/appconfig/basic/zappversion.hpp @@ -1,3 +1,3 @@ #pragma once -#define VERSION "2.0.8" +#define VERSION "2.0.9" #define PROJECT_NAME "TRANSMIT_DM" \ No newline at end of file diff --git a/appsrc/baseservice/db/device_ext_setting_dao.cpp b/appsrc/baseservice/db/device_ext_setting_dao.cpp index d14eb34..825c999 100644 --- a/appsrc/baseservice/db/device_ext_setting_dao.cpp +++ b/appsrc/baseservice/db/device_ext_setting_dao.cpp @@ -38,7 +38,7 @@ DeviceExtSetting DeviceExtSettingDAO::getDeviceExtSetting() { // setting.canBitrate = get("canBitrate", 500000); setting.canIF = get("canIF", "can0"); setting.deviceId = get("deviceId", ""); - setting.printerUartPath = get("printerUartPath", "/dev/ttyS1"); + setting.printerUartPath = get("printerUartPath", "/dev/ttyS5"); setting.dvalueCoefficient = get("printerBaudrate", 2); setting.projectTypes = get("projectTypes", ""); setting.h2o2SensorExpireTimeMonth = get("h2o2SensorExpireTimeMonth", 12); diff --git a/appsrc/service/app_core.cpp b/appsrc/service/app_core.cpp index 2bcfa0b..332acd7 100644 --- a/appsrc/service/app_core.cpp +++ b/appsrc/service/app_core.cpp @@ -27,6 +27,7 @@ #include "calibration/h2o2_liquid_weight_sensor_calibration_service.hpp" #include "equipment_usage_info_mgr_service.hpp" #include "setting/ext_setting_mgr_service.hpp" +#include "test_page_service_v2.hpp" // DeviceExtSettingDAO @@ -156,6 +157,7 @@ void AppCore::initialize() { BUILD_AND_REG_SERRVICE(DeviceInfoMgrService); BUILD_AND_REG_SERRVICE(OsMgrService); BUILD_AND_REG_SERRVICE(TestPageMgrService); + BUILD_AND_REG_SERRVICE(TestPageServiceV2); BUILD_AND_REG_SERRVICE(AddLiquidService); BUILD_AND_REG_SERRVICE(AirLeakDetectTest); diff --git a/appsrc/service/disinfection_logs_service.cpp b/appsrc/service/disinfection_logs_service.cpp index 2f4348d..b66839e 100644 --- a/appsrc/service/disinfection_logs_service.cpp +++ b/appsrc/service/disinfection_logs_service.cpp @@ -26,7 +26,7 @@ typedef DisinfectionRecordCSVHeader CSVHeader; *******************************************************************************/ #define LOG_STORGE_PATH "./disinfection_logs/" -#define EXPORT_PATH "/mnt/exportdata/Transmit/" +#define EXPORT_PATH "/mnt/exportdata/TrySmet/" #define MAX_LOG_NUM 300 #define IF_ERROR_RETURN(x) \ if (!x) { \ diff --git a/appsrc/service/setting/ext_setting_mgr_service.cpp b/appsrc/service/setting/ext_setting_mgr_service.cpp index f877d87..7bf2648 100644 --- a/appsrc/service/setting/ext_setting_mgr_service.cpp +++ b/appsrc/service/setting/ext_setting_mgr_service.cpp @@ -19,9 +19,8 @@ void ExtSettingMgrService::initialize() { REG_EXTFN(setPrinterUartPath, void(string)); REG_EXTFN(setDvalueCoefficient, void(float)); REG_EXTFN_VOID(rebootDevice, void(void)); // + REG_EXTFN_VOID(restartProgram, void(void)); // REG_EXTFN(setH2o2SensorExpireTimeMonth, void(int32_t)); - - // REG_EXTFN(setTestMode, void(bool)); } void ExtSettingMgrService::showHelp(shared_ptr cxt) { @@ -82,8 +81,6 @@ void ExtSettingMgrService::setDvalueCoefficient(shared_ptr cx void ExtSettingMgrService::setH2o2SensorExpireTimeMonth(shared_ptr cxt, int32_t h2o2SensorExpireTimeMonth) { DeviceExtSettingDAO::ins()->setH2o2SensorExpireTimeMonth(h2o2SensorExpireTimeMonth); } -void ExtSettingMgrService::rebootDevice(shared_ptr cxt) { system("reboot"); } - void ExtSettingMgrService::setDeviceInfo(shared_ptr cxt, DeviceType type, int year, int month, int day, int index) { string deviceIdPrefix; if (type == DeviceType::DT_600N) { @@ -104,3 +101,6 @@ void ExtSettingMgrService::setDeviceInfo(shared_ptr cxt, Devi DeviceExtSettingDAO::ins()->setDeviceId(fmt::format("{}{:0>2d}{:0>2d}{:0>2d}{:0>3d}", deviceIdPrefix, year, month, day, index)); cxt->rely["extSettings"] = DeviceExtSettingDAO::ins()->getDeviceExtSettingAsJson(); } +void ExtSettingMgrService::rebootDevice(shared_ptr cxt) { system("reboot"); } + +void ExtSettingMgrService::restartProgram(shared_ptr cxt) { system("systemctl restart zapp &"); } diff --git a/appsrc/service/setting/ext_setting_mgr_service.hpp b/appsrc/service/setting/ext_setting_mgr_service.hpp index c1f2ccc..754bf4b 100644 --- a/appsrc/service/setting/ext_setting_mgr_service.hpp +++ b/appsrc/service/setting/ext_setting_mgr_service.hpp @@ -39,6 +39,7 @@ class ExtSettingMgrService : public enable_shared_from_this cxt, bool testMode); void rebootDevice(shared_ptr cxt); + void restartProgram(shared_ptr cxt); }; } // namespace iflytop diff --git a/appsrc/service/test_page_api_service.cpp b/appsrc/service/test_page_api_service.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/appsrc/service/test_page_api_service.hpp b/appsrc/service/test_page_api_service.hpp deleted file mode 100644 index b151e62..0000000 --- a/appsrc/service/test_page_api_service.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -// -#include "appbase/appbean/test_page_iterm.hpp" -#include "baseservice/baseservice.hpp" -#include "service/hardware/device_io_ctrl_service.hpp" -#include "testpage/test_page_processer.hpp" -namespace iflytop { -using namespace testpage; - - -class TestPageMgrService : public enable_shared_from_this { - THISCLASS(TestPageMgrService); - - shared_ptr m_ds; - shared_ptr dcs; - - unique_ptr m_thread; - - // shared_ptr m_dict; - TestPageItemMgr m_testPageItemMgr; - - public: - void initialize(); - - private: - void getTestPageCfgInfo(shared_ptr cxt); - void onButton(shared_ptr cxt, string groupName, string buttonName, json params); - void readState(shared_ptr cxt); - void startReportState(shared_ptr cxt); - void stopReportState(shared_ptr cxt); - - - private: - int PrinterTest_test(); -}; - -} // namespace iflytop diff --git a/appsrc/service/test_page_mgr_service.cpp b/appsrc/service/test_page_mgr_service.cpp index 7cc3a3e..b4552e5 100644 --- a/appsrc/service/test_page_mgr_service.cpp +++ b/appsrc/service/test_page_mgr_service.cpp @@ -5,15 +5,14 @@ using namespace iflytop; using namespace testpage; /** - * @brief - * - * + * @brief + * + * * WARNING: 这个页面接口的接口已经废弃,仅为了兼容老版本,接口不会再更新 * Date: 2024-12-05 - * + * */ - void TestPageMgrService::getTestPageCfgInfo(shared_ptr cxt) { cxt->rely["items"] = m_testPageItemMgr.getPageCfgInfo(); } void TestPageMgrService::onButton(shared_ptr cxt, string groupName, string buttonName, json params) { m_testPageItemMgr.processOnButton(groupName, buttonName, params); } void TestPageMgrService::readState(shared_ptr cxt) { cxt->rely = m_testPageItemMgr.readState(); } @@ -47,28 +46,27 @@ void TestPageMgrService::initialize() { REG_FN_VOID(PrinterTest_test, void()); - auto SprayPumpCtrl = m_testPageItemMgr.createButtons({"SprayPumpCtrl", "喷液泵控制"}, // 模组名 - { + auto SprayPumpCtrl = m_testPageItemMgr.createButtons({"SprayPumpCtrl", "喷液泵控制"}, // 模组名 + { // 参数 {{"pumpVel", "速度"}, "g/min", {{"5"}, {"10"}, {"15"}}}, // }, - { + { // 按键 {"forward", "正转"}, {"backward", "反转"}, {"stop", "停止"}, }, - [this](string buttonName, vector param) { // + [this](string buttonName, vector param) { // logger->info("SprayPumpCtrl on button.{} ({})", buttonName, param[0]); if (buttonName == "forward") { - dcs->SprayPump_startInRPM(atoi(param[0].c_str())); + dcs->SprayPump_start(atoi(param[0].c_str())); } else if (buttonName == "backward") { - dcs->SprayPump_startInRPM(-atoi(param[0].c_str())); + dcs->SprayPump_start(-atoi(param[0].c_str())); } else if (buttonName == "stop") { dcs->SprayPump_stop(); } }); - auto AddDischargePumpCtrl = m_testPageItemMgr.createButtons({"AddDischargePumpCtrl", "加液泵控制"}, // 模组名 { // 参数 @@ -82,15 +80,19 @@ void TestPageMgrService::initialize() { [this](string buttonName, vector param) { // logger->info("on AddDischargePumpCtrl.{}", buttonName); if (buttonName == "addingLiquid") { + dcs->setAddFluidChannelSelectorValve(true); dcs->AddLiquidPump_stop(); usleep(500 * 1000); dcs->AddLiquidPump_addLiquid(); } else if (buttonName == "drainLiquid") { + dcs->setAddFluidChannelSelectorValve(true); dcs->AddLiquidPump_stop(); usleep(500 * 1000); dcs->AddLiquidPump_drainLiquid(); } else { dcs->AddLiquidPump_stop(); + usleep(1500 * 1000); + dcs->setAddFluidChannelSelectorValve(false); } }); diff --git a/appsrc/service/test_page_service_v2.cpp b/appsrc/service/test_page_service_v2.cpp new file mode 100644 index 0000000..839c63b --- /dev/null +++ b/appsrc/service/test_page_service_v2.cpp @@ -0,0 +1,60 @@ +#include "test_page_service_v2.hpp" + +#include "appdep/components/ziconv.hpp" +using namespace iflytop; +using namespace testpage; + +void TestPageServiceV2::initialize() { + GET_TO_SERVICE(m_ds); + GET_TO_SERVICE(dcs); + + // REG_EXTFN_VOID(getSetting, json(void)); // 单位g + // REG_EXTFN(setDeviceId, void(string)); + + REG_EXTFN(doSprayPumpFroward, void(int), gpm); + REG_EXTFN(doSprayPumpBackward, void(int), gpm); + REG_EXTFN_VOID(doSprayPumpStop, void(void)); + + REG_EXTFN_VOID(doAddLiquid, void(void)); + REG_EXTFN_VOID(doDrainLiquid, void(void)); + REG_EXTFN_VOID(doStopAddLiquid, void(void)); + + REG_EXTFN_VOID(doPrinterTest, void(void)); +} +void TestPageServiceV2::doSprayPumpFroward(shared_ptr cxt, int gpm) { dcs->SprayPump_start(gpm); } +void TestPageServiceV2::doSprayPumpBackward(shared_ptr cxt, int gpm) { dcs->SprayPump_start(-gpm); } +void TestPageServiceV2::doSprayPumpStop(shared_ptr cxt) { dcs->SprayPump_stop(); } + +void TestPageServiceV2::doAddLiquid(shared_ptr cxt) { + dcs->setAddFluidChannelSelectorValve(true); + dcs->AddLiquidPump_stop(); + usleep(500 * 1000); + dcs->AddLiquidPump_addLiquid(); +} +void TestPageServiceV2::doDrainLiquid(shared_ptr cxt) { + dcs->setAddFluidChannelSelectorValve(true); + dcs->AddLiquidPump_stop(); + usleep(500 * 1000); + dcs->AddLiquidPump_drainLiquid(); +} +void TestPageServiceV2::doStopAddLiquid(shared_ptr cxt) { + dcs->AddLiquidPump_stop(); + usleep(1500 * 1000); + dcs->setAddFluidChannelSelectorValve(false); +} + +int TestPageServiceV2::doPrinterTest(shared_ptr cxt) { + GET_SERVICE(UartPrinter)->print("abcdefghijklmn\n"); + usleep(100 * 1000); + GET_SERVICE(UartPrinter)->print("opqrstuvwxyz\n"); + usleep(100 * 1000); + GET_SERVICE(UartPrinter)->print("1234567890\n"); + usleep(100 * 1000); + GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312("打印机中文测试\n")); + usleep(100 * 1000); + GET_SERVICE(UartPrinter)->print("\n"); + GET_SERVICE(UartPrinter)->print("\n"); + GET_SERVICE(UartPrinter)->print("\n"); + GET_SERVICE(UartPrinter)->print("\n"); + return 0; +} diff --git a/appsrc/service/test_page_service_v2.hpp b/appsrc/service/test_page_service_v2.hpp new file mode 100644 index 0000000..8149161 --- /dev/null +++ b/appsrc/service/test_page_service_v2.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +#include "appbase/appbean/test_page_iterm.hpp" +#include "baseservice/baseservice.hpp" +#include "service/hardware/device_io_ctrl_service.hpp" +#include "testpage/test_page_processer.hpp" +namespace iflytop { +using namespace testpage; + +/** + * @brief + * + * + * WARNING: 这个页面接口的接口已经废弃,仅为了兼容老版本,接口不会再更新 + * Date: 2024-12-05 + * + */ + +class TestPageServiceV2 : public enable_shared_from_this { + THISCLASS(TestPageServiceV2); + + shared_ptr m_ds; + shared_ptr dcs; + + unique_ptr m_thread; + + TestPageItemMgr m_testPageItemMgr; + + public: + void initialize(); + + private: + int doPrinterTest(shared_ptr cxt); + + void doSprayPumpFroward(shared_ptr cxt, int gpm); + void doSprayPumpBackward(shared_ptr cxt, int gpm); + void doSprayPumpStop(shared_ptr cxt); + + void doAddLiquid(shared_ptr cxt); + void doDrainLiquid(shared_ptr cxt); + void doStopAddLiquid(shared_ptr cxt); +}; + +} // namespace iflytop