Skip to content

HyundaiCanada: convert HI/LOW air-temp to resolved unit (fixes 62°C/82°C dropout, issue #30)#40

Open
MrL0 wants to merge 1 commit into
schmidtwmark:mainfrom
MrL0:fix/canada-hilow-temp-unit
Open

HyundaiCanada: convert HI/LOW air-temp to resolved unit (fixes 62°C/82°C dropout, issue #30)#40
MrL0 wants to merge 1 commit into
schmidtwmark:mainfrom
MrL0:fix/canada-hilow-temp-unit

Conversation

@MrL0

@MrL0 MrL0 commented Jun 28, 2026

Copy link
Copy Markdown

What this does

parseCanadaAirTemp returns the HVAC range bounds for "HI"/"LOW":

if raw == "HI"  { return Temperature(value: Temperature.maximum, units: units) }
if raw == "LOW" { return Temperature(value: Temperature.minimum, units: units) }

But Temperature.maximum/minimum are Fahrenheit constants (62/82 — the Fahrenheit hvacRange), and Temperature.init(value:units:) stores the raw value without conversion. When a Canadian response resolves units to .celsius (top-level "C"), "HI" lands as 82°C and "LOW" as 62°C — impossible cabin temperatures. TemperatureDisplay.isPlausibleForDisplay then rejects them (Celsius must be ≤ 60), so the reading silently disappears. 62°C is the exact artifact documented for issue #30.

Fix: convert the Fahrenheit bound into the resolved unit before storing — matching what Temperature's string initializer already does (Units.fahrenheit.convert(Temperature.maximum, to: units)). A Celsius vehicle now stores ~27.8 °C / 16.7 °C; Fahrenheit is unchanged.

Testing

swift test290 tests pass. The conversion itself is covered by the existing Temperature.Units.convert tests; this only changes the unit the HI/LOW bound is stored in. (No Canada-specific parse fixture exists in the suite to assert end-to-end.)


Drafted with AI assistance; verified locally with swift test.

Temperature.maximum/minimum are Fahrenheit (62/82) and init(value:units:) does not convert, so a Celsius-resolved vehicle stored 82C/62C for HI/LOW — impossible cabin temps that isPlausibleForDisplay then drops, so the reading vanished (the 62C artifact from issue schmidtwmark#30). Convert the bound to the resolved unit, matching Temperature's string-init path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant