esp-now remote: reduce number of exported functions
too many global variables and functions ... this makes stuff 'static' that can remain at file scope
This commit is contained in:
parent
0ccadb246f
commit
1ed817932b
@ -44,21 +44,21 @@ static int brightnessBeforeNightMode = NIGHT_MODE_DEACTIVATED;
|
|||||||
static message_structure incoming;
|
static message_structure incoming;
|
||||||
|
|
||||||
// Pulled from the IR Remote logic but reduced to 10 steps with a constant of 3
|
// Pulled from the IR Remote logic but reduced to 10 steps with a constant of 3
|
||||||
const byte brightnessSteps[] = {
|
static const byte brightnessSteps[] = {
|
||||||
6, 9, 14, 22, 33, 50, 75, 113, 170, 255
|
6, 9, 14, 22, 33, 50, 75, 113, 170, 255
|
||||||
};
|
};
|
||||||
const size_t numBrightnessSteps = sizeof(brightnessSteps) / sizeof(uint8_t);
|
static const size_t numBrightnessSteps = sizeof(brightnessSteps) / sizeof(uint8_t);
|
||||||
|
|
||||||
bool nightModeActive() {
|
static bool nightModeActive() {
|
||||||
return brightnessBeforeNightMode != NIGHT_MODE_DEACTIVATED;
|
return brightnessBeforeNightMode != NIGHT_MODE_DEACTIVATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void activateNightMode() {
|
static void activateNightMode() {
|
||||||
brightnessBeforeNightMode = bri;
|
brightnessBeforeNightMode = bri;
|
||||||
bri = NIGHT_MODE_BRIGHTNESS;
|
bri = NIGHT_MODE_BRIGHTNESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool resetNightMode() {
|
static bool resetNightMode() {
|
||||||
if (!nightModeActive()) {
|
if (!nightModeActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ bool resetNightMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// increment `bri` to the next `brightnessSteps` value
|
// increment `bri` to the next `brightnessSteps` value
|
||||||
void brightnessUp() {
|
static void brightnessUp() {
|
||||||
if (nightModeActive()) { return; }
|
if (nightModeActive()) { return; }
|
||||||
// dumb incremental search is efficient enough for so few items
|
// dumb incremental search is efficient enough for so few items
|
||||||
for (uint8_t index = 0; index < numBrightnessSteps; ++index) {
|
for (uint8_t index = 0; index < numBrightnessSteps; ++index) {
|
||||||
@ -80,7 +80,7 @@ void brightnessUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decrement `bri` to the next `brightnessSteps` value
|
// decrement `bri` to the next `brightnessSteps` value
|
||||||
void brightnessDown() {
|
static void brightnessDown() {
|
||||||
if (nightModeActive()) { return; }
|
if (nightModeActive()) { return; }
|
||||||
// dumb incremental search is efficient enough for so few items
|
// dumb incremental search is efficient enough for so few items
|
||||||
for (int index = numBrightnessSteps - 1; index >= 0; --index) {
|
for (int index = numBrightnessSteps - 1; index >= 0; --index) {
|
||||||
@ -91,7 +91,7 @@ void brightnessDown() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOn() {
|
static void setOn() {
|
||||||
if (resetNightMode()) {
|
if (resetNightMode()) {
|
||||||
stateUpdated(CALL_MODE_BUTTON);
|
stateUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void setOn() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOff() {
|
static void setOff() {
|
||||||
if (resetNightMode()) {
|
if (resetNightMode()) {
|
||||||
stateUpdated(CALL_MODE_BUTTON);
|
stateUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ void setOff() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void presetWithFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) {
|
static void presetWithFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) {
|
||||||
applyPresetWithFallback(presetID, CALL_MODE_BUTTON_PRESET, effectID, paletteID);
|
applyPresetWithFallback(presetID, CALL_MODE_BUTTON_PRESET, effectID, paletteID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,9 @@ void WLED::loop()
|
|||||||
handleIR(); // 2nd call to function needed for ESP32 to return valid results -- should be good for ESP8266, too
|
handleIR(); // 2nd call to function needed for ESP32 to return valid results -- should be good for ESP8266, too
|
||||||
#endif
|
#endif
|
||||||
handleConnection();
|
handleConnection();
|
||||||
|
#ifndef WLED_DISABLE_ESPNOW
|
||||||
handleRemote();
|
handleRemote();
|
||||||
|
#endif
|
||||||
handleSerial();
|
handleSerial();
|
||||||
handleImprovWifiScan();
|
handleImprovWifiScan();
|
||||||
handleNotifications();
|
handleNotifications();
|
||||||
|
Loading…
Reference in New Issue
Block a user