Skip to content

Commit cd52d7b

Browse files
softhack007DedeHai
authored andcommitted
align some function declariations with their implementation
This is purely a "clean code" thing, no impact on function - it helps to avoid confusion when reading the code. C++ allows declaration and implementation to use different variable names.
1 parent ed3ec66 commit cd52d7b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

wled00/FX.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ typedef struct Segment {
598598

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

872872
unsigned long now, timebase;
873-
uint32_t getPixelColor(unsigned) const;
873+
uint32_t getPixelColor(unsigned i) const;
874874

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

wled00/button.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ void doublePressAction(uint8_t b)
9090
#endif
9191
}
9292

93-
bool isButtonPressed(uint8_t i)
93+
bool isButtonPressed(uint8_t b)
9494
{
95-
if (btnPin[i]<0) return false;
96-
unsigned pin = btnPin[i];
95+
if (btnPin[b]<0) return false;
96+
unsigned pin = btnPin[b];
9797

98-
switch (buttonType[i]) {
98+
switch (buttonType[b]) {
9999
case BTN_TYPE_NONE:
100100
case BTN_TYPE_RESERVED:
101101
break;
@@ -113,7 +113,7 @@ bool isButtonPressed(uint8_t i)
113113
#ifdef SOC_TOUCH_VERSION_2 //ESP32 S2 and S3 provide a function to check touch state (state is updated in interrupt)
114114
if (touchInterruptGetLastStatus(pin)) return true;
115115
#else
116-
if (digitalPinToTouchChannel(btnPin[i]) >= 0 && touchRead(pin) <= touchThreshold) return true;
116+
if (digitalPinToTouchChannel(btnPin[b]) >= 0 && touchRead(pin) <= touchThreshold) return true;
117117
#endif
118118
#endif
119119
break;

wled00/fcn_declare.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ bool deserializeState(JsonObject root, byte callMode = CALL_MODE_DIRECT_CHANGE,
251251
void serializeSegment(const JsonObject& root, const Segment& seg, byte id, bool forPreset = false, bool segmentBounds = true);
252252
void serializeState(JsonObject root, bool forPreset = false, bool includeBri = true, bool segmentBounds = true, bool selectedSegmentsOnly = false);
253253
void serializeInfo(JsonObject root);
254-
void serializeModeNames(JsonArray root);
255-
void serializeModeData(JsonArray root);
254+
void serializeModeNames(JsonArray arr);
255+
void serializeModeData(JsonArray fxdata);
256256
void serveJson(AsyncWebServerRequest* request);
257257
#ifdef WLED_ENABLE_JSONLIVE
258258
bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient = 0);
@@ -469,7 +469,7 @@ void userLoop();
469469
#endif
470470
[[gnu::pure]] int getNumVal(const String* req, uint16_t pos);
471471
void parseNumber(const char* str, byte* val, byte minv=0, byte maxv=255);
472-
bool getVal(JsonVariant elem, byte* val, byte minv=0, byte maxv=255); // getVal supports inc/decrementing and random ("X~Y(r|[w]~[-][Z])" form)
472+
bool getVal(JsonVariant elem, byte* val, byte vmin=0, byte vmax=255); // getVal supports inc/decrementing and random ("X~Y(r|[w]~[-][Z])" form)
473473
[[gnu::pure]] bool getBoolVal(const JsonVariant &elem, bool dflt);
474474
bool updateVal(const char* req, const char* key, byte* val, byte minv=0, byte maxv=255);
475475
size_t printSetFormCheckbox(Print& settingsScript, const char* key, int val);

wled00/lx_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool parseLx(int lxValue, byte* rgbw)
2222
} else if ((lxValue >= 200000000) && (lxValue <= 201006500)) {
2323
// Loxone Lumitech
2424
ok = true;
25-
float tmpBri = floor((lxValue - 200000000) / 10000); ;
25+
float tmpBri = floor((lxValue - 200000000) / 10000);
2626
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
2727

2828
tmpBri *= 2.55f;

0 commit comments

Comments
 (0)