Remove pgpiod code

This commit is contained in:
ABelliqueux 2024-12-19 09:33:04 +01:00
parent 1a0b03d991
commit 485586af3e
1 changed files with 4 additions and 40 deletions

View File

@ -17,20 +17,6 @@ from luma.core.render import canvas
from luma.oled.device import ssd1306
from PIL import Image, ImageDraw, ImageFont
# Pot_cap
# ~ import pigpio
# ~ import pot_cap
# ~ min_val = 8
# ~ max_val = 298
# ~ vol_mult = 100/(max_val-min_val)
# ~ volume = 0
# ~ v_1 = 0
# ~ v_2 = 0
# ~ ctrlc_pressed = False
# ~ pot_cap_gpio = 23
# ~ drain_ms = 0.8
# ~ timeout_s = 1.0
jfont = ImageFont.truetype('DejaVuSansMono.ttf', 10)
# MPD config
@ -364,11 +350,6 @@ def send_mpd_cmd(client, cmd:str, ui_state:dict):
def main(args):
# Idle timer
ui_idle_for = 0
# Pot_cap
# Connect to Pi.
# ~ pi = pigpio.pi()
# Instantiate Pot/Cap reader.
# ~ pc = pot_cap.reader(pi, pot_cap_gpio, drain_ms, timeout_s)
start = time()
previous_song_id = None
@ -404,23 +385,7 @@ def main(args):
global static_ui
static_ui = generate_static_ui(current_mode)
while ctrlc_pressed is False:
# pot_cap
# ~ global v_1
# ~ global v_2
global volume, clkLastState
# ~ s, v, r = pc.read()
# ~ if s and r < 4:
# ~ volume = round(v*vol_mult)
# ~ if (abs(volume - v_1) > 1) and (abs(volume - v_2) > 2):
# ~ print("Volume: {}".format(volume))
# ~ if volume < min_val:
# ~ volume = 0
# ~ if volume > 100:
# ~ volume = 100
# ~ client.setvol(100-volume)
# ~ ui_idle_for = 0
# ~ v_2 = v_1
# ~ v_1 = volume
# Rotary encoder
clkState = GPIO.input(clk)
dtState = GPIO.input(dt)
@ -434,7 +399,7 @@ def main(args):
print(volume)
client.setvol(volume)
ui_idle_for = 0
clkLastState = clkState
# ~ clkLastState = clkState
# ~ sleep(0.01)
# MPD
mpd_status = client.status()
@ -492,12 +457,11 @@ def main(args):
# Avoid further execution
ui_idle_for = 11
device.hide()
# ~ # pot_cap
# ~ pc.cancel() # Cancel the reader.
# ~ pi.stop() # Disconnect from Pi.
clkLastState = clkState
device.cleanup()
client.disconnect()
GPIO.cleanup()
return 0