|
@@ -17,6 +17,8 @@ void light_defaultConfig()
|
17
|
17
|
light_Configuration.specifiedValueRaw = 0;
|
18
|
18
|
light_Configuration.specifiedValuePercent = 0.0;
|
19
|
19
|
light_Configuration.target = LIGHT_BRIGHTNESS;
|
|
20
|
+ light_Configuration.hasCachedMaxBrightness = FALSE;
|
|
21
|
+ light_Configuration.cachedMaxBrightness = 0;
|
20
|
22
|
light_verbosity = 0;
|
21
|
23
|
}
|
22
|
24
|
|
|
@@ -339,7 +341,11 @@ LIGHT_BOOL light_execute()
|
339
|
341
|
return FALSE;
|
340
|
342
|
}
|
341
|
343
|
|
342
|
|
- if(!light_getMaxBrightness(light_Configuration.specifiedController, &rawMax))
|
|
344
|
+ if(light_Configuration.hasCachedMaxBrightness)
|
|
345
|
+ {
|
|
346
|
+ rawMax = light_Configuration.cachedMaxBrightness;
|
|
347
|
+ }
|
|
348
|
+ else if(!light_getMaxBrightness(light_Configuration.specifiedController, &rawMax))
|
343
|
349
|
{
|
344
|
350
|
LIGHT_ERR("could not get max brightness");
|
345
|
351
|
return FALSE;
|
|
@@ -795,6 +801,8 @@ LIGHT_BOOL light_getBestController(char *controller)
|
795
|
801
|
bestValYet = currVal;
|
796
|
802
|
memset(bestYet, '\0', 256);
|
797
|
803
|
strcpy(bestYet, light_currentController);
|
|
804
|
+ light_Configuration.hasCachedMaxBrightness = TRUE;
|
|
805
|
+ light_Configuration.cachedMaxBrightness = currVal;
|
798
|
806
|
}else{
|
799
|
807
|
LIGHT_NOTE("ignoring controller as better one already found");
|
800
|
808
|
}
|