@@ -245,10 +245,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
245245 strcpy (reply, " OK" );
246246 } else if (memcmp (config, " flood.advert.interval " , 22 ) == 0 ) {
247247 int hours = _atoi (&config[22 ]);
248- if (hours > 0 && hours < 3 ) {
249- sprintf (reply, " Error: min is 3 hours" );
250- } else if (hours > 48 ) {
251- strcpy (reply, " Error: max is 48 hours" );
248+ if ((hours > 0 && hours < 3 ) || (hours > 48 )) {
249+ strcpy (reply, " Error: interval range is 3-48 hours" );
252250 } else {
253251 _prefs->flood_advert_interval = (uint8_t )(hours);
254252 _callbacks->updateFloodAdvertTimer ();
@@ -257,10 +255,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
257255 }
258256 } else if (memcmp (config, " advert.interval " , 16 ) == 0 ) {
259257 int mins = _atoi (&config[16 ]);
260- if (mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) {
261- sprintf (reply, " Error: min is %d mins" , MIN_LOCAL_ADVERT_INTERVAL);
262- } else if (mins > 240 ) {
263- strcpy (reply, " Error: max is 240 mins" );
258+ if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > 240 )) {
259+ sprintf (reply, " Error: interval range is %d-240 minutes" , MIN_LOCAL_ADVERT_INTERVAL);
264260 } else {
265261 _prefs->advert_interval = (uint8_t )(mins / 2 );
266262 _callbacks->updateAdvertTimer ();
0 commit comments