@@ -125,23 +125,23 @@ void handleSwitch(uint8_t b)
125125{
126126 // isButtonPressed() handles inverted/noninverted logic
127127 if (buttonPressedBefore[b] != isButtonPressed (b)) {
128- DEBUG_PRINT ( F (" Switch: State changed " )); DEBUG_PRINTLN ( b);
128+ DEBUG_PRINTF_P ( PSTR (" Switch: State changed %u \n " ), b);
129129 buttonPressedTime[b] = millis ();
130130 buttonPressedBefore[b] = !buttonPressedBefore[b];
131131 }
132132
133133 if (buttonLongPressed[b] == buttonPressedBefore[b]) return ;
134134
135135 if (millis () - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { // fire edge event only after 50ms without change (debounce)
136- DEBUG_PRINT ( F (" Switch: Activating " )); DEBUG_PRINTLN ( b);
136+ DEBUG_PRINTF_P ( PSTR (" Switch: Activating %u \n " ), b);
137137 if (!buttonPressedBefore[b]) { // on -> off
138- DEBUG_PRINT ( F (" Switch: On -> Off " )); DEBUG_PRINTLN ( b);
138+ DEBUG_PRINTF_P ( PSTR (" Switch: On -> Off (%u) \n " ), b);
139139 if (macroButton[b]) applyPreset (macroButton[b], CALL_MODE_BUTTON_PRESET);
140140 else { // turn on
141141 if (!bri) {toggleOnOff (); stateUpdated (CALL_MODE_BUTTON);}
142142 }
143143 } else { // off -> on
144- DEBUG_PRINT ( F (" Switch: Off -> On " )); DEBUG_PRINTLN ( b);
144+ DEBUG_PRINTF_P ( PSTR (" Switch: Off -> On (%u) \n " ), b);
145145 if (macroLongPress[b]) applyPreset (macroLongPress[b], CALL_MODE_BUTTON_PRESET);
146146 else { // turn off
147147 if (bri) {toggleOnOff (); stateUpdated (CALL_MODE_BUTTON);}
@@ -173,7 +173,7 @@ void handleAnalog(uint8_t b)
173173 static float filteredReading[WLED_MAX_BUTTONS] = {0 .0f };
174174 unsigned rawReading; // raw value from analogRead, scaled to 12bit
175175
176- DEBUG_PRINT ( F (" Analog: Reading button " )); DEBUG_PRINTLN ( b);
176+ DEBUG_PRINTF_P ( PSTR (" Analog: Reading button %u \n " ), b);
177177
178178 #ifdef ESP8266
179179 rawReading = analogRead (A0) << 2 ; // convert 10bit read to 12bit
@@ -193,8 +193,8 @@ void handleAnalog(uint8_t b)
193193 // remove noise & reduce frequency of UI updates
194194 if (abs (int (aRead) - int (oldRead[b])) <= POT_SENSITIVITY) return ; // no significant change in reading
195195
196- DEBUG_PRINT ( F (" Analog: Raw = " )); DEBUG_PRINT ( rawReading);
197- DEBUG_PRINT ( F (" Filtered = " )); DEBUG_PRINTLN ( aRead);
196+ DEBUG_PRINTF_P ( PSTR (" Analog: Raw = %u \n " ), rawReading);
197+ DEBUG_PRINTF_P ( PSTR (" Filtered = %u \n " ), aRead);
198198
199199 // Unomment the next lines if you still see flickering related to potentiometer
200200 // This waits until strip finishes updating (why: strip was not updating at the start of handleButton() but may have started during analogRead()?)
@@ -207,7 +207,7 @@ void handleAnalog(uint8_t b)
207207
208208 // if no macro for "short press" and "long press" is defined use brightness control
209209 if (!macroButton[b] && !macroLongPress[b]) {
210- DEBUG_PRINT ( F (" Analog: Action = " )); DEBUG_PRINTLN ( macroDoublePress[b]);
210+ DEBUG_PRINTF_P ( PSTR (" Analog: Action = %u \n " ), macroDoublePress[b]);
211211 // if "double press" macro defines which option to change
212212 if (macroDoublePress[b] >= 250 ) {
213213 // global brightness
0 commit comments