华荣三照明、合信、荣欣八组合馈电
This commit is contained in:
54
menu_key2.py
Normal file
54
menu_key2.py
Normal file
@ -0,0 +1,54 @@
|
||||
import threading
|
||||
import time
|
||||
import gpiod
|
||||
import menu_key_def as KEYDEF
|
||||
|
||||
class class_menu_key_thread(threading.Thread):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__()
|
||||
self.stop_request = False
|
||||
self.chip = None
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
if self.chip is None:
|
||||
print("GPIO chip not initialized, skipping thread execution")
|
||||
return
|
||||
|
||||
while not self.stop_request:
|
||||
time.sleep(0.02) # Adjust sleep time if necessary
|
||||
|
||||
# Process button presses
|
||||
for index, line in enumerate(self.lines):
|
||||
if line.get_value():
|
||||
self.handle_key_press(index)
|
||||
|
||||
def handle_key_press(self, index):
|
||||
# Handle button press based on index
|
||||
pass
|
||||
|
||||
def key_up_press(self):
|
||||
# Handle key press for UP button
|
||||
pass
|
||||
|
||||
def key_down_press(self):
|
||||
# Handle key press for DOWN button
|
||||
pass
|
||||
|
||||
def key_enter_press(self):
|
||||
# Handle key press for ENTER button
|
||||
pass
|
||||
|
||||
def key_reset_press(self):
|
||||
# Handle key press for RESET button
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
# Stop the thread
|
||||
self.stop_request = True
|
||||
self.join()
|
||||
|
||||
def menu_wait_key(self, timeout):
|
||||
# Placeholder for waiting for a key press with timeout
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user