Created
January 8, 2017 21:10
-
-
Save benjamind/e62f5177a975086051b19f35475e8713 to your computer and use it in GitHub Desktop.
FastLED power management per controller pseudocode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is all pseudocode and will probably not compile but it should give you an idea | |
// init... | |
// create your controllers | |
CLEDController controllerA = FastLED.addLEDs(LED_TYPE, DATA_PIN, COLOR_ORDER(ledsA, 0, NUM_LEDS_A); | |
CLEDController controllerB = FastLED.addLEDs(LED_TYPE, DATA_PIN, COLOR_ORDER(ledsB, 0, NUM_LEDS_B); | |
// loop.... | |
// calculate power per controller | |
uint8_t scaleA = calculate_max_brightness_for_power_mW(controllerA.leds(), controllerA.size(), targetBrightness, MAX_POWER_MW_A); | |
uint8_t scaleB = calculate_max_brightness_for_power_mW(controllerB.leds(), controllerB.size(), targetBrightness, MAX_POWER_MW_B); | |
// show the controllers using their appropriate scales | |
uint8_t d = controllerA.getDither(); | |
controllerA.showLeds(scaleA); | |
controllerA.setDither(d); | |
controllerB.getDither(); | |
controllerB.showLeds(scaleB); | |
controllerB.setDither(d); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment