@@ -249,10 +249,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
249249 strcpy (reply, " OK" );
250250 } else if (memcmp (config, " flood.advert.interval " , 22 ) == 0 ) {
251251 int hours = _atoi (&config[22 ]);
252- if (hours > 0 && hours < 3 ) {
253- sprintf (reply, " Error: min is 3 hours" );
254- } else if (hours > 48 ) {
255- strcpy (reply, " Error: max is 48 hours" );
252+ if ((hours > 0 && hours < 3 ) || (hours > 48 )) {
253+ strcpy (reply, " Error: interval range is 3-48 hours" );
256254 } else {
257255 _prefs->flood_advert_interval = (uint8_t )(hours);
258256 _callbacks->updateFloodAdvertTimer ();
@@ -261,10 +259,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
261259 }
262260 } else if (memcmp (config, " advert.interval " , 16 ) == 0 ) {
263261 int mins = _atoi (&config[16 ]);
264- if (mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) {
265- sprintf (reply, " Error: min is %d mins" , MIN_LOCAL_ADVERT_INTERVAL);
266- } else if (mins > 240 ) {
267- strcpy (reply, " Error: max is 240 mins" );
262+ if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > 240 )) {
263+ sprintf (reply, " Error: interval range is %d-240 minutes" , MIN_LOCAL_ADVERT_INTERVAL);
268264 } else {
269265 _prefs->advert_interval = (uint8_t )(mins / 2 );
270266 _callbacks->updateAdvertTimer ();
0 commit comments