Skip to content

Commit

Permalink
Add DEBUG_NEOPIXEL definition
Browse files Browse the repository at this point in the history
  • Loading branch information
melkati committed Apr 17, 2024
1 parent cb2c6c3 commit 8703210
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions CO2_Gadget_Neopixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,38 @@ uint32_t green = strip.Color(0, 255, 0);
uint32_t yellow = strip.Color(255, 100, 0);

void setNeopixelBrightness(uint8_t newBrightness) {
#ifdef DEBUG_NEOPIXEL
Serial.println("-->[NPIX] Setting neopixel brightness value at: " + String(newBrightness));
#endif
strip.setBrightness(newBrightness);
strip.show();
}

void initNeopixel() {
strip.begin();
setNeopixelBrightness(neopixelBrightness);
strip.show(); // Initialize all pixels to 'off'
strip.show(); // Initialize all pixels to 'off'
}

void neopixelLoop() {
if (co2 > 0) { // Don't turn on led until there is CO2 Data
if (co2 >= co2RedRange) {
strip.fill(red);
} else if (co2 >= co2OrangeRange) {
strip.fill(yellow);
} else {
strip.fill(green);
if (co2 > 0) { // Don't turn on led until there is CO2 Data
if (co2 >= co2RedRange) {
strip.fill(red);
} else if (co2 >= co2OrangeRange) {
strip.fill(yellow);
} else {
strip.fill(green);
}
strip.show();
}
strip.show();
}
}

void setNeopixelType(neoPixelType newType) {
Serial.printf("-->[NPIX] Setting neopixel type value at %d\n", newType);
strip.updateType(newType);
strip.clear();
#ifdef DEBUG_NEOPIXEL
Serial.printf("-->[NPIX] Setting neopixel type value at %d\n", newType);
#endif
strip.updateType(newType);
strip.clear();
}

#endif // CO2_Gadget_Neopixel_h
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ build_flags =
-D CO2_GADGET_REV="\"026-new-layout"\"
-D CORE_DEBUG_LEVEL=0
-DDEBUG_EINK
; -DDEBUG_NEOPIXEL
; -DDEBUG_WIFI_EVENTS
; -DDEBUG_ARDUINOMENU
; -DMENU_DEBUG ; Needs streamFlow library
Expand Down

0 comments on commit 8703210

Please sign in to comment.