Skip to content

Commit

Permalink
Remove persistent argument from savePreset()
Browse files Browse the repository at this point in the history
(fixes temp preset not applicable by APIs)
Default to 5Mhz hardware SPI driving (Aircoookie#2558)
  • Loading branch information
Aircoookie committed Mar 14, 2022
1 parent f068327 commit 9552784
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion usermods/usermod_v2_auto_save/usermod_v2_auto_save.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions usermods/word-clock-matrix/word-clock-matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -299,7 +299,7 @@ void userLoop()
if (minute(localTime) == 1){
//turn off background segment;
strip.getSegment(0).setOption(2, false);
//applyPreset(13);
//applyPreset(255);
}
}
}
2 changes: 1 addition & 1 deletion wled00/bus_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wled00/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions wled00/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9552784

Please sign in to comment.