Skip to content

Commit c4a8a29

Browse files
author
Daniel Campora
committed
pytrack, pysense: Add firmware version check during initialization.
1 parent 3e19f7f commit c4a8a29

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pysense/lib/pysense.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ def __init__(self, i2c=None, sda='P22', scl='P21'):
9393
# set RC6 and RC7 as outputs and enable power to the sensors
9494
self.mask_bits_in_memory(TRISC_ADDR, ~(1 << 6))
9595
self.mask_bits_in_memory(TRISC_ADDR, ~(1 << 7))
96+
97+
if self.read_fw_version() < 6:
98+
raise ValueError('Pysense firmware out of date')
99+
96100
except Exception:
97101
raise Exception('Pysense board not detected')
98102

pytrack/lib/pytrack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ def __init__(self, i2c=None, sda='P22', scl='P21'):
9393
# set RC6 and RC7 as outputs and enable power to the sensors and the GPS
9494
self.mask_bits_in_memory(TRISC_ADDR, ~(1 << 6))
9595
self.mask_bits_in_memory(TRISC_ADDR, ~(1 << 7))
96+
97+
if self.read_fw_version() < 6:
98+
raise ValueError('Pytrack firmware out of date')
99+
96100
except Exception:
97101
raise Exception('Pytrack board not detected')
98102

0 commit comments

Comments
 (0)