Browse Source

update

storage-in-realtime
zhaohe 1 year ago
parent
commit
d26b2d498b
  1. 13
      protocol.md
  2. 4
      src/main.cpp
  3. 93
      src/service/device_io_control_service.cpp
  4. 2
      src/service/device_io_control_service.hpp
  5. 2
      transmit_disinfection_public_code

13
protocol.md

@ -17,6 +17,17 @@ ws://192.168.8.10:19001
{"command": "TestPage_WarningLightCtrl","r": 0,"g": 0,"b": 0,"w": 0} {"command": "TestPage_WarningLightCtrl","r": 0,"g": 0,"b": 0,"w": 0}
/*******************************************************************************
* 设备状态 *
*******************************************************************************/
/*******************************************************************************
* 测试页面 *
*******************************************************************************/
拉杆箱消毒剂 拉杆箱消毒剂
-喷液泵转 -喷液泵转
@ -48,7 +59,7 @@ ws://192.168.8.10:19001
-气密性空压机-控制 -气密性空压机-控制
{ {
"command": "DBDBTestPage__sprayAirCompressorPowerCtrl",
"command": "DBDBTestPage__airTightnessTestAirCompressorPowerCtrl",
"params":{ "params":{
"power":1 "power":1
} }

4
src/main.cpp

@ -43,8 +43,8 @@ int Main::main(int argc, char *argv[]) {
} else { } else {
g_in_test = true; g_in_test = true;
} }
g_in_test = true;
logger->info("test_mode:{}:{}", test_mode, g_in_test);
// g_in_test = false;
// logger->info("test_mode:{}:{}", test_mode, g_in_test);
/** /**
* @brief * @brief

93
src/service/device_io_control_service.cpp

@ -192,6 +192,8 @@ void DeviceIoControlService::processReportPacket(uint8_t* packet, size_t len) {
} }
}); });
} else if (cmdpacket->cmdid == kreport_dbdb_ext_valve_board_heart_packet) {
DBDB__extValBoardHeartPacketUpdateTime = zsystem_clock().now();
} }
} }
@ -502,24 +504,91 @@ float DeviceIoControlService::airCompressor_getPressureDirect() {
#endif #endif
#if 0
kcmd_dbdb_liquid_path_ctrl_board_read_pressure_sensor = 1200, // cmd:index(4) ack:pressure(4)
kcmd_dbdb_spray_air_compressor_power_ctrl = 1201, // 喷雾空压机控制 {4:ID}{4:val}
kcmd_dbdb_air_tightness_test_air_compressor_power_ctrl = 1202, // 气密性空压机控制 {4:ID}{4:val}
kcmd_dbdb_heater_ctrl = 1300, // 加热片控制
kcmd_dbdb_heater_ctrl_safe_valve = 1301, // 加热片安全电磁阀
kcmd_dbdb_heater_read_electric_current = 1302, // 加热片读取电流
kcmd_dbdb_heater_read_temperature_data = 1303, // 加热片读取温度
kcmd_dbdb_mini_pwm_blower_ctrl = 1305, // 小鼓风机控制
kcmd_dbdb_mini_pwm_blower_read_fbcount = 1306, // 小鼓风机读取反馈计数
kcmd_dbdb_ext_valve_ctrl = 1307, // 外部阀门控制
#endif
#ifdef PROJECT_TYPE_DRAW_BAR_BOX #ifdef PROJECT_TYPE_DRAW_BAR_BOX
/******************************************************************************* /*******************************************************************************
* - * * - *
*******************************************************************************/ *******************************************************************************/
void DeviceIoControlService::DBDB__sprayLiquidPump_run(int gpm) {}
void DeviceIoControlService::DBDB__sprayLiquidPump_run(int gpm) {
logger->info("DBDB__sprayLiquidPump_run run {}", gpm);
int speed = GPM_TO_SPEED(gpm);
if (speed > 400) {
speed = 400;
} else if (speed < -400) {
speed = -400;
}
m_zcanHost->pumpctrl_c1004(2, 100, speed, 1, 15);
}
int32_t DeviceIoControlService::DBDB__readPressureSensor(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__sprayAirCompressorPowerCtrl(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__airTightnessTestAirCompressorPowerCtrl(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__readPressureSensor(int index) {
int32_t ackcontent = 0;
int ecode = m_zcanHost->call(kcmd_dbdb_liquid_path_ctrl_board_read_pressure_sensor, index, &ackcontent);
if (ecode != 0) {
logger->error("DBDB__readPressureSensor failed %d", ecode);
return 0;
}
return ackcontent;
}
int32_t DeviceIoControlService::DBDB__sprayAirCompressorPowerCtrl(int power) { //
return m_zcanHost->call(kcmd_dbdb_spray_air_compressor_power_ctrl, power, 1);
}
int32_t DeviceIoControlService::DBDB__airTightnessTestAirCompressorPowerCtrl(int power) { return m_zcanHost->call(kcmd_dbdb_air_tightness_test_air_compressor_power_ctrl, power, 1); }
int32_t DeviceIoControlService::DBDB__heaterCtrl(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__heaterCtrlSafeValve(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__heaterReadElectricCurrent() { return 0; }
int32_t DeviceIoControlService::DBDB__heaterReadTemperatureData() { return 0; }
int32_t DeviceIoControlService::DBDB__heaterCtrl(int power) { return m_zcanHost->call(kcmd_dbdb_heater_ctrl, power); }
int32_t DeviceIoControlService::DBDB__heaterCtrlSafeValve(int power) { return m_zcanHost->call(kcmd_dbdb_heater_ctrl_safe_valve, power); }
int32_t DeviceIoControlService::DBDB__heaterReadElectricCurrent() {
int32_t ackcontent = 0;
int ecode = m_zcanHost->call(kcmd_dbdb_heater_read_electric_current, &ackcontent);
if (ecode != 0) {
logger->error("DBDB__heaterReadElectricCurrent failed %d", ecode);
return 0;
}
return ackcontent;
}
int32_t DeviceIoControlService::DBDB__heaterReadTemperatureData() {
int32_t ackcontent = 0;
int ecode = m_zcanHost->call(kcmd_dbdb_heater_read_temperature_data, &ackcontent);
if (ecode != 0) {
logger->error("DBDB__heaterReadTemperatureData failed %d", ecode);
return 0;
}
return ackcontent;
}
int32_t DeviceIoControlService::DBDB__miniPwmBlowerCtrl(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__miniPwmBlowerReadFbcount() { return 0; }
int32_t DeviceIoControlService::DBDB__miniPwmBlowerCtrl(int power100) { return m_zcanHost->call(kcmd_dbdb_mini_pwm_blower_ctrl, power100); }
int32_t DeviceIoControlService::DBDB__miniPwmBlowerReadFbcount() {
int32_t ackcontent = 0;
int ecode = m_zcanHost->call(kcmd_dbdb_mini_pwm_blower_read_fbcount, &ackcontent);
if (ecode != 0) {
logger->error("DBDB__miniPwmBlowerReadFbcount failed %d", ecode);
return 0;
}
return ackcontent;
}
int32_t DeviceIoControlService::DBDB__extValveCtrl(int index) { return 0; }
int32_t DeviceIoControlService::DBDB__extValBoardIsOnline() { return 0; }
int32_t DeviceIoControlService::DBDB__extValveCtrl(int channle) { return m_zcanHost->call(kcmd_dbdb_ext_valve_ctrl, channle); }
// kcmd_dbdb_ping_ext_valve_ctrl
int32_t DeviceIoControlService::DBDB__extValBoardIsOnline() {
if (DBDB__extValBoardHeartPacketUpdateTime.time_since_epoch().count() == 0) {
return 0;
} else if (zsystem_clock().elapsedTimeS(DBDB__extValBoardHeartPacketUpdateTime) > 15) {
return 0;
}
return 1;
}
#endif #endif

2
src/service/device_io_control_service.hpp

@ -98,6 +98,8 @@ class DeviceIoControlService : public IF_DeviceIoContrlService {
int32_t m_airCompressor_channelIndex = 0; int32_t m_airCompressor_channelIndex = 0;
#endif #endif
zsystem_tp DBDB__extValBoardHeartPacketUpdateTime;
public: public:
DeviceIoControlService(); DeviceIoControlService();
virtual void initialize() override; virtual void initialize() override;

2
transmit_disinfection_public_code

@ -1 +1 @@
Subproject commit 349cc71e9d3f14ec7bee878f9aed725e5cafac0a
Subproject commit ee1f8ffe4776735553871c6fe2ac8b65377c9fbc
Loading…
Cancel
Save