Made LED display more dynamic

Vary brightness
Turn red on max value
This commit is contained in:
Brian Hrebec 2024-11-09 12:11:13 -06:00
parent a2f2fb260d
commit d0aff0c220
2 changed files with 49 additions and 21 deletions

View file

@ -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);
}
}

View file

@ -1246,28 +1246,56 @@ private:
drawMenuSummary(state, polyMenu);
drawMenuSummary(state, rollModeMenu);
} else {
drawVal("BRTH: ", state.instrument->breathCCVal);
drawVal("BITE: ", state.instrument->biteVal);
drawVal("PORT: ", state.instrument->portamentoVal);
drawVal("EXRA: ", state.instrument->extraVal);
drawVal("LEVR: ", state.instrument->leverVal);
drawVal("PB : ", state.instrument->pbVal);
drawVal("PB Y: ", state.instrument->pbYVal);
display.setCursor(42, 0);
drawVal("ST X: ", state.instrument->stickXSignal);
drawVal("ST Y: ", state.instrument->stickYSignal);
drawVal("K1 : ", state.instrument->knobVals[0]);
drawVal("K2 : ", state.instrument->knobVals[1]);
drawVal("K3 : ", state.instrument->knobVals[2]);
drawVal("K4 : ", state.instrument->knobVals[3]);
display.setCursor(84, 0);
drawVal("ROLL: ", state.instrument->rollCCVal);
drawVal("TILT: ", state.instrument->tiltCCVal);
display.print("BRTH:");
display.printf("%3d", state.instrument->breathCCVal);
display.print(" BITE:");
display.printf("%3d", state.instrument->biteVal);
display.println();
display.print("EXRA:");
display.printf("%3d", state.instrument->extraVal);
display.print(" PORT:");
display.printf("%3d", state.instrument->portamentoVal);
display.println();
display.print("LEVR:");
display.printf("%3d", state.instrument->leverVal);
display.print(" ST X:");
display.printf("%3d", state.instrument->stickXVal);
display.println();
display.print("PB Y:");
display.printf("%3d", state.instrument->pbYVal);
display.print(" ST Y:");
display.printf("%3d", state.instrument->stickYVal);
display.println();
display.print("ROLL:");
display.printf("%3d", state.instrument->rollCCVal);
display.print(" TILT:");
display.printf("%3d", state.instrument->tiltCCVal);
display.println();
display.print("PB:");
display.printf("%3d", state.instrument->pbVal);
display.print(" K1:");
display.printf("%3d", state.instrument->knobVals[0]);
display.print(" K2:");
display.printf("%3d", state.instrument->knobVals[1]);
display.println();
display.print("K3:");
display.printf("%3d", state.instrument->knobVals[2]);
display.print(" K4:");
display.printf("%3d", state.instrument->knobVals[3]);
display.println();
}
}
void drawVal(const char *name, int val) {
display.print(name);
display.println(val);
display.print(val);
}
void drawMenuSummary(state_t& state, MenuScreen &menu) {
display.printf("%12s", menu.title());