Remove persistent argument from savePreset()

(fixes temp preset not applicable by APIs)
Default to 5Mhz hardware SPI driving (#2558)
This commit is contained in:
cschwinne 2022-03-14 20:53:00 +01:00
parent f068327307
commit 9552784e72
8 changed files with 12 additions and 11 deletions

View File

@ -64,7 +64,7 @@ class AutoSaveUsermod : public Usermod {
PSTR("~ %02d-%02d %02d:%02d:%02d ~"),
month(localTime), day(localTime),
hour(localTime), minute(localTime), second(localTime));
savePreset(autoSavePreset, true, presetNameBuffer);
savePreset(autoSavePreset, presetNameBuffer);
}
void inline displayOverlay() {

View File

@ -65,7 +65,7 @@ void hourChime()
//strip.resetSegments();
selectWordSegments(true);
colorUpdated(CALL_MODE_FX_CHANGED);
savePreset(13, false);
//savePreset(255);
selectWordSegments(false);
//strip.getSegment(0).setOption(0, true);
strip.getSegment(0).setOption(2, true);
@ -299,7 +299,7 @@ void userLoop()
if (minute(localTime) == 1){
//turn off background segment;
strip.getSegment(0).setOption(2, false);
//applyPreset(13);
//applyPreset(255);
}
}
}

View File

@ -133,7 +133,7 @@
#endif
//APA102
#define B_HS_DOT_3 NeoPixelBrightnessBus<DotStarBgrFeature, DotStarSpiMethod> //hardware SPI
#define B_HS_DOT_3 NeoPixelBrightnessBus<DotStarBgrFeature, DotStarSpi5MhzMethod> //hardware SPI
#define B_SS_DOT_3 NeoPixelBrightnessBus<DotStarBgrFeature, DotStarMethod> //soft SPI
//LPD8806

View File

@ -190,8 +190,8 @@ void handlePlaylist();
//presets.cpp
bool applyPreset(byte index, byte callMode = CALL_MODE_DIRECT_CHANGE);
inline bool applyTemporaryPreset() {return applyPreset(255);};
void savePreset(byte index, bool persist = true, const char* pname = nullptr, JsonObject saveobj = JsonObject());
inline void saveTemporaryPreset() {savePreset(255, false);};
void savePreset(byte index, const char* pname = nullptr, JsonObject saveobj = JsonObject());
inline void saveTemporaryPreset() {savePreset(255);};
void deletePreset(byte index);
//set.cpp

View File

@ -699,7 +699,7 @@ void decodeIRJson(uint32_t code)
char pname[33];
sprintf_P(pname, PSTR("IR Preset %d"), psave);
fdo.clear();
if (psave > 0 && psave < 251) savePreset(psave, true, pname, fdo);
if (psave > 0 && psave < 251) savePreset(psave, pname, fdo);
}
}
releaseJSONBufferLock();

View File

@ -347,7 +347,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
byte ps = root[F("psave")];
if (ps > 0) {
savePreset(ps, true, nullptr, root);
savePreset(ps, nullptr, root);
} else {
ps = root[F("pdel")]; //deletion
if (ps > 0) {

View File

@ -50,12 +50,13 @@ bool applyPreset(byte index, byte callMode)
return false;
}
void savePreset(byte index, bool persist, const char* pname, JsonObject saveobj)
void savePreset(byte index, const char* pname, JsonObject saveobj)
{
if (index == 0 || (index > 250 && persist) || (index<255 && !persist)) return;
if (index == 0 || (index > 250 && index < 255)) return;
char tmp[12];
JsonObject sObj = saveobj;
bool persist = (index == 255);
const char *filename = persist ? "/presets.json" : "/tmp.json";
if (!fileDoc) {

View File

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