|
|
@ -16,11 +16,11 @@ using namespace core; |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
static bool isInPc() { |
|
|
|
static bool isInDevice() { |
|
|
|
#if (defined BUILD_ON_PC) // x86平台
|
|
|
|
return true; |
|
|
|
#else
|
|
|
|
return false; |
|
|
|
#else
|
|
|
|
return true; |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
@ -36,7 +36,7 @@ static bool isInPc() { |
|
|
|
|
|
|
|
void DeviceIoControlService::initialize() { |
|
|
|
GET_TO_SERVICE(m_config); |
|
|
|
if (isInPc()) { |
|
|
|
if (!isInDevice()) { |
|
|
|
logger->warn("run in pc, skip initialize device io control service"); |
|
|
|
return; |
|
|
|
} else { |
|
|
@ -49,6 +49,7 @@ void DeviceIoControlService::initialize() { |
|
|
|
processReportMsg(from, hex, hexlen); |
|
|
|
} |
|
|
|
}); |
|
|
|
REGFNV2(DeviceIoControlService, test); |
|
|
|
} |
|
|
|
void DeviceIoControlService::processReportMsg(uint8_t from, uint8_t *hex, uint32_t hexlen) { //
|
|
|
|
zcanbus_packet_t *packet = (zcanbus_packet_t *)hex; |
|
|
@ -67,126 +68,109 @@ void DeviceIoControlService::processReportMsg(uint8_t from, uint8_t *hex, uint32 |
|
|
|
// 加液泵控制
|
|
|
|
#define COMPONENT HardwareComponent::AddLiquidPump
|
|
|
|
void DeviceIoControlService::AddLiquidPump_addLiquid() { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
int pumpspeed = GET_SETTING(int, SettingId::drainage_pump_speed); |
|
|
|
CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), pumpspeed); |
|
|
|
logger->info("AddLiquidPump_addLiquid, pumpspeed={}", pumpspeed); |
|
|
|
|
|
|
|
if (isInDevice()) CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), pumpspeed); |
|
|
|
} |
|
|
|
void DeviceIoControlService::AddLiquidPump_drainLiquid() { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
int pumpspeed = GET_SETTING(int, SettingId::drainage_pump_speed); |
|
|
|
CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), -pumpspeed); |
|
|
|
logger->info("AddLiquidPump_drainLiquid, pumpspeed={}", -pumpspeed); |
|
|
|
|
|
|
|
if (isInDevice()) CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), -pumpspeed); |
|
|
|
} |
|
|
|
void DeviceIoControlService::AddLiquidPump_run(int rpm) { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), rpm); |
|
|
|
logger->info("AddLiquidPump_run, rpm={}", rpm); |
|
|
|
if (isInDevice()) CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), rpm); |
|
|
|
} |
|
|
|
|
|
|
|
void DeviceIoControlService::AddLiquidPump_stop() { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->pumpStop(GET_BOARDID(), GET_SUBID()); |
|
|
|
logger->info("AddLiquidPump_stop"); |
|
|
|
if (isInDevice()) CAN_MASTER->pumpStop(GET_BOARDID(), GET_SUBID()); |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
// 喷雾泵控制
|
|
|
|
#define COMPONENT HardwareComponent::SprayPump
|
|
|
|
void DeviceIoControlService::SprayPump_start(int32_t gpm) { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
int pumpspeed_rpm = ProjectPort::ins().gpm2speed(gpm); |
|
|
|
CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), pumpspeed_rpm); |
|
|
|
logger->info("SprayPump_start, gpm={}, rpm={}", gpm, pumpspeed_rpm); |
|
|
|
if (isInDevice()) CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), pumpspeed_rpm); |
|
|
|
} |
|
|
|
void DeviceIoControlService::SprayPump_stop() { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->pumpStop(GET_BOARDID(), GET_SUBID()); |
|
|
|
logger->info("SprayPump_stop"); |
|
|
|
if (isInDevice()) CAN_MASTER->pumpStop(GET_BOARDID(), GET_SUBID()); |
|
|
|
} |
|
|
|
void DeviceIoControlService::SprayPump_startInRPM(int32_t rpm) { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), rpm); |
|
|
|
logger->info("SprayPump_startInRPM, rpm={}", rpm); |
|
|
|
if (isInDevice()) CAN_MASTER->pumpRotate(GET_BOARDID(), GET_SUBID(), rpm); |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
// 鼓风机控制
|
|
|
|
#define COMPONENT HardwareComponent::Blower
|
|
|
|
void DeviceIoControlService::Blower_ctrl(int power) { |
|
|
|
if (isInPc()) return; |
|
|
|
CAN_MASTER->blowerCtrl(GET_BOARDID(), power); |
|
|
|
logger->info("Blower_ctrl, power={}", power); |
|
|
|
if (isInDevice()) CAN_MASTER->blowerCtrl(GET_BOARDID(), power); |
|
|
|
usleep(1000 * 1000); |
|
|
|
} |
|
|
|
void DeviceIoControlService::Blower_close() { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->blowerCtrl(GET_BOARDID(), 0); |
|
|
|
logger->info("Blower_close"); |
|
|
|
if (isInDevice()) CAN_MASTER->blowerCtrl(GET_BOARDID(), 0); |
|
|
|
} |
|
|
|
float DeviceIoControlService::Blower_readEI() { |
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
return CAN_MASTER->blowerReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
logger->info("Blower_readEI"); |
|
|
|
if (isInDevice()) return CAN_MASTER->blowerReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
// 空压机控制
|
|
|
|
#define COMPONENT HardwareComponent::AirCompressor
|
|
|
|
void DeviceIoControlService::AC_ctrl(int power) { |
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->airCompressorCtrl(GET_BOARDID(), power); |
|
|
|
logger->info("AC_ctrl, power={}", power); |
|
|
|
if (isInDevice()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), power); |
|
|
|
usleep(1000 * 1000); |
|
|
|
} |
|
|
|
void DeviceIoControlService::AC_close() { |
|
|
|
if (isInPc()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
CAN_MASTER->airCompressorCtrl(GET_BOARDID(), 0); |
|
|
|
logger->info("AC_close"); |
|
|
|
if (isInDevice()) CAN_MASTER->airCompressorCtrl(GET_BOARDID(), 0); |
|
|
|
} |
|
|
|
float DeviceIoControlService::AC_readEI() { |
|
|
|
if (isInPc()) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
return CAN_MASTER->airCompressorReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
logger->info("AC_readEI"); |
|
|
|
if (isInDevice()) return CAN_MASTER->airCompressorReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
// 加热器控制
|
|
|
|
#define COMPONENT HardwareComponent::Heater
|
|
|
|
void DeviceIoControlService::Heater_ctrl(int power) { |
|
|
|
if (isInPc()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
CAN_MASTER->heaterCtrl(GET_BOARDID(), power); |
|
|
|
logger->info("Heater_ctrl, power={}", power); |
|
|
|
if (isInDevice()) CAN_MASTER->heaterCtrl(GET_BOARDID(), power); |
|
|
|
usleep(1000 * 1000); |
|
|
|
} |
|
|
|
void DeviceIoControlService::Heater_close() { |
|
|
|
if (isInPc()) { |
|
|
|
return; |
|
|
|
} |
|
|
|
CAN_MASTER->heaterCtrl(GET_BOARDID(), 0); |
|
|
|
logger->info("Heater_close"); |
|
|
|
if (isInDevice()) CAN_MASTER->heaterCtrl(GET_BOARDID(), 0); |
|
|
|
} |
|
|
|
float DeviceIoControlService::Heater_readEI() { |
|
|
|
if (isInPc()) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
return CAN_MASTER->heaterReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
logger->info("Heater_readEI"); |
|
|
|
if (isInDevice()) return CAN_MASTER->heaterReadEI(GET_BOARDID()) / 1000.0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
float DeviceIoControlService::Heater_readTemperature() { |
|
|
|
if (isInPc()) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
return CAN_MASTER->heaterReadTemperature(GET_BOARDID()) / 10.0; |
|
|
|
logger->info("Heater_readTemperature"); |
|
|
|
if (isInDevice()) return CAN_MASTER->heaterReadTemperature(GET_BOARDID()) / 10.0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
// 三色指示灯控制
|
|
|
|
#define COMPONENT HardwareComponent::WarningLight
|
|
|
|
void DeviceIoControlService::WarningLight_setState(int r, int g, int b, int warning) { //
|
|
|
|
if (isInPc()) return; |
|
|
|
|
|
|
|
CAN_MASTER->warningLightSetState(GET_BOARDID(), r, g, b, warning); |
|
|
|
logger->info("WarningLight_setState, r={}, g={}, b={}, warning={}", r, g, b, warning); |
|
|
|
if (isInDevice()) CAN_MASTER->warningLightSetState(GET_BOARDID(), r, g, b, warning); |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
@ -197,50 +181,53 @@ void DeviceIoControlService::WarningLight_setState(int r, int g, int b, int warn |
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::PositivePressureProportional
|
|
|
|
void DeviceIoControlService::PosiPressureProp_setValve(int valveValue) { //
|
|
|
|
if (isInPc()) return; |
|
|
|
valveValue = valveValue / 100.0 * 255; |
|
|
|
CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); |
|
|
|
logger->info("PosiPressureProp_setValve, valveValue={}", valveValue); |
|
|
|
if (isInDevice()) CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); |
|
|
|
} |
|
|
|
int DeviceIoControlService::PosiPressureProp_readPos() { |
|
|
|
if (isInPc()) return 0; |
|
|
|
int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); |
|
|
|
pos = pos / 255.0 * 100; |
|
|
|
return pos; |
|
|
|
if (isInDevice()) { |
|
|
|
int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); |
|
|
|
pos = pos / 255.0 * 100; |
|
|
|
return pos; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
bool DeviceIoControlService::PosiPressureProp_isBusy() { |
|
|
|
if (isInPc()) return false; |
|
|
|
return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); |
|
|
|
if (isInDevice()) return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::NegativePressureProportional
|
|
|
|
void DeviceIoControlService::NegaPressureProp_setValve(int valveValue) { |
|
|
|
if (isInPc()) return; |
|
|
|
valveValue = valveValue / 100.0 * 255; |
|
|
|
CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); |
|
|
|
logger->info("NegaPressureProp_setValve, valveValue={}", valveValue); |
|
|
|
if (isInDevice()) CAN_MASTER->proportionalSetValve(GET_BOARDID(), GET_SUBID(), valveValue); |
|
|
|
} |
|
|
|
int DeviceIoControlService::NegaPressureProp_readPos() { |
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); |
|
|
|
pos = pos / 255.0 * 100; |
|
|
|
return pos; |
|
|
|
if (isInDevice()) { |
|
|
|
int pos = CAN_MASTER->proportionalReadPos(GET_BOARDID(), GET_SUBID()); |
|
|
|
pos = pos / 255.0 * 100; |
|
|
|
return pos; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
bool DeviceIoControlService::NegaPressureProp_isBusy() { |
|
|
|
if (isInPc()) return false; |
|
|
|
return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); |
|
|
|
if (isInDevice()) return CAN_MASTER->proportionalIsBusy(GET_BOARDID(), GET_SUBID()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::AirLeakDetectTestModeCtrl
|
|
|
|
|
|
|
|
void DeviceIoControlService::AirLeakDetectTestModeCtrl_setMode(int mode) { |
|
|
|
if (isInPc()) return; |
|
|
|
CAN_MASTER->airLeakDetectTestSetMode(GET_BOARDID(), mode); |
|
|
|
logger->info("AirLeakDetectTestModeCtrl_setMode, mode={}", mode); |
|
|
|
if (isInDevice()) CAN_MASTER->airLeakDetectTestSetMode(GET_BOARDID(), mode); |
|
|
|
} |
|
|
|
int DeviceIoControlService::AirLeakDetectTestModeCtrl_getMode() { |
|
|
|
if (isInPc()) return 0; |
|
|
|
return CAN_MASTER->airLeakDetectTestGetMode(GET_BOARDID()); |
|
|
|
if (isInDevice()) return CAN_MASTER->airLeakDetectTestGetMode(GET_BOARDID()); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
#undef COMPONENT
|
|
|
@ -248,23 +235,28 @@ int DeviceIoControlService::AirLeakDetectTestModeCtrl_getMode() { |
|
|
|
// ExtChSelector
|
|
|
|
#define COMPONENT HardwareComponent::ExtChSelector
|
|
|
|
void DeviceIoControlService::ExtChSelector_selectCh(int ch) { |
|
|
|
if (isInPc()) return; |
|
|
|
CAN_MASTER->extChSelectorSetCh(GET_BOARDID(), ch); |
|
|
|
logger->info("ExtChSelector_selectCh, ch={}", ch); |
|
|
|
if (isInDevice()) CAN_MASTER->extChSelectorSetCh(GET_BOARDID(), ch); |
|
|
|
} |
|
|
|
|
|
|
|
bool DeviceIoControlService::ExtChSelector_isOnline() { |
|
|
|
if (isInPc()) return false; |
|
|
|
try { |
|
|
|
CAN_MASTER->extChSelectorGetCh(GET_BOARDID()); |
|
|
|
return true; |
|
|
|
} catch (const std::exception &e) { |
|
|
|
return false; |
|
|
|
if (isInDevice()) { |
|
|
|
try { |
|
|
|
CAN_MASTER->extChSelectorGetCh(GET_BOARDID()); |
|
|
|
return true; |
|
|
|
} catch (const std::exception &e) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
void DeviceIoControlService::ExtChSelector_trySelectCh(int ch) { |
|
|
|
try { |
|
|
|
ExtChSelector_selectCh(GET_BOARDID()); |
|
|
|
} catch (const std::exception &e) { |
|
|
|
logger->info("ExtChSelector_trySelectCh, ch={}", ch); |
|
|
|
if (isInDevice()) { |
|
|
|
try { |
|
|
|
ExtChSelector_selectCh(GET_BOARDID()); |
|
|
|
} catch (const std::exception &e) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -275,66 +267,128 @@ void DeviceIoControlService::ExtChSelector_trySelectCh(int ch) { |
|
|
|
// 蒸发仓水浸
|
|
|
|
#define COMPONENT HardwareComponent::EvaporationBinWS
|
|
|
|
bool DeviceIoControlService::WaterSensor_readEvaporationBin() { |
|
|
|
if (isInPc()) return false; |
|
|
|
return CAN_MASTER->evaporationTankWSReadState(GET_BOARDID()); |
|
|
|
if (isInDevice()) return CAN_MASTER->evaporationTankWSReadState(GET_BOARDID()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::DeviceBottomWS
|
|
|
|
bool DeviceIoControlService::WaterSensor_readDeviceBottom() { |
|
|
|
if (isInPc()) return false; |
|
|
|
return CAN_MASTER->bottomWSReadState(GET_BOARDID()); |
|
|
|
if (isInDevice()) return CAN_MASTER->bottomWSReadState(GET_BOARDID()); |
|
|
|
return false; |
|
|
|
} // 设备底部水浸
|
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::ACPostPS
|
|
|
|
int DeviceIoControlService::ACPostPS_readPa() { //
|
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().ACPostPS_To_Pa(val); |
|
|
|
if (isInDevice()) { |
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().ACPostPS_To_Pa(val); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::AirLeakDetectPS
|
|
|
|
int DeviceIoControlService::AirLeakDetectPS_readPa() { //
|
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().AirLeakDetectPS_To_Pa(val); |
|
|
|
if (isInDevice()) { |
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().AirLeakDetectPS_To_Pa(val); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::LiquidWeightPS
|
|
|
|
int DeviceIoControlService::LiquidWeightPS_readPa() { //
|
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().LiquidWeightPS_To_Pa(val); |
|
|
|
if (isInDevice()) { |
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().LiquidWeightPS_To_Pa(val); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::SprayPumpPostPS
|
|
|
|
int DeviceIoControlService::SprayPumpPostPS_readPa() { //
|
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().SprayPumpPostPS_To_Pa(val); |
|
|
|
if (isInDevice()) { |
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().SprayPumpPostPS_To_Pa(val); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
#define COMPONENT HardwareComponent::AddLiquidPumpPostPS
|
|
|
|
int DeviceIoControlService::AddLiquidPumpPostPS_readPa() { //
|
|
|
|
if (isInPc()) return 0; |
|
|
|
|
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().AddLiquidPumpPostPS_To_Pa(val); |
|
|
|
if (isInDevice()) { |
|
|
|
int32_t val = CAN_MASTER->psBusReadData(GET_BOARDID(), GET_SUBID()); |
|
|
|
return ProjectPort::ins().AddLiquidPumpPostPS_To_Pa(val); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
#undef COMPONENT
|
|
|
|
|
|
|
|
int DeviceIoControlService::DisinfectantVolume_readVal() { |
|
|
|
if (isInPc()) return 0; |
|
|
|
// int DeviceIoControlService::DisinfectantVolume_readVal() {
|
|
|
|
// if (isInDevice()) {
|
|
|
|
// int pa = LiquidWeightPS_readPa();
|
|
|
|
// return ProjectPort::ins().pressurePa2VolumeG(pa);
|
|
|
|
// }
|
|
|
|
// return 0;
|
|
|
|
// } // g
|
|
|
|
|
|
|
|
#define PROCESS_CMD(fnName, ...) \
|
|
|
|
if (testFnName == #fnName) { \ |
|
|
|
fnName(__VA_ARGS__); \ |
|
|
|
return; \ |
|
|
|
} |
|
|
|
|
|
|
|
#define PROCESS_CMD_WITH_RET(fnName, ...) \
|
|
|
|
if (testFnName == #fnName) { \ |
|
|
|
auto ret = fnName(__VA_ARGS__); \ |
|
|
|
cxt->content = ret; \ |
|
|
|
return; \ |
|
|
|
} |
|
|
|
|
|
|
|
int pa = LiquidWeightPS_readPa(); |
|
|
|
return ProjectPort::ins().pressurePa2VolumeG(pa); |
|
|
|
} // g
|
|
|
|
void DeviceIoControlService::fn_test(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
//
|
|
|
|
string testFnName = cxt->params["testFnName"]; |
|
|
|
json param = cxt->params["testFnParams"]; |
|
|
|
|
|
|
|
PROCESS_CMD(AddLiquidPump_addLiquid); |
|
|
|
PROCESS_CMD(AddLiquidPump_run, param[0]); |
|
|
|
PROCESS_CMD(AddLiquidPump_drainLiquid); |
|
|
|
PROCESS_CMD(AddLiquidPump_stop); |
|
|
|
PROCESS_CMD(SprayPump_start, param[0]); |
|
|
|
PROCESS_CMD(SprayPump_startInRPM, param[0]); |
|
|
|
PROCESS_CMD(SprayPump_stop); |
|
|
|
PROCESS_CMD(Blower_ctrl, param[0]); |
|
|
|
PROCESS_CMD(Blower_close); |
|
|
|
PROCESS_CMD_WITH_RET(Blower_readEI); |
|
|
|
PROCESS_CMD(AC_ctrl, param[0]); |
|
|
|
PROCESS_CMD(AC_close); |
|
|
|
PROCESS_CMD_WITH_RET(AC_readEI); |
|
|
|
PROCESS_CMD(Heater_ctrl, param[0]); |
|
|
|
PROCESS_CMD(Heater_close); |
|
|
|
PROCESS_CMD_WITH_RET(Heater_readEI); |
|
|
|
PROCESS_CMD_WITH_RET(Heater_readTemperature); |
|
|
|
PROCESS_CMD(WarningLight_setState, param[0], param[1], param[2], param[3]); |
|
|
|
PROCESS_CMD(PosiPressureProp_setValve, param[0]); |
|
|
|
PROCESS_CMD_WITH_RET(PosiPressureProp_readPos); |
|
|
|
PROCESS_CMD_WITH_RET(PosiPressureProp_isBusy); |
|
|
|
PROCESS_CMD(NegaPressureProp_setValve, param[0]); |
|
|
|
PROCESS_CMD_WITH_RET(NegaPressureProp_readPos); |
|
|
|
PROCESS_CMD_WITH_RET(NegaPressureProp_isBusy); |
|
|
|
PROCESS_CMD(AirLeakDetectTestModeCtrl_setMode, param[0]); |
|
|
|
PROCESS_CMD_WITH_RET(AirLeakDetectTestModeCtrl_getMode); |
|
|
|
PROCESS_CMD(ExtChSelector_selectCh, param[0]); |
|
|
|
PROCESS_CMD(ExtChSelector_trySelectCh, param[0]); |
|
|
|
PROCESS_CMD_WITH_RET(ExtChSelector_isOnline); |
|
|
|
PROCESS_CMD_WITH_RET(WaterSensor_readEvaporationBin); |
|
|
|
PROCESS_CMD_WITH_RET(WaterSensor_readDeviceBottom); |
|
|
|
PROCESS_CMD_WITH_RET(ACPostPS_readPa); |
|
|
|
PROCESS_CMD_WITH_RET(AirLeakDetectPS_readPa); |
|
|
|
PROCESS_CMD_WITH_RET(LiquidWeightPS_readPa); |
|
|
|
PROCESS_CMD_WITH_RET(SprayPumpPostPS_readPa); |
|
|
|
PROCESS_CMD_WITH_RET(AddLiquidPumpPostPS_readPa); |
|
|
|
} |