|
@ -21,6 +21,8 @@ void AirLeakDetectTest::initialize() { |
|
|
REG_EXTFN_VOID(stopStateReport, void()); |
|
|
REG_EXTFN_VOID(stopStateReport, void()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define FORCE_DO
|
|
|
|
|
|
|
|
|
void AirLeakDetectTest::start(int inflationTimeMs) { |
|
|
void AirLeakDetectTest::start(int inflationTimeMs) { |
|
|
logger->info("AirLeakDetectTest start"); |
|
|
logger->info("AirLeakDetectTest start"); |
|
|
auto nowstate = m_ds->getDeviceState(); |
|
|
auto nowstate = m_ds->getDeviceState(); |
|
@ -34,13 +36,15 @@ void AirLeakDetectTest::start(int inflationTimeMs) { |
|
|
m_thread.reset(new Thread("AirLeakDetectTestThread", [this, inflationTimeMs]() { |
|
|
m_thread.reset(new Thread("AirLeakDetectTestThread", [this, inflationTimeMs]() { |
|
|
try { |
|
|
try { |
|
|
airLeakDetectTestThread(inflationTimeMs); |
|
|
airLeakDetectTestThread(inflationTimeMs); |
|
|
|
|
|
|
|
|
} catch (const appexception& e) { |
|
|
} catch (const appexception& e) { |
|
|
AppEventBus::ins()->push(make_shared<AppWarningPromoptEvent>(e)); |
|
|
AppEventBus::ins()->push(make_shared<AppWarningPromoptEvent>(e)); |
|
|
} |
|
|
} |
|
|
GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
if (PORT.isPipeDM()) m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); |
|
|
|
|
|
|
|
|
if (PORT.isPipeDM()) { |
|
|
|
|
|
m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); |
|
|
|
|
|
} |
|
|
} catch (...) { |
|
|
} catch (...) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -93,6 +97,18 @@ void AirLeakDetectTest::airLeakDetectTestThread(int inflationTimeMs) { |
|
|
pressurePa = m_dics->ACPostPS_readPa(); |
|
|
pressurePa = m_dics->ACPostPS_readPa(); |
|
|
ThisThread().sleepForMs(1000); |
|
|
ThisThread().sleepForMs(1000); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_workstate = kstopping; |
|
|
|
|
|
// 放气
|
|
|
|
|
|
logger->info("stoping....."); |
|
|
|
|
|
m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::inflation); |
|
|
|
|
|
m_dics->PosiPressureProp_setValve(50); |
|
|
|
|
|
m_dics->NegaPressureProp_setValve(50); |
|
|
|
|
|
usleep(3000 * 1000); |
|
|
|
|
|
logger->info("stoped"); |
|
|
|
|
|
|
|
|
|
|
|
GET_SERVICE(PipelinePressureControl)->syncPressureValueState(); |
|
|
|
|
|
m_dics->AirLeakDetectTestModeCtrl_setMode(AirLeakTestMode::disinfection); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/*******************************************************************************
|
|
|
/*******************************************************************************
|
|
@ -148,6 +164,11 @@ void AirLeakDetectTest::stopStateReport(shared_ptr<MsgProcessContext> cxt) { |
|
|
} |
|
|
} |
|
|
json AirLeakDetectTest::getState() { |
|
|
json AirLeakDetectTest::getState() { |
|
|
json state; |
|
|
json state; |
|
|
|
|
|
|
|
|
|
|
|
if (getWorkstate() == kidle) { |
|
|
|
|
|
pressurePa = m_dics->ACPostPS_readPa(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
state["pressure"] = pressurePa / 1000.0; |
|
|
state["pressure"] = pressurePa / 1000.0; |
|
|
state["workState"] = state2str(getWorkstate()); |
|
|
state["workState"] = state2str(getWorkstate()); |
|
|
state["workStateDisplay"] = state2chstr(getWorkstate()); |
|
|
state["workStateDisplay"] = state2chstr(getWorkstate()); |
|
|