|
@ -12,7 +12,7 @@ using namespace iflytop; |
|
|
using namespace std; |
|
|
using namespace std; |
|
|
|
|
|
|
|
|
#define GPM_TO_SPEED(gpm) (gpm * 14.7)
|
|
|
#define GPM_TO_SPEED(gpm) (gpm * 14.7)
|
|
|
#define SPEED_TO_GPM(speed) (speed / 14.7)
|
|
|
|
|
|
|
|
|
#define SPEED_TO_GPM(speed) ((speed / 14.7) + 0.5)
|
|
|
|
|
|
|
|
|
static inline int filter(int data) { |
|
|
static inline int filter(int data) { |
|
|
static list<int> q; |
|
|
static list<int> q; |
|
@ -391,8 +391,12 @@ void DeviceIoControlService::replenishingFluidsPump_close_for_test() { |
|
|
/*******************************************************************************
|
|
|
/*******************************************************************************
|
|
|
* sprayLiquidPump * |
|
|
* sprayLiquidPump * |
|
|
*******************************************************************************/ |
|
|
*******************************************************************************/ |
|
|
|
|
|
static int32_t SprayLiquidPump__gpm; |
|
|
|
|
|
|
|
|
void DeviceIoControlService::sprayLiquidPump_open(int gpm) { |
|
|
void DeviceIoControlService::sprayLiquidPump_open(int gpm) { |
|
|
logger->info("sprayLiquidPump_open {}", gpm); |
|
|
logger->info("sprayLiquidPump_open {}", gpm); |
|
|
|
|
|
SprayLiquidPump__gpm = gpm; |
|
|
|
|
|
|
|
|
int speed = GPM_TO_SPEED(gpm); |
|
|
int speed = GPM_TO_SPEED(gpm); |
|
|
if (speed > 400) { |
|
|
if (speed > 400) { |
|
|
speed = 400; |
|
|
speed = 400; |
|
@ -403,6 +407,7 @@ void DeviceIoControlService::sprayLiquidPump_open(int gpm) { |
|
|
} |
|
|
} |
|
|
void DeviceIoControlService::sprayLiquidPump_close() { |
|
|
void DeviceIoControlService::sprayLiquidPump_close() { |
|
|
logger->info("sprayLiquidPump_close"); |
|
|
logger->info("sprayLiquidPump_close"); |
|
|
|
|
|
SprayLiquidPump__gpm = 0; |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 15); |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 15); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -414,15 +419,17 @@ void DeviceIoControlService::sprayLiquidPump_open_for_test(int gpm) { |
|
|
} else if (speed < -400) { |
|
|
} else if (speed < -400) { |
|
|
speed = -400; |
|
|
speed = -400; |
|
|
} |
|
|
} |
|
|
|
|
|
SprayLiquidPump__gpm = gpm; |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, speed, 1, 15); |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, speed, 1, 15); |
|
|
} |
|
|
} |
|
|
void DeviceIoControlService::sprayLiquidPump_close_for_test() { |
|
|
void DeviceIoControlService::sprayLiquidPump_close_for_test() { |
|
|
logger->info("sprayLiquidPump_close"); |
|
|
logger->info("sprayLiquidPump_close"); |
|
|
|
|
|
SprayLiquidPump__gpm = 0; |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 15); |
|
|
m_zcanHost->pumpctrl_c1004(2, 100, 0, 1, 15); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getRPM() { return m_zcanHost->pumpctrl_c1004_get_speed_cache(2); } |
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getGPM() { return SPEED_TO_GPM(sprayLiquidPump_getRPM()); } |
|
|
|
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getRPM() { return GPM_TO_SPEED(SprayLiquidPump__gpm); } |
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getGPM() { return SprayLiquidPump__gpm; } |
|
|
|
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getState() { //
|
|
|
int DeviceIoControlService::sprayLiquidPump_getState() { //
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|