Skip to content

Commit b4d976d

Browse files
committed
Refactor: roll some unrolled settings prints
1 parent 708c76c commit b4d976d

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

wled00/xml.cpp

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -634,37 +634,17 @@ void getSettingsJS(byte subPage, Print& settingsScript)
634634
printSetFormValue(settingsScript,PSTR("CS"),DMXStart);
635635
printSetFormValue(settingsScript,PSTR("SL"),DMXStartLED);
636636

637-
printSetFormIndex(settingsScript,PSTR("CH1"),DMXFixtureMap[0]);
638-
printSetFormIndex(settingsScript,PSTR("CH2"),DMXFixtureMap[1]);
639-
printSetFormIndex(settingsScript,PSTR("CH3"),DMXFixtureMap[2]);
640-
printSetFormIndex(settingsScript,PSTR("CH4"),DMXFixtureMap[3]);
641-
printSetFormIndex(settingsScript,PSTR("CH5"),DMXFixtureMap[4]);
642-
printSetFormIndex(settingsScript,PSTR("CH6"),DMXFixtureMap[5]);
643-
printSetFormIndex(settingsScript,PSTR("CH7"),DMXFixtureMap[6]);
644-
printSetFormIndex(settingsScript,PSTR("CH8"),DMXFixtureMap[7]);
645-
printSetFormIndex(settingsScript,PSTR("CH9"),DMXFixtureMap[8]);
646-
printSetFormIndex(settingsScript,PSTR("CH10"),DMXFixtureMap[9]);
647-
printSetFormIndex(settingsScript,PSTR("CH11"),DMXFixtureMap[10]);
648-
printSetFormIndex(settingsScript,PSTR("CH12"),DMXFixtureMap[11]);
649-
printSetFormIndex(settingsScript,PSTR("CH13"),DMXFixtureMap[12]);
650-
printSetFormIndex(settingsScript,PSTR("CH14"),DMXFixtureMap[13]);
651-
printSetFormIndex(settingsScript,PSTR("CH15"),DMXFixtureMap[14]);
652-
653-
printSetFormValue(settingsScript,PSTR("DV1"),DMXChannelsValue[0]);
654-
printSetFormValue(settingsScript,PSTR("DV2"),DMXChannelsValue[1]);
655-
printSetFormValue(settingsScript,PSTR("DV3"),DMXChannelsValue[2]);
656-
printSetFormValue(settingsScript,PSTR("DV4"),DMXChannelsValue[3]);
657-
printSetFormValue(settingsScript,PSTR("DV5"),DMXChannelsValue[4]);
658-
printSetFormValue(settingsScript,PSTR("DV6"),DMXChannelsValue[5]);
659-
printSetFormValue(settingsScript,PSTR("DV7"),DMXChannelsValue[6]);
660-
printSetFormValue(settingsScript,PSTR("DV8"),DMXChannelsValue[7]);
661-
printSetFormValue(settingsScript,PSTR("DV9"),DMXChannelsValue[8]);
662-
printSetFormValue(settingsScript,PSTR("DV10"),DMXChannelsValue[9]);
663-
printSetFormValue(settingsScript,PSTR("DV11"),DMXChannelsValue[10]);
664-
printSetFormValue(settingsScript,PSTR("DV12"),DMXChannelsValue[11]);
665-
printSetFormValue(settingsScript,PSTR("DV13"),DMXChannelsValue[12]);
666-
printSetFormValue(settingsScript,PSTR("DV14"),DMXChannelsValue[13]);
667-
printSetFormValue(settingsScript,PSTR("DV15"),DMXChannelsValue[14]);
637+
for (int i = 0; i < 15; i++) {
638+
char buf[5];
639+
snprintf_P(buf, sizeof(buf), PSTR("CH%d"), i+1);
640+
printSetFormIndex(settingsScript,buf,DMXFixtureMap[i]);
641+
}
642+
643+
for (int i = 0; i < 15; i++) {
644+
char buf[5];
645+
snprintf_P(buf, sizeof(buf), PSTR("DV%d"), i+1);
646+
printSetFormValue(settingsScript,buf,DMXChannelsValue[i]);
647+
}
668648
}
669649
#endif
670650

0 commit comments

Comments
 (0)