Skip to content

Commit

Permalink
Update verify_hardware.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Aug 21, 2023
1 parent 58b45f1 commit 8b16805
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/hardware_validation/verify_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ def log_fun(msg_type: str = 'info', msg: str = '', last: bool = False):
if module:
log_fun('pass', f'module "{module.name}" is connected to the Bpod\'s module port #{module.serial_port}')
log_fun('info', f'firmware version: {module.firmware_version}')
module.start_module_relay()
bpod.bpod_modules.module_write(module, "R")
r = bpod.bpod_modules.module_read(module, 12)
module.stop_module_relay()
v = {
"Temperature_C": np.frombuffer(bytes(r[:4]), np.float32)[0],
"AirPressure_mb": np.frombuffer(bytes(r[4:8]), np.float32)[0] / 100,
"RelativeHumidity": np.frombuffer(bytes(r[8:]), np.float32)[0],
}
log_fun('info', f'temperature: {v["Temperature_C"]:.1f} °C')
log_fun('info', f'air pressure: {v["AirPressure_mb"]:.1f} mbar')
log_fun('info', f'rel. humidity: {v["RelativeHumidity"]:.1f}%')
else:
log_fun('fail', 'Could not find Ambient Module', last=True)

Expand Down

0 comments on commit 8b16805

Please sign in to comment.