diff --git a/common/config_file.h b/common/config_file.h index e3dfa2bf7..25b601d72 100644 --- a/common/config_file.h +++ b/common/config_file.h @@ -26,6 +26,14 @@ struct ConfigFile { if (f->Peek() != '=') continue; f->Read(); f->skipwhite(); +#ifndef KEEP_SAVEFILES_WHEN_PROGRAMMING + if (!strcmp(variable, "installed")) { + if (!f->Expect(install_time)) { + return ReadStatus::READ_FAIL; + } + continue; + } +#endif float v = f->readFloatValue(); #if 0 STDOUT.print(variable); diff --git a/common/current_preset.h b/common/current_preset.h index ff2824d31..7b6e85848 100644 --- a/common/current_preset.h +++ b/common/current_preset.h @@ -165,11 +165,7 @@ class CurrentPreset { f->readVariable(variable); if (strcmp(variable, "installed")) return false; if (f->Read() != '=') return false; - const char* tmp = install_time; - while (*tmp) { - if (f->Read() != *tmp) return false; - tmp++; - } + if (!f->Expect(install_time)) return false; if (f->Read() != '\n') return false; pos = f->Tell(); #endif diff --git a/common/file_reader.h b/common/file_reader.h index 37ef587b7..c87f0f79a 100644 --- a/common/file_reader.h +++ b/common/file_reader.h @@ -224,6 +224,14 @@ class FileReader { } return -1; } + bool Expect(const char* str) { + while (*str) { + if (Peek() != *str) return false; + Read(); + str++; + } + return true; + } int AlignRead(int n) { #ifdef ENABLE_SD if (type_ == TYPE_SD) { diff --git a/config/proffieboard_v1_test_bench_config.h b/config/proffieboard_v1_test_bench_config.h index da63061e3..9f88845a9 100644 --- a/config/proffieboard_v1_test_bench_config.h +++ b/config/proffieboard_v1_test_bench_config.h @@ -42,7 +42,7 @@ const unsigned int maxLedsPerStrip = 196; // #define DISABLE_DIAGNOSTIC_COMMANDS // #define SAVE_COLOR_CHANGE // #define DISABLE_COLOR_CHANGE -// #define SAVE_STATE +#define SAVE_STATE // Must be 20 characters or less. // #define BLE_PASSWORD "password" @@ -70,13 +70,26 @@ typedef Pulsing, Rgb16<50,50,50>, 3000> OffPulse; Preset testing_presets[] = { #if 1 { "SmthFuzz", "tracks/cantina.wav", - StylePtr>,Int<14000>,Int<4000>>,Int<10000>>, - Bump>,Int<10000>,Int<20000>>,Int<8000>>, - Bump>,Int<29000>,Int<20000>>,Int<6000>> - >>>,300,500>>(), + StylePtr,InOutTrL,TrWipeIn<500>,Black>>>(), + StylePtr, 10, 35, Cyan, 90, 1000, 6000>>(), + "ONE" }, +#endif +#if 0 + { "SmthFuzz", "tracks/cantina.wav", + StylePtr,InOutTrL,TrWipeIn<500>,Black>>>(), +// StylePtr>,Int<14000>,Int<4000>>,Int<10000>>, +// Bump>,Int<10000>,Int<20000>>,Int<8000>>, +// Bump>,Int<29000>,Int<20000>>,Int<6000>> +// >>>,300,500>>(), StylePtr,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,600,400,Snow>,Rgb<100,100,255>,350,200,750>,Pulsing,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,BrownNoiseFlicker,100>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>>,Gradient,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,BrownNoiseFlicker,100>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>,AudioFlicker,Green,Blue,Rgb<25,25,255>,Red,Rgb<255,50,0>,Rgb<200,100,0>,Rgb16<34702,0,65535>>,ColorChange,Rgb<25,200,0>,Rgb<0,0,200>,Rgb<20,20,200>,Rgb<175,0,0>,Rgb<200,25,0>,Rgb<175,75,0>,Rgb<125,0,200>>>>,3500>,HumpFlicker,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<200,75,100>,Rgb<200,75,100>,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<100,75,200>>,ColorChange,Rgb<0,255,75>,Rgb<200,75,100>,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<30,30,255>,Rgb<30,30,255>,Blue>,100>>,HumpFlicker,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<200,75,100>,Rgb<200,75,100>,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<100,75,200>>,ColorChange,Rgb<0,255,75>,Rgb<200,75,100>,Rgb<100,75,200>,Rgb<100,75,200>,Rgb<30,30,255>,Rgb<30,30,255>,Blue>,100>,250>,600,400>>(), "ONE" }, +#endif +#if 0 + { "SmthFuzz", "tracks/cantina.wav", + StylePtr,InOutTrL,TrWipeIn<500>,Black>>>(), + StylePtr,InOutTrL,TrWipeIn<500>,Black>>>(), + "ONE" }, #endif { "SmthFuzz", "tracks/cantina.wav", StylePtr>())), // DimBlade(5.0, WS2811BladePtr<10, WS2811_800kHz | WS2811_GRB , bladePin, PowerPINS>()), // SimpleBladePtr, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>(), - WS2811BladePtr<97, WS2811_800kHz, blade2Pin, PowerPINS>(), +// WS2811BladePtr<97, WS2811_800kHz, blade2Pin, PowerPINS>(), + WS2811BladePtr<30, WS2811_800kHz | WS2811_GRB, blade2Pin, PowerPINS>(), CONFIGARRAY(testing_presets) }, // { 130000, WS2811BladePtr<97, WS2811_800kHz, blade2Pin, PowerPINS>(), CONFIGARRAY(testing_presets) } // { 130000, WS281XBladePtr<131, blade2Pin, Color8::RGBw>(), CONFIGARRAY(testing_presets) }, diff --git a/props/prop_base.h b/props/prop_base.h index 61480fcda..071610e6c 100644 --- a/props/prop_base.h +++ b/props/prop_base.h @@ -414,6 +414,7 @@ class PropBase : CommandParser, Looper, protected SaberBase { FileReader out; LSFS::Remove(fn); out.Create(fn); + out.write_key_value("installed", install_time); out.write_key_value("preset", preset); out.write_key_value("end", "1"); out.Close(); @@ -441,6 +442,7 @@ class PropBase : CommandParser, Looper, protected SaberBase { FileReader out; LSFS::Remove(filename); out.Create(filename); + out.write_key_value("installed", install_time); #ifdef ENABLE_AUDIO out.write_key_value("volume", muted_volume_ ? muted_volume_ : dynamic_mixer.get_volume()); #endif