minor bugfixes as suggested by the rabbit
- PulLightControl UM: dont release a lock you do not own - off-by-one error in extractModeSlider (used only in rotary in UM) - safety check in playlist in case something goes horribly wrong
This commit is contained in:
@@ -284,7 +284,6 @@ void HttpPullLightControl::handleResponse(String& responseStr) {
|
|||||||
if (!requestJSONBufferLock(myLockId)) {
|
if (!requestJSONBufferLock(myLockId)) {
|
||||||
DEBUG_PRINT(F("ERROR: Can not request JSON Buffer Lock, number: "));
|
DEBUG_PRINT(F("ERROR: Can not request JSON Buffer Lock, number: "));
|
||||||
DEBUG_PRINTLN(myLockId);
|
DEBUG_PRINTLN(myLockId);
|
||||||
releaseJSONBufferLock(); // Just release in any case, maybe there was already a buffer lock
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
|
|||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur;
|
if (it > 0) // should never happen but just in case
|
||||||
|
for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur;
|
||||||
|
|
||||||
it = 0;
|
it = 0;
|
||||||
JsonArray tr = playlistObj[F("transition")];
|
JsonArray tr = playlistObj[F("transition")];
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
|
|||||||
case 0: strncpy_P(dest, PSTR("FX Speed"), maxLen); break;
|
case 0: strncpy_P(dest, PSTR("FX Speed"), maxLen); break;
|
||||||
case 1: strncpy_P(dest, PSTR("FX Intensity"), maxLen); break;
|
case 1: strncpy_P(dest, PSTR("FX Intensity"), maxLen); break;
|
||||||
}
|
}
|
||||||
dest[maxLen] = '\0'; // strncpy does not necessarily null terminate string
|
dest[maxLen-1] = '\0'; // strncpy does not necessarily null terminate string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strlen(dest);
|
return strlen(dest);
|
||||||
|
|||||||
Reference in New Issue
Block a user