Skip to content

Commit 90c2955

Browse files
softhack007DedeHai
authored andcommitted
avoid using keywords for variables: module, final
these are reserved names and future compilers may reject them.
1 parent 7be868d commit 90c2955

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

wled00/fcn_declare.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ size_t printSetFormIndex(Print& settingsScript, const char* key, int index);
479479
size_t printSetClassElementHTML(Print& settingsScript, const char* key, const int index, const char* val);
480480
void prepareHostname(char* hostname);
481481
bool isAsterisksOnly(const char* str, byte maxLen);
482-
bool requestJSONBufferLock(uint8_t module=255);
482+
bool requestJSONBufferLock(uint8_t moduleID=255);
483483
void releaseJSONBufferLock();
484484
uint8_t extractModeName(uint8_t mode, const char *src, char *dest, uint8_t maxLen);
485485
uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxLen, uint8_t *var = nullptr);

wled00/util.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ bool isAsterisksOnly(const char* str, byte maxLen)
151151

152152

153153
//threading/network callback details: https://github.com/Aircoookie/WLED/pull/2336#discussion_r762276994
154-
bool requestJSONBufferLock(uint8_t module)
154+
bool requestJSONBufferLock(uint8_t moduleID)
155155
{
156156
if (pDoc == nullptr) {
157157
DEBUG_PRINTLN(F("ERROR: JSON buffer not allocated!"));
@@ -175,14 +175,14 @@ bool requestJSONBufferLock(uint8_t module)
175175
#endif
176176
// If the lock is still held - by us, or by another task
177177
if (jsonBufferLock) {
178-
DEBUG_PRINTF_P(PSTR("ERROR: Locking JSON buffer (%d) failed! (still locked by %d)\n"), module, jsonBufferLock);
178+
DEBUG_PRINTF_P(PSTR("ERROR: Locking JSON buffer (%d) failed! (still locked by %d)\n"), moduleID, jsonBufferLock);
179179
#ifdef ARDUINO_ARCH_ESP32
180180
xSemaphoreGiveRecursive(jsonBufferLockMutex);
181181
#endif
182182
return false;
183183
}
184184

185-
jsonBufferLock = module ? module : 255;
185+
jsonBufferLock = moduleID ? moduleID : 255;
186186
DEBUG_PRINTF_P(PSTR("JSON buffer locked. (%d)\n"), jsonBufferLock);
187187
pDoc->clear();
188188
return true;
@@ -470,7 +470,7 @@ um_data_t* simulateSound(uint8_t simulationId)
470470
for (int i = 0; i<16; i++)
471471
fftResult[i] = beatsin8_t(120 / (i+1), 0, 255);
472472
// fftResult[i] = (beatsin8_t(120, 0, 255) + (256/16 * i)) % 256;
473-
volumeSmth = fftResult[8];
473+
volumeSmth = fftResult[8];
474474
break;
475475
case UMS_WeWillRockYou:
476476
if (ms%2000 < 200) {
@@ -507,7 +507,7 @@ um_data_t* simulateSound(uint8_t simulationId)
507507
case UMS_10_13:
508508
for (int i = 0; i<16; i++)
509509
fftResult[i] = inoise8(beatsin8_t(90 / (i+1), 0, 200)*15 + (ms>>10), ms>>3);
510-
volumeSmth = fftResult[8];
510+
volumeSmth = fftResult[8];
511511
break;
512512
case UMS_14_3:
513513
for (int i = 0; i<16; i++)

wled00/wled_server.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ static String msgProcessor(const String& var)
152152
return String();
153153
}
154154

155-
static void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final) {
155+
static void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool isFinal) {
156156
if (!correctPIN) {
157-
if (final) request->send(401, FPSTR(CONTENT_TYPE_PLAIN), FPSTR(s_unlock_cfg));
157+
if (isFinal) request->send(401, FPSTR(CONTENT_TYPE_PLAIN), FPSTR(s_unlock_cfg));
158158
return;
159159
}
160160
if (!index) {
@@ -170,7 +170,7 @@ static void handleUpload(AsyncWebServerRequest *request, const String& filename,
170170
if (len) {
171171
request->_tempFile.write(data,len);
172172
}
173-
if (final) {
173+
if (isFinal) {
174174
request->_tempFile.close();
175175
if (filename.indexOf(F("cfg.json")) >= 0) { // check for filename with or without slash
176176
doReboot = true;
@@ -359,7 +359,7 @@ void initServer()
359359

360360
server.on(F("/upload"), HTTP_POST, [](AsyncWebServerRequest *request) {},
361361
[](AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data,
362-
size_t len, bool final) {handleUpload(request, filename, index, data, len, final);}
362+
size_t len, bool isFinal) {handleUpload(request, filename, index, data, len, isFinal);}
363363
);
364364

365365
createEditHandler(correctPIN);
@@ -389,7 +389,7 @@ void initServer()
389389
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
390390
doReboot = true;
391391
}
392-
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
392+
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){
393393
if (!correctPIN || otaLock) return;
394394
if(!index){
395395
DEBUG_PRINTLN(F("OTA Update Start"));
@@ -406,7 +406,7 @@ void initServer()
406406
Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000);
407407
}
408408
if(!Update.hasError()) Update.write(data, len);
409-
if(final){
409+
if(isFinal){
410410
if(Update.end(true)){
411411
DEBUG_PRINTLN(F("Update Success"));
412412
} else {

0 commit comments

Comments
 (0)