Skip to content

Commit

Permalink
Merge branch 'code_robustness' of https://github.com/Aircoookie/WLED
Browse files Browse the repository at this point in the history
…into code_robustness
  • Loading branch information
blazoncek committed Jan 9, 2025
2 parents 7b43dbd + f5d87c1 commit 84dbbc2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ typedef struct Segment {

// 1D strip
[[gnu::hot]] uint16_t virtualLength() const;
[[gnu::hot]] void setPixelColor(int n, uint32_t c) const; // set relative pixel within segment with color
[[gnu::hot]] void setPixelColor(int i, uint32_t c) const; // set relative pixel within segment with color
inline void setPixelColor(unsigned n, uint32_t c) const { setPixelColor(int(n), c); }
inline void setPixelColor(int n, byte r, byte g, byte b, byte w = 0) const { setPixelColor(n, RGBW32(r,g,b,w)); }
inline void setPixelColor(int n, CRGB c) const { setPixelColor(n, RGBW32(c.r,c.g,c.b,0)); }
Expand Down Expand Up @@ -805,7 +805,7 @@ class WS2812FX { // 96 bytes
resetSegments(), // marks all segments for reset
makeAutoSegments(bool forceReset = false), // will create segments based on configured outputs
fixInvalidSegments(), // fixes incorrect segment configuration
setPixelColor(unsigned n, uint32_t c) const, // paints absolute strip pixel with index n and color c
setPixelColor(unsigned i, uint32_t c) const, // paints absolute strip pixel with index n and color c
show(), // initiates LED output
setTargetFps(unsigned fps),
setupEffectData(); // add default effects to the list; defined in FX.cpp
Expand Down Expand Up @@ -870,7 +870,7 @@ class WS2812FX { // 96 bytes
};

unsigned long now, timebase;
uint32_t getPixelColor(unsigned) const;
uint32_t getPixelColor(unsigned i) const;

inline uint32_t getLastShow() const { return _lastShow; } // returns millis() timestamp of last strip.show() call

Expand Down
10 changes: 5 additions & 5 deletions wled00/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void doublePressAction(uint8_t b)
#endif
}

bool isButtonPressed(uint8_t i)
bool isButtonPressed(uint8_t b)
{
if (btnPin[i]<0) return false;
unsigned pin = btnPin[i];
if (btnPin[b]<0) return false;
unsigned pin = btnPin[b];

switch (buttonType[i]) {
switch (buttonType[b]) {
case BTN_TYPE_NONE:
case BTN_TYPE_RESERVED:
break;
Expand All @@ -113,7 +113,7 @@ bool isButtonPressed(uint8_t i)
#ifdef SOC_TOUCH_VERSION_2 //ESP32 S2 and S3 provide a function to check touch state (state is updated in interrupt)
if (touchInterruptGetLastStatus(pin)) return true;
#else
if (digitalPinToTouchChannel(btnPin[i]) >= 0 && touchRead(pin) <= touchThreshold) return true;
if (digitalPinToTouchChannel(btnPin[b]) >= 0 && touchRead(pin) <= touchThreshold) return true;
#endif
#endif
break;
Expand Down
6 changes: 3 additions & 3 deletions wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ bool deserializeState(JsonObject root, byte callMode = CALL_MODE_DIRECT_CHANGE,
void serializeSegment(const JsonObject& root, const Segment& seg, byte id, bool forPreset = false, bool segmentBounds = true);
void serializeState(JsonObject root, bool forPreset = false, bool includeBri = true, bool segmentBounds = true, bool selectedSegmentsOnly = false);
void serializeInfo(JsonObject root);
void serializeModeNames(JsonArray root);
void serializeModeData(JsonArray root);
void serializeModeNames(JsonArray arr);
void serializeModeData(JsonArray fxdata);
void serveJson(AsyncWebServerRequest* request);
#ifdef WLED_ENABLE_JSONLIVE
bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient = 0);
Expand Down Expand Up @@ -466,7 +466,7 @@ void userLoop();
#endif
[[gnu::pure]] int getNumVal(const String* req, uint16_t pos);
void parseNumber(const char* str, byte* val, byte minv=0, byte maxv=255);
bool getVal(JsonVariant elem, byte* val, byte minv=0, byte maxv=255); // getVal supports inc/decrementing and random ("X~Y(r|[w]~[-][Z])" form)
bool getVal(JsonVariant elem, byte* val, byte vmin=0, byte vmax=255); // getVal supports inc/decrementing and random ("X~Y(r|[w]~[-][Z])" form)
[[gnu::pure]] bool getBoolVal(const JsonVariant &elem, bool dflt);
bool updateVal(const char* req, const char* key, byte* val, byte minv=0, byte maxv=255);
size_t printSetFormCheckbox(Print& settingsScript, const char* key, int val);
Expand Down
2 changes: 1 addition & 1 deletion wled00/lx_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bool parseLx(int lxValue, byte* rgbw)
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
// Loxone Lumitech
ok = true;
float tmpBri = floor((lxValue - 200000000) / 10000); ;
float tmpBri = floor((lxValue - 200000000) / 10000);
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);

tmpBri *= 2.55f;
Expand Down

0 comments on commit 84dbbc2

Please sign in to comment.