Small changes in settings.
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
efebe9adb4
commit
377ccc477f
@ -47,14 +47,15 @@ Setting all_settings[] = {
|
|||||||
{"effects.tv_static.black_bar_speed", &settings.effects.tv_static.black_bar_speed, TYPE_UINT16},
|
{"effects.tv_static.black_bar_speed", &settings.effects.tv_static.black_bar_speed, TYPE_UINT16},
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t all_settings_size = 28;
|
const uint8_t all_settings_size = 29;
|
||||||
|
|
||||||
bool change_setting(const char* key, uint16_t new_value) {
|
bool change_setting(const char* key, uint16_t new_value) {
|
||||||
LOGln("Settings * Setting %s to new value %d.", key, new_value);
|
LOGln("Settings * Setting %s to new value %d.", key, new_value);
|
||||||
Setting* s = NULL;
|
Setting* s = NULL;
|
||||||
for (uint8_t i=0; i<all_settings_size; i++) {
|
for (uint8_t i=0; i<all_settings_size; i++) {
|
||||||
if (strcmp(key, all_settings[i].name)==0) {
|
s = &(all_settings[i]);
|
||||||
s = &all_settings[i];
|
|
||||||
|
if (strcmp(key, s->name)==0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,13 +100,14 @@ bool save_settings() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<all_settings_size; i++) {
|
Setting* s;
|
||||||
Setting s = all_settings[i];
|
for (uint8_t i=0; i<all_settings_size; i++) {
|
||||||
uint16_t value = *(s.value);
|
s = &(all_settings[i]);
|
||||||
uint16_t default_value = setting_default(&s);
|
uint16_t value = *(s->value);
|
||||||
|
uint16_t default_value = setting_default(s);
|
||||||
if (default_value != value) {
|
if (default_value != value) {
|
||||||
char buf[50];
|
char buf[50];
|
||||||
snprintf(buf, 50, "%s=%d", s.name, value);
|
snprintf(buf, 50, "%s=%d", s->name, value);
|
||||||
LOGln("Saving: %s", buf);
|
LOGln("Saving: %s", buf);
|
||||||
f.println(buf);
|
f.println(buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user