Skip first and apply preset fixes
This commit is contained in:
parent
3f0258e215
commit
2ce8f1ee5d
@ -91,7 +91,7 @@ class Bus {
|
||||
virtual void setBrightness(uint8_t b) {}
|
||||
virtual void cleanup() {}
|
||||
virtual uint8_t getPins(uint8_t* pinArray) { return 0; }
|
||||
inline uint16_t getLength() { return _len; }
|
||||
virtual uint16_t getLength() { return _len; }
|
||||
virtual void setColorOrder() {}
|
||||
virtual uint8_t getColorOrder() { return COL_ORDER_RGB; }
|
||||
virtual uint8_t skippedLeds() { return 0; }
|
||||
@ -220,7 +220,7 @@ class BusDigital : public Bus {
|
||||
return _colorOrder;
|
||||
}
|
||||
|
||||
inline uint16_t getLength() {
|
||||
uint16_t getLength() {
|
||||
return _len - _skip;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,15 @@ bool applyPreset(byte index, byte callMode)
|
||||
|
||||
const char *filename = index < 255 ? "/presets.json" : "/tmp.json";
|
||||
|
||||
if (fileDoc) {
|
||||
uint8_t core = 1;
|
||||
//crude way to determine if this was called by a network request
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
core = xPortGetCoreID();
|
||||
#endif
|
||||
|
||||
//only allow use of fileDoc from the core responsible for network requests
|
||||
//do not use active network request doc from preset called by main loop (playlist, schedule, ...)
|
||||
if (fileDoc && core) {
|
||||
errorFlag = readObjectFromFileUsingId(filename, index, fileDoc) ? ERR_NONE : ERR_FS_PLOAD;
|
||||
JsonObject fdo = fileDoc->as<JsonObject>();
|
||||
if (fdo["ps"] == index) fdo.remove("ps"); //remove load request for same presets to prevent recursive crash
|
||||
|
Loading…
Reference in New Issue
Block a user