Fix for unknown IR codes in IR JSON.
Fix for T=2 not updating lights in IR JSON. Correct handling of missing ir.json file.
This commit is contained in:
parent
8f3fd37d47
commit
4e8c94fd2d
@ -1179,7 +1179,7 @@ function readState(s,command=false)
|
|||||||
errstr = "Preset not found.";
|
errstr = "Preset not found.";
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
errstr = "Missing IR.json.";
|
errstr = "Missing ir.json.";
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
errstr = "A filesystem error has occured.";
|
errstr = "A filesystem error has occured.";
|
||||||
|
1622
wled00/html_ui.h
1622
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -71,9 +71,11 @@ void decBrightness()
|
|||||||
// apply preset or fallback to a effect and palette if it doesn't exist
|
// apply preset or fallback to a effect and palette if it doesn't exist
|
||||||
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
||||||
{
|
{
|
||||||
|
byte prevError = errorFlag;
|
||||||
if (!applyPreset(presetID, CALL_MODE_BUTTON)) {
|
if (!applyPreset(presetID, CALL_MODE_BUTTON)) {
|
||||||
effectCurrent = effectID;
|
effectCurrent = effectID;
|
||||||
effectPalette = paletteID;
|
effectPalette = paletteID;
|
||||||
|
errorFlag = prevError; //clear error 12 from non-existent preset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +169,7 @@ void decodeIR(uint32_t code)
|
|||||||
//if (decodeIRCustom(code)) return;
|
//if (decodeIRCustom(code)) return;
|
||||||
if (irEnabled == 8) { // any remote configurable with ir.json file
|
if (irEnabled == 8) { // any remote configurable with ir.json file
|
||||||
decodeIRJson(code);
|
decodeIRJson(code);
|
||||||
|
colorUpdated(CALL_MODE_BUTTON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code > 0xFFFFFF) return; //invalid code
|
if (code > 0xFFFFFF) return; //invalid code
|
||||||
@ -568,24 +571,31 @@ Sample:
|
|||||||
void decodeIRJson(uint32_t code)
|
void decodeIRJson(uint32_t code)
|
||||||
{
|
{
|
||||||
char objKey[10];
|
char objKey[10];
|
||||||
const char* cmd;
|
|
||||||
String cmdStr;
|
String cmdStr;
|
||||||
DynamicJsonDocument irDoc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument irDoc(JSON_BUFFER_SIZE);
|
||||||
JsonObject fdo;
|
JsonObject fdo = irDoc.createNestedObject("cmd");
|
||||||
JsonObject jsonCmdObj;
|
|
||||||
|
|
||||||
|
lastValidCode = 0;
|
||||||
sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code);
|
sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code);
|
||||||
|
|
||||||
|
// attempt to read command from ir.json
|
||||||
|
// this may fail for two reasons: ir.json does not exist or IR code not found
|
||||||
|
// if the IR code is not found readObjectFromFile() will clean() irDoc JSON document
|
||||||
|
// so we can differentiate between the two
|
||||||
errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_IRLOAD;
|
errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_IRLOAD;
|
||||||
fdo = irDoc.as<JsonObject>();
|
if (irDoc["cmd"].isNull()) {
|
||||||
lastValidCode = 0;
|
errorFlag = ERR_NONE;
|
||||||
if (!errorFlag)
|
return;
|
||||||
{
|
}
|
||||||
cmd = fdo["cmd"];
|
if (!errorFlag) {
|
||||||
cmdStr = String(cmd);
|
|
||||||
jsonCmdObj = fdo["cmd"];
|
fdo = irDoc.as<JsonObject>();
|
||||||
if (!cmdStr.isEmpty())
|
|
||||||
{
|
JsonObject jsonCmdObj = fdo["cmd"];
|
||||||
|
cmdStr = fdo["cmd"].as<String>();
|
||||||
|
|
||||||
|
if (!cmdStr.isEmpty()) {
|
||||||
|
|
||||||
if (cmdStr.startsWith("!")) {
|
if (cmdStr.startsWith("!")) {
|
||||||
// call limited set of C functions
|
// call limited set of C functions
|
||||||
if (cmdStr.startsWith(F("!incBri"))) {
|
if (cmdStr.startsWith(F("!incBri"))) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2109031
|
#define VERSION 2109032
|
||||||
|
|
||||||
//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
|
||||||
|
Loading…
Reference in New Issue
Block a user