From 88c57e4c89fbde1ec1c00efbe508753e6432b349 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sun, 11 Aug 2024 00:07:31 +0800 Subject: [PATCH] update protocol --- transmit_disfection_protocol.hpp | 61 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/transmit_disfection_protocol.hpp b/transmit_disfection_protocol.hpp index 6be60b3..6b43c93 100644 --- a/transmit_disfection_protocol.hpp +++ b/transmit_disfection_protocol.hpp @@ -212,10 +212,11 @@ typedef enum { /*********************************************************************************************************************** * 压力传感器数据上报 * ***********************************************************************************************************************/ - kfn_psbus_read_data = 1300, // cmd:subid ack:pressure(0.1pa) - kfn_psbus_set_report_period_ms = 1301, // cmd:period - kfn_psbus_scan = 1302, // - kreport_pressure_data = 1350, // report:subid pressure(0.1pa) + kfn_psbus_read_data = 1300, // cmd:subid ack:pressure(0.1pa) + kfn_psbus_scan = 1302, // + kfn_psbus_start_report = 1303, // cmd:period + kfn_psbus_stop_report = 1304, // cmd:period + kreport_pressure_data = 1350, // report:subid pressure(0.1pa) /*********************************************************************************************************************** * 比例阀控制 * @@ -273,9 +274,57 @@ typedef struct { uint16_t sysHasRun; } ack_sysinfo_t; +static inline const char* protocolType2Str(int type) { + switch (type) { + case 0: + return "P100"; + case 1: + return "DP600"; + case 2: + return "OTHERS"; + default: + return "UNKNOWN"; + } +} + +static inline const char* p100uint2Str(uint8_t uint) { + switch (uint) { + case 0: + return "Mpa"; + case 1: + return "kpa"; + case 2: + return "pa"; + case 3: + return "bar"; + case 4: + return "Mbar"; + case 5: + return "kgcm2"; + case 6: + return "psi"; + case 7: + return "mh2o"; + case 8: + return "mh2o"; + default: + return "UNKNOWN"; + } +} + +// ptype:P100 precision:1 unit:kpa zero:-900 full:1000 +typedef struct { + uint8_t isOnline; + uint8_t subid; + uint8_t ptype; + uint8_t precision; + int16_t zero; + int16_t full; +} ps_info_t; + typedef struct { - uint8_t numOnlineId; - uint8_t onlineId[10]; + uint8_t numOnlineId; + ps_info_t sensor[10]; } ack_psbus_scan_t; /***********************************************************************************************************************