|
|
@ -29,9 +29,22 @@ void DeviceIoControlService::startScan() { |
|
|
|
i++; |
|
|
|
|
|
|
|
if (i % 1000 == 0) { |
|
|
|
m_zcanHost->readadc(0, m_adc_0); |
|
|
|
m_zcanHost->readadc(1, m_adc_1); |
|
|
|
m_zcanHost->readadc(2, m_adc_2); |
|
|
|
int adcv = 0; |
|
|
|
|
|
|
|
if (m_zcanHost->readadc(0, adcv) == 0) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
m_adc_0 = adcv; |
|
|
|
} |
|
|
|
if (m_zcanHost->readadc(1, adcv) == 0) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
m_adc_1 = adcv; |
|
|
|
} |
|
|
|
if (m_zcanHost->readadc(2, adcv) == 0) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
m_adc_2 = adcv; |
|
|
|
} |
|
|
|
// m_zcanHost->readadc(1, m_adc_1);
|
|
|
|
// m_zcanHost->readadc(2, m_adc_2);
|
|
|
|
// m_zcanHost->readadc(3, m_adc_3);
|
|
|
|
// m_zcanHost->readadc(4, m_adc_4);
|
|
|
|
// m_zcanHost->readadc(5, m_adc_5);
|
|
|
@ -39,44 +52,41 @@ void DeviceIoControlService::startScan() { |
|
|
|
|
|
|
|
if (i % 3000 == 0) { |
|
|
|
// m_hpp272_data_1
|
|
|
|
m_zcanHost->hpp272_read_c1000(1, m_hpp272_data_1); |
|
|
|
ZCanHost::hpp272_data_t m_hpp272_data_1_cache; |
|
|
|
int suc = m_zcanHost->hpp272_read_c1000(1, m_hpp272_data_1_cache); |
|
|
|
if (suc == 0) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
m_hpp272_data_1 = m_hpp272_data_1_cache; |
|
|
|
} |
|
|
|
// hydrogen_peroxide_volume
|
|
|
|
// h2o_h2o2_rs
|
|
|
|
// temperature1
|
|
|
|
// relative_humidity
|
|
|
|
// absolute_hydrogen_peroxide
|
|
|
|
// h2o_h2o2dew_point_temperature
|
|
|
|
// reserved1
|
|
|
|
// water_volume
|
|
|
|
// water_vapor_pressure
|
|
|
|
// absolute_humidity
|
|
|
|
// water_vapor_saturation_pressure_h2o
|
|
|
|
// temperature2
|
|
|
|
// h2o2_vapor_pressure
|
|
|
|
// water_vapor_saturation_pressure_h2o_h2o2
|
|
|
|
logger->info("---------hpp272_read_c1000---------"); |
|
|
|
logger->info("hydrogen_peroxide_volume :{}", m_hpp272_data_1.hydrogen_peroxide_volume); |
|
|
|
logger->info("h2o_h2o2_rs :{}", m_hpp272_data_1.h2o_h2o2_rs); |
|
|
|
logger->info("temperature1 :{}", m_hpp272_data_1.temperature1); |
|
|
|
logger->info("relative_humidity :{}", m_hpp272_data_1.relative_humidity); |
|
|
|
logger->info("absolute_hydrogen_peroxide :{}", m_hpp272_data_1.absolute_hydrogen_peroxide); |
|
|
|
logger->info("h2o_h2o2dew_point_temperature :{}", m_hpp272_data_1.h2o_h2o2dew_point_temperature); |
|
|
|
logger->info("reserved1 :{}", m_hpp272_data_1.reserved1); |
|
|
|
logger->info("water_volume :{}", m_hpp272_data_1.water_volume); |
|
|
|
logger->info("water_vapor_pressure :{}", m_hpp272_data_1.water_vapor_pressure); |
|
|
|
logger->info("absolute_humidity :{}", m_hpp272_data_1.absolute_humidity); |
|
|
|
logger->info("water_vapor_saturation_pressure_h2o:{}", m_hpp272_data_1.water_vapor_saturation_pressure_h2o); |
|
|
|
logger->info("temperature2 :{}", m_hpp272_data_1.temperature2); |
|
|
|
logger->info("h2o2_vapor_pressure :{}", m_hpp272_data_1.h2o2_vapor_pressure); |
|
|
|
logger->info("water_vapor_saturation_pressure_h2o_h2o2:{}", m_hpp272_data_1.water_vapor_saturation_pressure_h2o_h2o2); |
|
|
|
logger->info(""); |
|
|
|
// logger->info("---------hpp272_read_c1000---------");
|
|
|
|
// logger->info("hydrogen_peroxide_volume :{}", m_hpp272_data_1.hydrogen_peroxide_volume);
|
|
|
|
// logger->info("h2o_h2o2_rs :{}", m_hpp272_data_1.h2o_h2o2_rs);
|
|
|
|
// logger->info("temperature1 :{}", m_hpp272_data_1.temperature1);
|
|
|
|
// logger->info("relative_humidity :{}", m_hpp272_data_1.relative_humidity);
|
|
|
|
// logger->info("absolute_hydrogen_peroxide :{}", m_hpp272_data_1.absolute_hydrogen_peroxide);
|
|
|
|
// logger->info("h2o_h2o2dew_point_temperature :{}", m_hpp272_data_1.h2o_h2o2dew_point_temperature);
|
|
|
|
// logger->info("reserved1 :{}", m_hpp272_data_1.reserved1);
|
|
|
|
// logger->info("water_volume :{}", m_hpp272_data_1.water_volume);
|
|
|
|
// logger->info("water_vapor_pressure :{}", m_hpp272_data_1.water_vapor_pressure);
|
|
|
|
// logger->info("absolute_humidity :{}", m_hpp272_data_1.absolute_humidity);
|
|
|
|
// logger->info("water_vapor_saturation_pressure_h2o:{}", m_hpp272_data_1.water_vapor_saturation_pressure_h2o);
|
|
|
|
// logger->info("temperature2 :{}", m_hpp272_data_1.temperature2);
|
|
|
|
// logger->info("h2o2_vapor_pressure :{}", m_hpp272_data_1.h2o2_vapor_pressure);
|
|
|
|
// logger->info("water_vapor_saturation_pressure_h2o_h2o2:{}", m_hpp272_data_1.water_vapor_saturation_pressure_h2o_h2o2);
|
|
|
|
// logger->info("");
|
|
|
|
} |
|
|
|
|
|
|
|
if (i % 300 == 0) { |
|
|
|
if (readpressuresensor_id == 5) { |
|
|
|
readpressuresensor_id = 1; |
|
|
|
} |
|
|
|
m_zcanHost->huacheng_pressure_sensor_read_c1005(readpressuresensor_id, m_pressure_sensor_data[readpressuresensor_id]); |
|
|
|
ZCanHost::huacheng_pressure_sensor_read_c1005_t sdata; |
|
|
|
if (m_zcanHost->huacheng_pressure_sensor_read_c1005(readpressuresensor_id, sdata) == 0) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
m_pressure_sensor_data[readpressuresensor_id] = sdata; |
|
|
|
} |
|
|
|
readpressuresensor_id++; |
|
|
|
} |
|
|
|
|
|
|
@ -100,17 +110,11 @@ void DeviceIoControlService::airCompressor_setState(bool val) { |
|
|
|
m_zcanHost->writeio(0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int DeviceIoControlService::airCompressor_getio1() { return m_zcanHost->read_writeio_state_cache(1); } |
|
|
|
int DeviceIoControlService::airCompressor_getio2() { return m_zcanHost->read_writeio_state_cache(2); } |
|
|
|
int DeviceIoControlService::airCompressor_getio1() { return m_zcanHost->read_writeio_state_cache(0); } |
|
|
|
int DeviceIoControlService::airCompressor_getio2() { return m_zcanHost->read_writeio_state_cache(1); } |
|
|
|
int DeviceIoControlService::airCompressor_getcurrentValue() { return m_adc_0 * 0.00167 - 1.25; } |
|
|
|
int DeviceIoControlService::airCompressor_getstate() { return m_zcanHost->read_writeio_state_cache(1) && m_zcanHost->read_writeio_state_cache(2); } |
|
|
|
int DeviceIoControlService::airCompressor_getstate() { return m_zcanHost->read_writeio_state_cache(0) && m_zcanHost->read_writeio_state_cache(1); } |
|
|
|
|
|
|
|
int DeviceIoControlService::airBlower_getio1() { return m_zcanHost->read_writeio_state_cache(3); } |
|
|
|
int DeviceIoControlService::airBlower_getio2() { return m_zcanHost->read_writeio_state_cache(4); } |
|
|
|
int DeviceIoControlService::airBlower_getstate() { return m_zcanHost->read_writeio_state_cache(3) && m_zcanHost->read_writeio_state_cache(4); } |
|
|
|
|
|
|
|
int DeviceIoControlService::airBlower_getcurrentValue() { return m_adc_1 * 0.00167 - 1.25; } |
|
|
|
int DeviceIoControlService::airBlower_setState(bool val) { |
|
|
|
logger->info("airBlower_setState:{}", val); |
|
|
|
if (val) { |
|
|
@ -124,12 +128,12 @@ int DeviceIoControlService::airBlower_setState(bool val) { |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
int DeviceIoControlService::airBlower_getio1() { return m_zcanHost->read_writeio_state_cache(2); } |
|
|
|
int DeviceIoControlService::airBlower_getio2() { return m_zcanHost->read_writeio_state_cache(3); } |
|
|
|
int DeviceIoControlService::airBlower_getstate() { return m_zcanHost->read_writeio_state_cache(2) && m_zcanHost->read_writeio_state_cache(3); } |
|
|
|
|
|
|
|
int DeviceIoControlService::airBlower_getcurrentValue() { return m_adc_1 * 0.00167 - 1.25; } |
|
|
|
// heatingStrip
|
|
|
|
int DeviceIoControlService::heatingStrip_getio1() { return m_zcanHost->read_writeio_state_cache(5); } |
|
|
|
int DeviceIoControlService::heatingStrip_getio2() { return m_zcanHost->read_writeio_state_cache(6); } |
|
|
|
int DeviceIoControlService::heatingStrip_getstate() { return m_zcanHost->read_writeio_state_cache(5) && m_zcanHost->read_writeio_state_cache(6); } |
|
|
|
int DeviceIoControlService::heatingStrip_getcurrentValue() { return m_adc_2 * 0.00336 - 2.5; } |
|
|
|
void DeviceIoControlService::heartingPlate_setPower(bool val) { |
|
|
|
logger->info("heartingPlate_setPower:{}", val); |
|
|
|
if (val) { |
|
|
@ -142,8 +146,11 @@ void DeviceIoControlService::heartingPlate_setPower(bool val) { |
|
|
|
m_zcanHost->writeio(4, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int DeviceIoControlService::sprayLiquidPump_getRPM() { return m_zcanHost->pumpctrl_c1004_get_speed_cache(2); } |
|
|
|
int DeviceIoControlService::heatingStrip_getio1() { return m_zcanHost->read_writeio_state_cache(4); } |
|
|
|
int DeviceIoControlService::heatingStrip_getio2() { return m_zcanHost->read_writeio_state_cache(5); } |
|
|
|
int DeviceIoControlService::heatingStrip_getstate() { return m_zcanHost->read_writeio_state_cache(4) && m_zcanHost->read_writeio_state_cache(5); } |
|
|
|
int DeviceIoControlService::heatingStrip_getcurrentValue() { return m_adc_2 * 0.00336 - 2.5; } |
|
|
|
//
|
|
|
|
int DeviceIoControlService::getChargingPump_PumpRPM() { return m_zcanHost->pumpctrl_c1004_get_speed_cache(1); } |
|
|
|
|
|
|
|
void DeviceIoControlService::drainingPump_open() { |
|
|
@ -172,12 +179,18 @@ void DeviceIoControlService::sprayLiquidPump_close() { |
|
|
|
logger->info("sprayLiquidPump_close"); |
|
|
|
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_getState() { //
|
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
return (sprayLiquidPump_getRPM() != 0); |
|
|
|
} |
|
|
|
|
|
|
|
int DeviceIoControlService::getDisinfectantVolume_g() { |
|
|
|
// kpa;
|
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
float kpa = m_pressure_sensor_data[1].value / 1000.0; |
|
|
|
int g = 2.11 * kpa * 1000; |
|
|
|
if (g < 450) { /*零点*/ |
|
|
@ -187,12 +200,26 @@ int DeviceIoControlService::getDisinfectantVolume_g() { |
|
|
|
} |
|
|
|
return g; |
|
|
|
} |
|
|
|
int DeviceIoControlService::getPressureSensorData(int index) { return m_pressure_sensor_data[index].value; } |
|
|
|
int DeviceIoControlService::getPressureSensorData(int index) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
return m_pressure_sensor_data[index].value; |
|
|
|
} |
|
|
|
|
|
|
|
int DeviceIoControlService::getWaterImmersionSensor1() { return m_waterImmersionSensor1 ? 1 : 0; } |
|
|
|
int DeviceIoControlService::getWaterImmersionSensor2() { return m_waterImmersionSensor2 ? 1 : 0; } |
|
|
|
int DeviceIoControlService::getWaterImmersionSensor1() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
return m_waterImmersionSensor1 ? 1 : 0; |
|
|
|
} |
|
|
|
int DeviceIoControlService::getWaterImmersionSensor2() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
return m_waterImmersionSensor2 ? 1 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
DeviceIoControlService::h2o2sensor_data_t DeviceIoControlService::getH2O2SenSorData1() { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
DeviceIoControlService::h2o2sensor_data_t data; |
|
|
|
// int16_t hydrogen_peroxide_volume; // ppm 0x0100 过氧化氢浓度
|
|
|
|
// int16_t h2o_h2o2_rs; // %RS * 100 0x0101 过氧化氢相对饱和度
|
|
|
@ -206,12 +233,14 @@ DeviceIoControlService::h2o2sensor_data_t DeviceIoControlService::getH2O2SenSorD |
|
|
|
} |
|
|
|
|
|
|
|
bool DeviceIoControlService::getAllSensorData(DeviceIoControlService::all_h2o2sensor_data_t& data) { |
|
|
|
lock_guard<recursive_mutex> lock(lock_); |
|
|
|
|
|
|
|
data = {0}; |
|
|
|
data.h2o2sensor_data[0] = getH2O2SenSorData1(); |
|
|
|
data.h2o2sensor_status[0] = true; |
|
|
|
|
|
|
|
data.h2o2sensor_status[1] = true; |
|
|
|
data.h2o2sensor_status[2] = true; |
|
|
|
data.h2o2sensor_status[1] = false; |
|
|
|
data.h2o2sensor_status[2] = false; |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 找到最小的过氧化氢浓度 |
|
|
|