Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-fryza committed Nov 21, 2024
1 parent 19c015c commit e52b404
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Tomas Fryza
Copyright (c) 2023-2024 Tomas Fryza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 0 additions & 3 deletions modules/dht12.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def humidity(self):
`measure` method.
:returns: The current humidity as a percentage.
:rtype: float
:Example:
Expand All @@ -133,7 +132,6 @@ def temperature(self):
temperatures.
:returns: The current temperature in degrees Celsius.
:rtype: float
:Example:
Expand All @@ -155,7 +153,6 @@ def read_values(self):
:returns: A tuple containing the temperature (float)
and humidity (float) values.
:rtype: tuple
"""
self.measure()
return self.temperature(), self.humidity()
11 changes: 0 additions & 11 deletions modules/hw_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def __init__(self, pin_number):
Initialize the button on a specific GPIO pin with a pull-up resistor.
:param pin_number: GPIO pin number where the button is connected.
:type pin_number: int
"""
self.button = Pin(pin_number, Pin.IN, Pin.PULL_UP)

Expand All @@ -59,7 +58,6 @@ def is_pressed(self):
Check if the button is currently pressed using active-low logic.
:return: `True` if the button is pressed; `False` otherwise.
:rtype: bool
"""
if self.button.value() == 0: # Pressed button returns 0
return True
Expand All @@ -76,7 +74,6 @@ def __init__(self, pin_number):
Initialize the LED on a specific GPIO pin.
:param pin_number: GPIO pin number where the LED is connected.
:type pin_number: int
"""
# Calls Parent's __init__ without needing `self`
super().__init__(pin_number, Pin.OUT)
Expand All @@ -93,9 +90,7 @@ def blink(self, duration=0.5, times=5):
:param duration: Duration in seconds for each on/off cycle.
Default is 0.5 seconds.
:type duration: float
:param times: Number of times the LED should blink. Default is 5.
:type times: int
"""
for _ in range(times):
self.on()
Expand All @@ -116,9 +111,7 @@ def __init__(self, pin_number, frequency=1000):
starting with LED off.
:param pin_number: GPIO pin number where the LED is connected.
:type pin_number: int
:param frequency: PWM frequency for LED control. Default is 1000 Hz.
:type frequency: int
"""
pin = Pin(pin_number, Pin.OUT)
super().__init__(pin)
Expand All @@ -130,7 +123,6 @@ def set_brightness(self, brightness):
Set the LED brightness using PWM.
:param brightness: Brightness level as a percentage (0 to 100).
:type brightness: int
"""
duty_cycle = int(brightness / 100 * 1023) # Duty cycle 0 to 1023
self.duty(duty_cycle)
Expand All @@ -141,7 +133,6 @@ def on(self, brightness=100):
:param brightness: Brightness level as a percentage (0 to 100).
Default is 100%.
:type brightness: int
"""
self.set_brightness(brightness)

Expand All @@ -157,7 +148,6 @@ def fade_in(self, duration=1):
:param duration: Total duration of the fade-in effect, in seconds.
Default is 1 second.
:type duration: float
"""
step_duration = duration / 100
for i in range(100):
Expand All @@ -170,7 +160,6 @@ def fade_out(self, duration=1):
:param duration: Total duration of the fade-out effect, in seconds.
Default is 1 second.
:type duration: float
"""
step_duration = duration / 100
for i in range(100, -1, -1): # -1 to reach fully off
Expand Down
4 changes: 0 additions & 4 deletions modules/wifi_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ def connect(wifi, ssid, password, timeout=10):
specified timeout, it will terminate and return `False`.
:param wifi: The Wi-Fi interface object to use for the connection.
:type wifi: network.WLAN
:param str ssid: The SSID of the Wi-Fi network to connect to.
:param str password: The password for the Wi-Fi network.
:param int timeout: The maximum time in seconds to wait
for the connection attempt.
:returns: `True` if connected successfully, `False` if
the connection attempt timed out.
:rtype: bool
"""
import time

Expand Down Expand Up @@ -90,7 +88,6 @@ def disconnect(wifi):
the device is not connected to any Wi-Fi network.
:param wifi: The Wi-Fi interface object to disconnect.
:type wifi: network.WLAN
"""
if wifi.active():
wifi.active(False)
Expand All @@ -109,7 +106,6 @@ def print_status(wifi):
:param wifi: The Wi-Fi interface object whose status is to
be printed.
:type wifi: network.WLAN
"""
status = wifi.status()
print(f"[WIFI] {status_messages.get(status)}")
Expand Down

0 comments on commit e52b404

Please sign in to comment.