Made LED display more dynamic
Vary brightness Turn red on max value
This commit is contained in:
parent
a2f2fb260d
commit
d0aff0c220
2 changed files with 49 additions and 21 deletions
|
|
@ -24,7 +24,7 @@ void singleLED(int n, int color) {
|
|||
// 8 -> 127, 0, 0, 0, 0, 0, 0, 0
|
||||
// 0 -> 0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
void ledFullMeter(byte indicatedValue, int color){
|
||||
void ledFullMeter(byte indicatedValue, int color) {
|
||||
static byte lastVal = 0;
|
||||
static int lastColor = 0;
|
||||
if (lastVal == indicatedValue && lastColor == color) {
|
||||
|
|
@ -34,7 +34,7 @@ void ledFullMeter(byte indicatedValue, int color){
|
|||
lastColor = color;
|
||||
|
||||
int scaledVal = indicatedValue;
|
||||
ledStrip.setBrightness(1);
|
||||
ledStrip.setBrightness(constrain(indicatedValue / 32, 1, 4));
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (scaledVal > 0) {
|
||||
ledStrip.setPixel(i, color);
|
||||
|
|
@ -90,6 +90,6 @@ void updateSensorLEDs(instrument_state_t &state) {
|
|||
if (millis() - state.lastKnobTime < KNOB_DISPLAY_TIME) {
|
||||
ledFullMeter(state.lastKnobVal, 0x00FF00);
|
||||
} else {
|
||||
ledFullMeter(state.breathCCVal, 0x0000FF);
|
||||
ledFullMeter(state.breathCCVal, state.breathCCVal >= 127 ? 0xFF0000 : 0x0000FF);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue