mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 21:06:08 +01:00
fixed builds for non-rgb-led-equipped boards
This commit is contained in:
@@ -190,6 +190,23 @@ void rgbIdleStep() {
|
||||
showRGB();
|
||||
}
|
||||
}
|
||||
|
||||
void setBrightness(int brightness) {
|
||||
maxledbrightness = brightness;
|
||||
#ifdef HAS_RGB_LED
|
||||
FastLED.setBrightness(maxledbrightness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void updateBrightnessFromConfig() {
|
||||
if (APconfig["ledbrightness"].as<int>() != 0) {
|
||||
int newbrightness = APconfig["ledbrightness"].as<int>();
|
||||
if (newbrightness < 0) newbrightness = 0;
|
||||
if (newbrightness != maxledbrightness) {
|
||||
setBrightness(newbrightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void addToMonoQueue(struct ledInstruction* mono) {
|
||||
@@ -237,23 +254,6 @@ void monoIdleStep() {
|
||||
}
|
||||
}
|
||||
|
||||
void setBrightness(int brightness) {
|
||||
maxledbrightness = brightness;
|
||||
#ifdef HAS_RGB_LED
|
||||
FastLED.setBrightness(maxledbrightness);
|
||||
#endif
|
||||
}
|
||||
|
||||
void updateBrightnessFromConfig() {
|
||||
if (APconfig["ledbrightness"].as<int>() != 0) {
|
||||
int newbrightness = APconfig["ledbrightness"].as<int>();
|
||||
if (newbrightness < 0) newbrightness = 0;
|
||||
if (newbrightness != maxledbrightness) {
|
||||
setBrightness(newbrightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ledTask(void* parameter) {
|
||||
#ifdef HAS_RGB_LED
|
||||
FastLED.addLeds<WS2812B, FLASHER_RGB_LED, GRB>(leds, 1); // GRB ordering is typical
|
||||
|
||||
@@ -41,7 +41,7 @@ void setup() {
|
||||
// starts the led task/state machine
|
||||
xTaskCreate(ledTask, "ledhandler", 2000, NULL, 2, NULL);
|
||||
vTaskDelay(10/portTICK_PERIOD_MS);
|
||||
|
||||
|
||||
// show a nice pattern to indicate the AP is booting / waiting for WiFi setup
|
||||
#ifdef HAS_RGB_LED
|
||||
showColorPattern(CRGB::Aqua, CRGB::Green, CRGB::Blue);
|
||||
@@ -109,7 +109,9 @@ void setup() {
|
||||
|
||||
initAPconfig();
|
||||
|
||||
#ifdef HAS_RGB_LED
|
||||
updateBrightnessFromConfig();
|
||||
#endif
|
||||
|
||||
init_web();
|
||||
init_udp();
|
||||
|
||||
@@ -169,7 +169,7 @@ void wsSendTaginfo(uint8_t mac[6]) {
|
||||
xSemaphoreGive(wsMutex);
|
||||
}
|
||||
|
||||
void wsSendAPitem(struct APlist* apitem) {
|
||||
void wsSendAPitem(struct APlist *apitem) {
|
||||
DynamicJsonDocument doc(250);
|
||||
JsonObject ap = doc.createNestedObject("apitem");
|
||||
|
||||
@@ -313,7 +313,9 @@ void init_web() {
|
||||
APconfig["alias"] = request->getParam("alias", true)->value();
|
||||
APconfig["channel"] = request->getParam("channel", true)->value();
|
||||
APconfig["ledbrightness"] = request->getParam("ledbrightness", true)->value();
|
||||
#ifdef HAS_RGB_LED
|
||||
updateBrightnessFromConfig();
|
||||
#endif
|
||||
saveAPconfig();
|
||||
setAPchannel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user