新交互逻辑,长按/短按
This commit is contained in:
1 parent
8255cc8c68
commit
346559fb90
7 files changed
+280
-117
No files matched your search
@@ -12,7 +12,7 @@ class Keyboard(BaseHardware):
|
||||
|
||||
self.keyboard_key = keyboard_key
|
||||
self.init_hd_thread()
|
||||
self.power_status = False # 单次触发按键状态
|
||||
self.long_power_status = False # 单次触发按键状态
|
||||
|
||||
def hd_detection_loop(self):
|
||||
keyboard_status = False
|
||||
@@ -27,10 +27,12 @@ class Keyboard(BaseHardware):
|
||||
time.sleep(0.001)
|
||||
|
||||
if not self.shared_hd_status and last_status:
|
||||
self.power_status = ~self.power_status
|
||||
if self.power_status:
|
||||
self.long_power_status = ~self.long_power_status
|
||||
if self.long_power_status:
|
||||
print("Chating mode.")
|
||||
else:
|
||||
print("Slience mode.")
|
||||
print(f"pres time: {datetime.datetime.now()}")
|
||||
last_status = self.shared_hd_status
|
||||
last_status = self.shared_hd_status
|
||||
|
||||
|
||||
Reference in new issue
Block a user