fix: sync contec oscilloscope machine UI, dual temp T1/T2, and cache-control to fiveparaminte-main for Render deployment
This commit is contained in:
@@ -58,13 +58,14 @@ CONTEC_PARAM_MAP = {
|
||||
# Temperature
|
||||
"TEMP": "temperature",
|
||||
"TEMP1": "temperature",
|
||||
"TEMP2": "temperature",
|
||||
"TEMP2": "temperature2",
|
||||
"T1": "temperature",
|
||||
"T2": "temperature",
|
||||
"T2": "temperature2",
|
||||
"BODY_TEMP": "temperature",
|
||||
"TEMP-1": "temperature",
|
||||
"TEMP-2": "temperature",
|
||||
"TEMP-2": "temperature2",
|
||||
"BODYTEMP": "temperature",
|
||||
"TD": "temperature_diff",
|
||||
}
|
||||
|
||||
# Sentinel value used by Contec to mark an invalid/disconnected parameter
|
||||
@@ -304,7 +305,7 @@ def _parse_45_byte_packet(data: bytes, vitals_dict: dict) -> bool:
|
||||
|
||||
def _parse_56_byte_packet(data: bytes, vitals_dict: dict) -> bool:
|
||||
"""
|
||||
Parse 56-byte packet (Subtype 23) — contains float32 Temperature values.
|
||||
Parse 56-byte packet (Subtype 23) — contains float32 Temperature values for T1 and T2.
|
||||
|
||||
Verified layout:
|
||||
[8-11] Temperature 1 (float32)
|
||||
@@ -318,8 +319,6 @@ def _parse_56_byte_packet(data: bytes, vitals_dict: dict) -> bool:
|
||||
if "present_fields" not in vitals_dict:
|
||||
vitals_dict["present_fields"] = []
|
||||
|
||||
found = False
|
||||
|
||||
temp1 = read_f32_le(data, 8)
|
||||
temp2 = read_f32_le(data, 12)
|
||||
|
||||
@@ -327,24 +326,24 @@ def _parse_56_byte_packet(data: bytes, vitals_dict: dict) -> bool:
|
||||
# Disconnected sentinel is 9999.0 or 3276.7 (0x7FFF)
|
||||
return t is not None and is_valid_f32(t) and abs(t - 3276.7) > 1.0 and 20.0 < t < 45.0
|
||||
|
||||
if is_real_temp(temp1):
|
||||
vitals_dict["temperature"] = round(temp1, 1)
|
||||
if "temperature" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature")
|
||||
found = True
|
||||
elif is_real_temp(temp2):
|
||||
vitals_dict["temperature"] = round(temp2, 1)
|
||||
if "temperature" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature")
|
||||
found = True
|
||||
elif temp1 is not None or temp2 is not None:
|
||||
# Sensor disconnected / off
|
||||
vitals_dict["temperature"] = None
|
||||
if "temperature" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature")
|
||||
found = True
|
||||
t1_val = round(temp1, 1) if is_real_temp(temp1) else None
|
||||
t2_val = round(temp2, 1) if is_real_temp(temp2) else None
|
||||
|
||||
return found
|
||||
vitals_dict["temperature"] = t1_val
|
||||
vitals_dict["temperature2"] = t2_val
|
||||
if t1_val is not None and t2_val is not None:
|
||||
vitals_dict["temperature_diff"] = round(abs(t1_val - t2_val), 1)
|
||||
else:
|
||||
vitals_dict["temperature_diff"] = None
|
||||
|
||||
if "temperature" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature")
|
||||
if "temperature2" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature2")
|
||||
if "temperature_diff" not in vitals_dict["present_fields"]:
|
||||
vitals_dict["present_fields"].append("temperature_diff")
|
||||
|
||||
return (t1_val is not None or t2_val is not None)
|
||||
|
||||
|
||||
def _parse_spo2_waveform_packet(data: bytes, vitals_dict: dict) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user