@@ -138,20 +138,24 @@ boolean Plugin_004(uint8_t function, struct EventStruct *event, String& string)
138138 int resolutionChoice = P004_RESOLUTION;
139139
140140 if ((resolutionChoice < 9 ) || (resolutionChoice > 12 )) { resolutionChoice = activeRes; }
141- const __FlashStringHelper *resultsOptions[] = { F (" 9" ), F (" 10" ), F (" 11" ), F (" 12" ) };
142- const int resultsOptionValues[] = { 9 , 10 , 11 , 12 };
143- constexpr size_t optionCount = NR_ELEMENTS (resultsOptionValues);
144- addFormSelector (F (" Device Resolution" ), F (" res" ), optionCount, resultsOptions, resultsOptionValues, resolutionChoice);
145- addHtml (F (" Bit" ));
141+ constexpr int resultsOptionValues[] { 9 , 10 , 11 , 12 };
142+
143+ FormSelectorOptions selector (
144+ NR_ELEMENTS (resultsOptionValues),
145+ resultsOptionValues);
146+ selector.addFormSelector (F (" Device Resolution" ), F (" res" ), resolutionChoice);
147+ addUnit (F (" bit" ));
146148 }
147149
148150 {
149151 // Value in case of Error
150152 const __FlashStringHelper *resultsOptions[] = { F (" NaN" ), F (" -127" ), F (" 0" ), F (" 125" ), F (" Ignore" ) };
151- int resultsOptionValues[] =
152- { P004_ERROR_NAN, P004_ERROR_MIN_RANGE, P004_ERROR_ZERO, P004_ERROR_MAX_RANGE, P004_ERROR_IGNORE };
153- constexpr size_t optionCount = NR_ELEMENTS (resultsOptionValues);
154- addFormSelector (F (" Error State Value" ), F (" err" ), optionCount, resultsOptions, resultsOptionValues, P004_ERROR_STATE_OUTPUT);
153+ constexpr int resultsOptionValues[] { P004_ERROR_NAN, P004_ERROR_MIN_RANGE, P004_ERROR_ZERO, P004_ERROR_MAX_RANGE, P004_ERROR_IGNORE };
154+
155+ FormSelectorOptions selector (
156+ NR_ELEMENTS (resultsOptionValues),
157+ resultsOptions, resultsOptionValues);
158+ selector.addFormSelector (F (" Error State Value" ), F (" err" ), P004_ERROR_STATE_OUTPUT);
155159 }
156160 addFormNote (F (" External pull up resistor is needed, see docs!" ));
157161
0 commit comments