Fixed various Codacy code style and logic issues

pull/2049/head
cschwinne 2021-05-11 14:54:03 +02:00
rodzic 1ccc8eec0a
commit 5ca8bc3f2a
9 zmienionych plików z 15 dodań i 13 usunięć

Wyświetl plik

@ -2,6 +2,10 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2105111
- Fixed various Codacy code style and logic issues
#### Build 2105110 #### Build 2105110
- Added Usermod settings page and configurable usermods (PR #1951) - Added Usermod settings page and configurable usermods (PR #1951)

Wyświetl plik

@ -1467,8 +1467,8 @@ uint16_t WS2812FX::mode_tricolor_fade(void)
} }
byte stp = prog; // % 256 byte stp = prog; // % 256
uint32_t color = 0;
for(uint16_t i = 0; i < SEGLEN; i++) { for(uint16_t i = 0; i < SEGLEN; i++) {
uint32_t color;
if (stage == 2) { if (stage == 2) {
color = color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), color2, stp); color = color_blend(color_from_palette(i, true, PALETTE_SOLID_WRAP, 2), color2, stp);
} else if (stage == 1) { } else if (stage == 1) {

Wyświetl plik

@ -55,13 +55,12 @@ bool bufferedFind(const char *target, bool fromStart = true) {
size_t targetLen = strlen(target); size_t targetLen = strlen(target);
size_t index = 0; size_t index = 0;
uint16_t bufsize = 0, count = 0;
byte buf[FS_BUFSIZE]; byte buf[FS_BUFSIZE];
if (fromStart) f.seek(0); if (fromStart) f.seek(0);
while (f.position() < f.size() -1) { while (f.position() < f.size() -1) {
bufsize = f.read(buf, FS_BUFSIZE); uint16_t bufsize = f.read(buf, FS_BUFSIZE);
count = 0; uint16_t count = 0;
while (count < bufsize) { while (count < bufsize) {
if(buf[count] != target[index]) if(buf[count] != target[index])
index = 0; // reset index if any char does not match index = 0; // reset index if any char does not match

Wyświetl plik

@ -134,7 +134,7 @@ void deserializeSegment(JsonObject elem, byte it)
if (icol.isNull()) break; if (icol.isNull()) break;
byte sz = icol.size(); byte sz = icol.size();
if (sz == 0 && sz > 4) break; if (sz == 0 || sz > 4) break;
int rgbw[] = {0,0,0,0}; int rgbw[] = {0,0,0,0};
copyArray(icol, rgbw); copyArray(icol, rgbw);

Wyświetl plik

@ -112,7 +112,7 @@ void updateTimezone() {
break; break;
} }
case TZ_AUSTRALIA_NORTHERN : { case TZ_AUSTRALIA_NORTHERN : {
tcrStandard = {First, Sun, Apr, 3, 570}; //ACST = UTC + 9.5 hours tcrDaylight = {First, Sun, Apr, 3, 570}; //ACST = UTC + 9.5 hours
tcrStandard = tcrDaylight; tcrStandard = tcrDaylight;
break; break;
} }

Wyświetl plik

@ -63,10 +63,9 @@ void _overlayAnalogClock()
} }
if (analogClock5MinuteMarks) if (analogClock5MinuteMarks)
{ {
int pix; for (byte i = 0; i <= 12; i++)
for (int i = 0; i <= 12; i++)
{ {
pix = analogClock12pixel + round((overlaySize / 12.0) *i); int pix = analogClock12pixel + round((overlaySize / 12.0) *i);
if (pix > overlayMax) pix -= overlaySize; if (pix > overlayMax) pix -= overlaySize;
strip.setPixelColor(pix, 0x00FFAA); strip.setPixelColor(pix, 0x00FFAA);
} }

Wyświetl plik

@ -19,14 +19,14 @@ uint16_t playlistEntryDur = 0;
void shufflePlaylist() { void shufflePlaylist() {
int currentIndex = playlistLen, randomIndex; int currentIndex = playlistLen;
PlaylistEntry temporaryValue, *entries = reinterpret_cast<PlaylistEntry*>(playlistEntries); PlaylistEntry temporaryValue, *entries = reinterpret_cast<PlaylistEntry*>(playlistEntries);
// While there remain elements to shuffle... // While there remain elements to shuffle...
while (currentIndex--) { while (currentIndex--) {
// Pick a random element... // Pick a random element...
randomIndex = random(0, currentIndex); int randomIndex = random(0, currentIndex);
// And swap it with the current element. // And swap it with the current element.
temporaryValue = entries[currentIndex]; temporaryValue = entries[currentIndex];
entries[currentIndex] = entries[randomIndex]; entries[currentIndex] = entries[randomIndex];

Wyświetl plik

@ -124,7 +124,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
doInitBusses = true; doInitBusses = true;
} }
ledCount = request->arg(F("LC")).toInt(); t = request->arg(F("LC")).toInt();
if (t > 0 && t <= MAX_LEDS) ledCount = t; if (t > 0 && t <= MAX_LEDS) ledCount = t;
// upate other pins // upate other pins

Wyświetl plik

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2105110 #define VERSION 2105111
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG