Skip to content

Commit

Permalink
fix(cli): release hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
Whth committed Jun 23, 2024
1 parent 1a88abe commit b1918f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/kazu/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def read_sensors(ctx: click.Context, conf: _InternalConfig, interval: float, dev
"""
Read sensors data and print to terminal
"""
from pyuptech import make_mpu_table, make_io_table, make_adc_table, adc_io_display_on_lcd
from pyuptech import make_mpu_table, make_io_table, make_adc_table, adc_io_display_on_lcd, Color
from kazu.hardwares import sensors, screen

app_config: APPConfig = conf.app_config
Expand Down Expand Up @@ -409,8 +409,8 @@ def read_sensors(ctx: click.Context, conf: _InternalConfig, interval: float, dev
sensor_config.rl_io_index: "RL",
sensor_config.rr_io_index: "RR",
sensor_config.reboot_button_index: "REBOOT",
sensor_config.gray_io_left_index: "GRAY-LEFT",
sensor_config.gray_io_right_index: "GRAY-RIGHT",
sensor_config.gray_io_left_index: "GRAY-L",
sensor_config.gray_io_right_index: "GRAY-R",
}
for dev in device:
match dev:
Expand Down Expand Up @@ -438,6 +438,8 @@ def read_sensors(ctx: click.Context, conf: _InternalConfig, interval: float, dev
finally:
_logger.info("Closing sensors...")
sensors.adc_io_close()
if use_screen:
screen.fill_screen(Color.BLACK).refresh().close()
_logger.info("Exit reading successfully.")
ctx.exit(0)

Expand Down

0 comments on commit b1918f4

Please sign in to comment.