@@ -165,6 +165,21 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
165165 }
166166 } else if (memcmp (command, " neighbors" , 9 ) == 0 ) {
167167 _callbacks->formatNeighborsReply (reply);
168+ } else if (memcmp (command, " tempradio " , 10 ) == 0 ) {
169+ strcpy (tmp, &command[10 ]);
170+ const char *parts[5 ];
171+ int num = mesh::Utils::parseTextParts (tmp, parts, 5 );
172+ float freq = num > 0 ? atof (parts[0 ]) : 0 .0f ;
173+ float bw = num > 1 ? atof (parts[1 ]) : 0 .0f ;
174+ uint8_t sf = num > 2 ? atoi (parts[2 ]) : 0 ;
175+ uint8_t cr = num > 3 ? atoi (parts[3 ]) : 0 ;
176+ int temp_timeout_mins = num > 4 ? atoi (parts[4 ]) : 0 ;
177+ if (freq >= 300 .0f && freq <= 2500 .0f && sf >= 7 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7 .0f && bw <= 500 .0f && temp_timeout_mins > 0 ) {
178+ _callbacks->applyTempRadioParams (freq, bw, sf, cr, temp_timeout_mins);
179+ sprintf (reply, " OK - temp params for %d mins" , temp_timeout_mins);
180+ } else {
181+ strcpy (reply, " Error, invalid params" );
182+ }
168183 } else if (memcmp (command, " password " , 9 ) == 0 ) {
169184 // change admin password
170185 StrHelper::strncpy (_prefs->password , &command[9 ], sizeof (_prefs->password ));
@@ -280,25 +295,19 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
280295 strcpy (reply, _prefs->disable_fwd ? " OK - repeat is now OFF" : " OK - repeat is now ON" );
281296 } else if (memcmp (config, " radio " , 6 ) == 0 ) {
282297 strcpy (tmp, &config[6 ]);
283- const char *parts[5 ];
284- int num = mesh::Utils::parseTextParts (tmp, parts, 5 );
298+ const char *parts[4 ];
299+ int num = mesh::Utils::parseTextParts (tmp, parts, 4 );
285300 float freq = num > 0 ? atof (parts[0 ]) : 0 .0f ;
286301 float bw = num > 1 ? atof (parts[1 ]) : 0 .0f ;
287302 uint8_t sf = num > 2 ? atoi (parts[2 ]) : 0 ;
288303 uint8_t cr = num > 3 ? atoi (parts[3 ]) : 0 ;
289- int temp_timeout_mins = num > 4 ? atoi (parts[4 ]) : 0 ;
290304 if (freq >= 300 .0f && freq <= 2500 .0f && sf >= 7 && sf <= 12 && cr >= 5 && cr <= 8 && bw >= 7 .0f && bw <= 500 .0f ) {
291- if (temp_timeout_mins > 0 ) {
292- _callbacks->applyTempRadioParams (freq, bw, sf, cr, temp_timeout_mins);
293- sprintf (reply, " OK - temp params for %d mins" , temp_timeout_mins);
294- } else {
295- _prefs->sf = sf;
296- _prefs->cr = cr;
297- _prefs->freq = freq;
298- _prefs->bw = bw;
299- _callbacks->savePrefs ();
300- strcpy (reply, " OK - reboot to apply" );
301- }
305+ _prefs->sf = sf;
306+ _prefs->cr = cr;
307+ _prefs->freq = freq;
308+ _prefs->bw = bw;
309+ _callbacks->savePrefs ();
310+ strcpy (reply, " OK - reboot to apply" );
302311 } else {
303312 strcpy (reply, " Error, invalid radio params" );
304313 }
0 commit comments