Commit 8ee357ee authored by Tim Powell's avatar Tim Powell

Update the UI comms to match MCU packets

Correct packet formats to match updated versions in the MCU code.
Also edited some fields to support larger values (e.g. alarm codes).
parent 6d78f696
Pipeline #2502 failed with stages
......@@ -61,12 +61,11 @@ class CMD_TYPE(Enum):
GET_THRESHOLD_MIN = 16
GET_THRESHOLD_MAX = 17
TEST_AUDIO_ALARM = 18
SKIP_NEXT_CALIBRATION = 19
DO_CALIBRATION = 20
MUTE_ALARM = 21
RESET_ALARM = 22
SET_VOLUME = 23
GET_EXPERT_INFO = 24
DO_CALIBRATION = 19
MUTE_ALARM = 20
RESET_ALARM = 21
SET_VOLUME = 22
GET_EXPERT_INFO = 23
......@@ -217,7 +216,22 @@ class ALARM_CODES(Enum):
HIGH_VMI = 29 # MP
LOW_VMI = 30 # MP
EXTENDED_HIGH_PRESSURE = 31 # HP
ALARMS_COUNT = 32
AIR_SUPPLY_PRESSURE_READING_FAILURE = 32 # FP
AIR_REGULATED_PRESSURE_READING_FAILURE = 33 # FP
O2_SUPPLY_PRESSURE_READING_FAILURE = 34 # FP
O2_REGULATED_PRESSURE_READING_FAILURE = 35 # FP
BUFFER_PRESSURE_READING_FAILURE = 36 # FP
INHALE_PRESSURE_READING_FAILURE = 37 # FP
PATIENT_PRESSURE_READING_FAILURE = 38 # FP
BUFFER_TEMPERATURE_READING_FAILURE = 39 # FP
PATIENT_PRESSURE_DIFF_READING_FAILURE = 40 # FP
O2_PERCENT_READING_FAILURE = 41 # FP
OPERATIONAL_TIME_EXCEEDED = 42 # LP
CASE_TEMPERATURE_OVERHEAT = 43 # LP
ALARMS_COUNT = 44
......@@ -321,6 +335,7 @@ class PayloadFormat:
13: PersonalFormat,
14: AlarmMuteFormat,
15: BadThresholdFormat,
16: ExpertInfoFormat
}
ReturnType = DATA_TYPE_TO_CLASS[rec_bytes[5]]
payload_obj = ReturnType()
......@@ -447,11 +462,17 @@ class DataFormat(PayloadFormat):
# =======================================
@dataclass
class ReadbackFormat(PayloadFormat):
_dataStruct = Struct("<BIBHHHHHHHHHHffBBBBBBBBBBBffffffB")
_dataStruct = Struct("<BIBHHHHHHHHHHHHHHHBBBBBBBBBBBBBffffffB")
payload_type: PAYLOAD_TYPE = PAYLOAD_TYPE.READBACK
duration_pre_calibration: int = 0
duration_calibration: int = 0
#duration_calibration: int = 0
duration_calibration_first_reading = 0
duration_calibration_pressurise_all = 0
duration_calibration_pressurise_o2 = 0
duration_calibration_pressurise_purge = 0
duration_calibration_pressurise_stabilise = 0
duration_calibration_second_reading = 0
duration_buff_purge: int = 0
duration_buff_flush: int = 0
duration_buff_prefill: int = 0
......@@ -461,8 +482,8 @@ class ReadbackFormat(PayloadFormat):
duration_pause: int = 0
duration_exhale: int = 0
valve_air_in: float = 0.0
valve_o2_in: float = 0.0
valve_air_in: int = 0
valve_o2_in: int = 0
valve_inhale: int = 0
valve_exhale: int = 0
valve_purge: int = 0
......@@ -494,7 +515,13 @@ class ReadbackFormat(PayloadFormat):
self.version,
self.timestamp,
tmp_payload_type,
self.duration_pre_calibration,
#self.duration_pre_calibration,
self.duration_calibration_first_reading,
self.duration_calibration_pressurise_all,
self.duration_calibration_pressurise_o2,
self.duration_calibration_pressurise_purge,
self.duration_calibration_pressurise_stabilise,
self.duration_calibration_second_reading,
self.duration_calibration,
self.duration_buff_purge,
self.duration_buff_flush,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment