Skip to content

Commit

Permalink
docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
klamann committed Sep 23, 2024
1 parent 48c291f commit 4ff1ac3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/raspi_poe_mon/ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@


class Controller:
"""
Controller for display and fan of the PoE HAT.
Contains the main application loop and manages all high level logic like updating display
frames or changing fan state.
:param show_display: display will only be used when this is True
:param control_fan: fan controls will only be enabled when this is True
:param fan_on_temp: turn on the fan when CPU temperature rises above this value (in °C)
:param fan_off_temp: turn off the fan when CPU temperature drops below this value (in °C)
:param frame_time: show a new frame on the display every n seconds (excluding blank time)
:param blank_time: blank time (seconds) between frames where the display is turned off
:param brightness: brightness level of the display in percent (0-100)
:param timeout: terminate after n seconds; 0 means run until interrupted
:param dry_run: simulate commands without accessing the PoE HAT
:param profiling: log profiling information, very verbose
"""

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/raspi_poe_mon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(
] = 2.0,
blank_time: Annotated[
float,
typer.Option(help="bank time (seconds) between frames where the display is turned off")
typer.Option(help="blank time (seconds) between frames where the display is turned off")
] = 0.0,
brightness: Annotated[
int,
Expand Down
1 change: 1 addition & 0 deletions src/raspi_poe_mon/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


def monkeypatch():
"""monkeypatch all real hardware so the mock version is used instead. restart to undo"""
serial.i2c = MockFan
device.ssd1306 = MockDisplay
render.canvas = MockCanvas
Expand Down
2 changes: 2 additions & 0 deletions src/raspi_poe_mon/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
class SystemMonitor:
"""
Render display frames that show status information about the system
:param poe_hat: Instance of the PoeHat class with access to the display
"""

def __init__(self, poe_hat: PoeHat) -> None:
Expand Down
6 changes: 6 additions & 0 deletions src/raspi_poe_mon/poe_hat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@


class PoeHat:
"""
Get access to the PoE HAT hardware, specifically display and fan via I2C
:param dry_run: do not access the real hardware when this is set to True
:param brightness: brightness level of the OLED display (0-100%)
"""

def __init__(self, dry_run=False, brightness=100) -> None:
self.dry_run = dry_run
Expand Down

0 comments on commit 4ff1ac3

Please sign in to comment.