From 1ab6c016cd9f6b29162360aba892cb9034858c13 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 31 May 2018 09:00:14 +0200 Subject: [PATCH] Use Focus.readColor in the focusHook Instead of repeating the same cRGB reading code in three places, use the recently introduced Focus.readColor() function. This both makes the code cleaner, and more than 50 bytes smaller too. Signed-off-by: Gergely Nagy --- src/Kaleidoscope-LEDControl.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Kaleidoscope-LEDControl.cpp b/src/Kaleidoscope-LEDControl.cpp index 21de9ac6..4ae30a6d 100644 --- a/src/Kaleidoscope-LEDControl.cpp +++ b/src/Kaleidoscope-LEDControl.cpp @@ -194,9 +194,7 @@ bool LEDControl::focusHook(const char *command) { } else { cRGB c; - c.r = Serial.parseInt(); - c.g = Serial.parseInt(); - c.b = Serial.parseInt(); + ::Focus.readColor(c); setCrgbAt(idx, c); } @@ -205,9 +203,7 @@ bool LEDControl::focusHook(const char *command) { case SETALL: { cRGB c; - c.r = Serial.parseInt(); - c.g = Serial.parseInt(); - c.b = Serial.parseInt(); + ::Focus.readColor(c); set_all_leds_to(c); @@ -246,9 +242,7 @@ bool LEDControl::focusHook(const char *command) { while (idx < LED_COUNT && Serial.peek() != '\n') { cRGB color; - color.r = Serial.parseInt(); - color.g = Serial.parseInt(); - color.b = Serial.parseInt(); + ::Focus.readColor(color); setCrgbAt(idx, color); idx++;