Sanjay Govind 10 месяцев назад
Родитель
Сommit
2dede9705e
2 измененных файлов с 13 добавлено и 13 удалено
  1. 1 1
      test.py
  2. 12 12
      virtual_portal.c

+ 1 - 1
test.py

@@ -10,4 +10,4 @@ try:
 except:
 except:
     pass
     pass
 dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"C\xff\x00\x00", timeout=None)
 dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"C\xff\x00\x00", timeout=None)
-dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x00\x00\xff\x00\x00\x10", timeout=None)
+dev.ctrl_transfer(0x21, 9, wValue=0x0200, wIndex=0, data_or_wLength=b"J\x02\x00\xff\x00\x00\x10", timeout=None)

+ 12 - 12
virtual_portal.c

@@ -68,24 +68,24 @@ static int32_t pof_thread_worker(void* context) {
         if (elapsed < duration) {
         if (elapsed < duration) {
             t_phase = fminf((float)elapsed / (float)duration, 1);
             t_phase = fminf((float)elapsed / (float)duration, 1);
             if (current_phase == 0) {
             if (current_phase == 0) {
-                if (last_r > target_r) {
+                if (last_r < target_r) {
                     furi_hal_light_set(LightRed, lerp(last_r, target_r, t_phase));
                     furi_hal_light_set(LightRed, lerp(last_r, target_r, t_phase));
                 }
                 }
-                if (last_g > target_g) {
-                    furi_hal_light_set(LightBlue, lerp(last_g, target_g, t_phase));
+                if (last_g < target_g) {
+                    furi_hal_light_set(LightGreen, lerp(last_g, target_g, t_phase));
                 }
                 }
-                if (last_b > target_b) {
-                    furi_hal_light_set(LightGreen, lerp(last_b, target_b, t_phase));
+                if (last_b < target_b) {
+                    furi_hal_light_set(LightBlue, lerp(last_b, target_b, t_phase));
                 }
                 }
             } else {
             } else {
-                if (last_r < target_r) {
+                if (last_r > target_r) {
                     furi_hal_light_set(LightRed, lerp(last_r, target_r, t_phase));
                     furi_hal_light_set(LightRed, lerp(last_r, target_r, t_phase));
                 }
                 }
-                if (last_g < target_g) {
-                    furi_hal_light_set(LightBlue, lerp(last_g, target_g, t_phase));
+                if (last_g > target_g) {
+                    furi_hal_light_set(LightGreen, lerp(last_g, target_g, t_phase));
                 }
                 }
-                if (last_b < target_b) {
-                    furi_hal_light_set(LightGreen, lerp(last_b, target_b, t_phase));
+                if (last_b > target_b) {
+                    furi_hal_light_set(LightBlue, lerp(last_b, target_b, t_phase));
                 }
                 }
             }
             }
             
             
@@ -98,8 +98,8 @@ static int32_t pof_thread_worker(void* context) {
                 last_g = target_g;
                 last_g = target_g;
                 last_b = target_b;
                 last_b = target_b;
                 furi_hal_light_set(LightRed, target_r);
                 furi_hal_light_set(LightRed, target_r);
-                furi_hal_light_set(LightBlue, target_g);
-                furi_hal_light_set(LightGreen, target_b);
+                furi_hal_light_set(LightGreen, target_g);
+                furi_hal_light_set(LightBlue, target_b);
                 running = false;
                 running = false;
             }
             }
         }
         }