Skip to content

Commit 6f21e57

Browse files
committed
Show errored temperature sensors as None
1 parent 305593a commit 6f21e57

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
name: Build Wheel
2+
13
on: push
24

35
jobs:
46
build:
5-
name: Build Wheel
67
runs-on: ubuntu-latest
78

89
steps:

cros_ec_python/commands/memmap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ..constants.MEMMAP import *
1313

1414

15-
def get_temps(ec: CrosEcClass, adjust: int | float = -273) -> list[int | float]:
15+
def get_temps(ec: CrosEcClass, adjust: int | float = -273) -> list[int | float | None]:
1616
"""
1717
Get the temperature of all temp sensors.
1818
:param ec: The CrOS_EC object.
@@ -28,12 +28,12 @@ def get_temps(ec: CrosEcClass, adjust: int | float = -273) -> list[int | float]:
2828
if version >= 1:
2929
resp = ec.memmap(EC_MEMMAP_TEMP_SENSOR, EC_TEMP_SENSOR_ENTRIES)
3030
temps = struct.unpack(f"<{EC_TEMP_SENSOR_ENTRIES}B", resp)
31-
ret += [temp + EC_TEMP_SENSOR_OFFSET + adjust for temp in temps if temp < 0xFC]
31+
ret += [temp + EC_TEMP_SENSOR_OFFSET + adjust if temp < 0xFC else None for temp in temps if temp < 0xFF]
3232

3333
if version >= 2:
3434
resp = ec.memmap(EC_MEMMAP_TEMP_SENSOR_B, EC_TEMP_SENSOR_B_ENTRIES)
3535
temps = struct.unpack(f"<{EC_TEMP_SENSOR_B_ENTRIES}B", resp)
36-
ret += [temp + EC_TEMP_SENSOR_OFFSET + adjust for temp in temps if temp < 0xFC]
36+
ret += [temp + EC_TEMP_SENSOR_OFFSET + adjust if temp < 0xFC else None for temp in temps if temp < 0xFF]
3737

3838
return ret
3939

cros_ec_python/commands/thermal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def temp_sensor_get_info(ec: CrosEcClass, sensor_idx: UInt8) -> dict[str, EcTemp
122122
"type": EcTempSensorType(unpacked[1])
123123
}
124124

125-
def get_temp_sensors(ec: CrosEcClass) -> dict[str, tuple[int, EcTempSensorType]]:
125+
def get_temp_sensors(ec: CrosEcClass) -> dict[str, tuple[int | None, EcTempSensorType]]:
126126
"""
127127
Get information about all temperature sensors.
128128
:param ec: The CrOS_EC object.

0 commit comments

Comments
 (0)