Sanjay Govind 10 mesi fa
parent
commit
e14f848d3d
2 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 2 1
      test.py
  2. 3 0
      virtual_portal.c

+ 2 - 1
test.py

@@ -1,5 +1,6 @@
 import usb.core
 import usb.util
+import time
 
 # Find our device
 dev = usb.core.find(idVendor=0x1430, idProduct=0x0150)
@@ -10,5 +11,5 @@ try:
 except:
     pass
 dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"C\xff\x00\x00", timeout=None)
-# time.sleep(1)
+time.sleep(0.001)
 dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x00\x00\xff\x00\x00\x10", timeout=None)

+ 3 - 0
virtual_portal.c

@@ -30,6 +30,9 @@ void virtual_portal_tick(void* ctx) {
     VirtualPortal* virtual_portal = (VirtualPortal*)ctx;
     (void)virtual_portal;
     VirtualPortalLed* led = &virtual_portal->right;
+    if (!led->running) {
+        return;
+    }
     uint32_t elapsed = furi_get_tick() - led->start_time;
     if (elapsed < led->delay) {
         float t_phase = fminf((float)elapsed / (float)led->delay, 1);