File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,22 @@ struct Switch18 : Module, SwitchBase {
160160 lights[STEP_1_LIGHT + i].setBrightness (i == current_step ? 1 .f : 0 .f );
161161 }
162162 }
163+
164+ json_t * dataToJson () override {
165+ json_t * rootJ = json_object ();
166+ json_object_set_new (rootJ, " fade_while_switching" , json_boolean (fade_while_switching));
167+ json_object_set_new (rootJ, " fade_speed" , json_real (fade_speed));
168+ return rootJ;
169+ }
170+
171+ void dataFromJson (json_t * rootJ) override {
172+ json_t * fadeJ = json_object_get (rootJ, " fade_while_switching" );
173+ if (fadeJ)
174+ fade_while_switching = json_boolean_value (fadeJ);
175+ json_t * fade_speedJ = json_object_get (rootJ, " fade_speed" );
176+ if (fade_speedJ)
177+ fade_speed = json_real_value (fade_speedJ);
178+ }
163179};
164180
165181
Original file line number Diff line number Diff line change @@ -165,6 +165,22 @@ struct Switch81 : Module, SwitchBase {
165165 lights[STEP_1_LIGHT + i].setBrightness (i == current_step ? 1 .f : 0 .f );
166166 }
167167 }
168+
169+ json_t * dataToJson () override {
170+ json_t * rootJ = json_object ();
171+ json_object_set_new (rootJ, " fade_while_switching" , json_boolean (fade_while_switching));
172+ json_object_set_new (rootJ, " fade_speed" , json_real (fade_speed));
173+ return rootJ;
174+ }
175+
176+ void dataFromJson (json_t * rootJ) override {
177+ json_t * fadeJ = json_object_get (rootJ, " fade_while_switching" );
178+ if (fadeJ)
179+ fade_while_switching = json_boolean_value (fadeJ);
180+ json_t * fade_speedJ = json_object_get (rootJ, " fade_speed" );
181+ if (fade_speedJ)
182+ fade_speed = json_real_value (fade_speedJ);
183+ }
168184};
169185
170186
You can’t perform that action at this time.
0 commit comments