Selaa lähdekoodia

Check if controller is accessible before getting value

Abdullah ibn Nadjo 6 vuotta sitten
vanhempi
commit
3b2835b626
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4
    4
      src/light.c

+ 4
- 4
src/light.c Näytä tiedosto

@@ -736,10 +736,10 @@ LIGHT_BOOL light_getBestController(char *controller)
736 736
   {
737 737
     unsigned long currVal = 0;
738 738
 
739
-    if(light_getMaxBrightness(light_currentController, &currVal))
739
+    if(light_controllerAccessible(light_currentController))
740 740
     {
741 741
 
742
-      if(light_controllerAccessible(light_currentController))
742
+      if(light_getMaxBrightness(light_currentController, &currVal))
743 743
       {
744 744
         if(currVal > bestValYet)
745 745
         {
@@ -751,10 +751,10 @@ LIGHT_BOOL light_getBestController(char *controller)
751 751
           LIGHT_NOTE("ignoring controller as better one already found");
752 752
         }
753 753
       }else{
754
-        LIGHT_WARN("controller not accessible");
754
+        LIGHT_WARN("could not read max brightness from file");
755 755
       }
756 756
     }else{
757
-      LIGHT_WARN("could not read max brightness from file");
757
+      LIGHT_WARN("controller not accessible");
758 758
     }
759 759
   }
760 760