Browse Source

fix some bug

storage-in-realtime
zhaohe 12 months ago
parent
commit
35b710402e
  1. 1
      appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp
  2. 3
      appsrc/appcomponents/canchannel/com/zscanprotocol_com.hpp
  3. 1
      appsrc/service/app/add_liquid_service.cpp
  4. 12
      appsrc/service/app/drain_liquid_service.cpp
  5. 3
      appsrc/service/app_core.cpp
  6. 2
      appsrc/service/hardware/disinfectant_weight_update_service.cpp
  7. 2
      appsrc/service/hardware/disinfectant_weight_update_service.hpp

1
appsrc/appcomponents/canchannel/com/zscanprotocol_com.cpp

@ -195,6 +195,7 @@ shared_ptr<Receipt> ZSCanProtocolCom::base_callcmd(int32_t to, int32_t cmdid, ui
shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) { shared_ptr<Receipt> ZSCanProtocolCom::callcmd(int32_t to, int32_t cmdid, uint8_t *param, int32_t paramLen, int32_t overtime) {
shared_ptr<Receipt> receipt; shared_ptr<Receipt> receipt;
lock_guard<mutex> lock(m_lock);
usleep(10 * 1000); usleep(10 * 1000);
for (size_t i = 0; i <= 3; i++) { for (size_t i = 0; i <= 3; i++) {

3
appsrc/appcomponents/canchannel/com/zscanprotocol_com.hpp

@ -72,6 +72,9 @@ class ZSCanProtocolCom {
RxReceiptContext m_rxReceiptContext; RxReceiptContext m_rxReceiptContext;
mutex m_rxReceiptContext_lock; mutex m_rxReceiptContext_lock;
mutex m_lock;
/******************************************************************************* /*******************************************************************************
* TX CONTEXT * * TX CONTEXT *
*******************************************************************************/ *******************************************************************************/

1
appsrc/service/app/add_liquid_service.cpp

@ -124,6 +124,7 @@ void AddLiquidService::addLiquidWork(int stopatg, bool& errorflag) {
for (size_t i = 0; i < EMTPTY_LINE_WHEN_ADDING_DISINFECTANT_TIMES; i++) { for (size_t i = 0; i < EMTPTY_LINE_WHEN_ADDING_DISINFECTANT_TIMES; i++) {
if (thisThread.getExitFlag()) break; if (thisThread.getExitFlag()) break;
thisThread.sleepForMs(100); thisThread.sleepForMs(100);
logger->info("empty line liquid {}:{}", i * 100, EMTPTY_LINE_WHEN_ADDING_DISINFECTANT_TIMES * 100);
} }
m_dics->AddLiquidPump_stop(); m_dics->AddLiquidPump_stop();
m_dics->SprayPump_stop(); m_dics->SprayPump_stop();

12
appsrc/service/app/drain_liquid_service.cpp

@ -63,7 +63,17 @@ void DrainLiquidService::start() {
} }
DrainLiquidService::state_t DrainLiquidService::getWorkstate() { return m_workstate; } DrainLiquidService::state_t DrainLiquidService::getWorkstate() { return m_workstate; }
void DrainLiquidService::stop() { m_workstate = kidle; }
void DrainLiquidService::stop() {
lock_guard<recursive_mutex> lock(lock_);
if (m_thread) {
m_thread->join();
m_thread = nullptr;
}
m_workstate = kidle;
m_dics->AddLiquidPump_stop();
m_dics->SprayPump_stop();
logger->info("stopDraining ");
}
void DrainLiquidService::start(shared_ptr<MsgProcessContext> cxt) { // void DrainLiquidService::start(shared_ptr<MsgProcessContext> cxt) { //
start(); start();

3
appsrc/service/app_core.cpp

@ -201,8 +201,7 @@ void AppCore::initialize() {
} }
}); });
// REG_EXTFN_VOID(getState, void(void));
REG_EXTFN_VOID(getState, void(void));
REG_EXTFN(promptConfirm, void(string), promptId); REG_EXTFN(promptConfirm, void(string), promptId);
REG_EXTFN_VOID(promptGetAll, void(void)); REG_EXTFN_VOID(promptGetAll, void(void));
REG_EXTFN_VOID(promptGetNext, void(void)); REG_EXTFN_VOID(promptGetNext, void(void));

2
appsrc/service/hardware/disinfectant_weight_update_service.cpp

@ -47,6 +47,6 @@ void DisinfectantWeightUpdateService::updateWeightThread() {
logger->error("updateWeightThread error: {}", e.what()); logger->error("updateWeightThread error: {}", e.what());
DS->setAppExceptionFlag(e); DS->setAppExceptionFlag(e);
} }
sleep(1);
usleep(500);
} }
} }

2
appsrc/service/hardware/disinfectant_weight_update_service.hpp

@ -38,7 +38,7 @@ class DisinfectantWeightUpdateService : public enable_shared_from_this<Disinfect
unique_ptr<Thread> updateThread; unique_ptr<Thread> updateThread;
shared_ptr<DeviceIoControlService> deviceIoControlService; shared_ptr<DeviceIoControlService> deviceIoControlService;
MovingAverageFilter filter = {20};
MovingAverageFilter filter = {10};
float weightCache = 0; float weightCache = 0;
public: public:

Loading…
Cancel
Save