@ -92,7 +92,8 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
file . read ( ( uint8_t * ) & _prefs - > flood_max_unscoped , sizeof ( _prefs - > flood_max_unscoped ) ) ; // 291
file . read ( ( uint8_t * ) & _prefs - > flood_max_unscoped , sizeof ( _prefs - > flood_max_unscoped ) ) ; // 291
file . read ( ( uint8_t * ) & _prefs - > flood_max_advert , sizeof ( _prefs - > flood_max_advert ) ) ; // 292
file . read ( ( uint8_t * ) & _prefs - > flood_max_advert , sizeof ( _prefs - > flood_max_advert ) ) ; // 292
file . read ( ( uint8_t * ) & _prefs - > radio_fem_rxgain , sizeof ( _prefs - > radio_fem_rxgain ) ) ; // 293
file . read ( ( uint8_t * ) & _prefs - > radio_fem_rxgain , sizeof ( _prefs - > radio_fem_rxgain ) ) ; // 293
// next: 294
file . read ( ( uint8_t * ) & _prefs - > cad_enabled , sizeof ( _prefs - > cad_enabled ) ) ; // 294
// next: 295
// sanitise bad pref values
// sanitise bad pref values
_prefs - > rx_delay_base = constrain ( _prefs - > rx_delay_base , 0 , 20.0f ) ;
_prefs - > rx_delay_base = constrain ( _prefs - > rx_delay_base , 0 , 20.0f ) ;
@ -123,6 +124,7 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
// sanitise settings
// sanitise settings
_prefs - > rx_boosted_gain = constrain ( _prefs - > rx_boosted_gain , 0 , 1 ) ; // boolean
_prefs - > rx_boosted_gain = constrain ( _prefs - > rx_boosted_gain , 0 , 1 ) ; // boolean
_prefs - > radio_fem_rxgain = constrain ( _prefs - > radio_fem_rxgain , 0 , 1 ) ; // boolean
_prefs - > radio_fem_rxgain = constrain ( _prefs - > radio_fem_rxgain , 0 , 1 ) ; // boolean
_prefs - > cad_enabled = constrain ( _prefs - > cad_enabled , 0 , 1 ) ; // boolean
file . close ( ) ;
file . close ( ) ;
}
}
@ -187,7 +189,8 @@ void CommonCLI::savePrefs(FILESYSTEM* fs) {
file . write ( ( uint8_t * ) & _prefs - > flood_max_unscoped , sizeof ( _prefs - > flood_max_unscoped ) ) ; // 291
file . write ( ( uint8_t * ) & _prefs - > flood_max_unscoped , sizeof ( _prefs - > flood_max_unscoped ) ) ; // 291
file . write ( ( uint8_t * ) & _prefs - > flood_max_advert , sizeof ( _prefs - > flood_max_advert ) ) ; // 292
file . write ( ( uint8_t * ) & _prefs - > flood_max_advert , sizeof ( _prefs - > flood_max_advert ) ) ; // 292
file . write ( ( uint8_t * ) & _prefs - > radio_fem_rxgain , sizeof ( _prefs - > radio_fem_rxgain ) ) ; // 293
file . write ( ( uint8_t * ) & _prefs - > radio_fem_rxgain , sizeof ( _prefs - > radio_fem_rxgain ) ) ; // 293
// next: 294
file . write ( ( uint8_t * ) & _prefs - > cad_enabled , sizeof ( _prefs - > cad_enabled ) ) ; // 294
// next: 295
file . close ( ) ;
file . close ( ) ;
}
}
@ -503,6 +506,10 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
_prefs - > interference_threshold = atoi ( & config [ 11 ] ) ;
_prefs - > interference_threshold = atoi ( & config [ 11 ] ) ;
savePrefs ( ) ;
savePrefs ( ) ;
strcpy ( reply , " OK " ) ;
strcpy ( reply , " OK " ) ;
} else if ( memcmp ( config , " cad " , 4 ) = = 0 ) {
_prefs - > cad_enabled = memcmp ( & config [ 4 ] , " on " , 2 ) = = 0 ;
savePrefs ( ) ;
strcpy ( reply , " OK " ) ;
} else if ( memcmp ( config , " agc.reset.interval " , 19 ) = = 0 ) {
} else if ( memcmp ( config , " agc.reset.interval " , 19 ) = = 0 ) {
_prefs - > agc_reset_interval = atoi ( & config [ 19 ] ) / 4 ;
_prefs - > agc_reset_interval = atoi ( & config [ 19 ] ) / 4 ;
savePrefs ( ) ;
savePrefs ( ) ;
@ -801,6 +808,8 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
sprintf ( reply , " > %s " , StrHelper : : ftoa ( _prefs - > airtime_factor ) ) ;
sprintf ( reply , " > %s " , StrHelper : : ftoa ( _prefs - > airtime_factor ) ) ;
} else if ( memcmp ( config , " int.thresh " , 10 ) = = 0 ) {
} else if ( memcmp ( config , " int.thresh " , 10 ) = = 0 ) {
sprintf ( reply , " > %d " , ( uint32_t ) _prefs - > interference_threshold ) ;
sprintf ( reply , " > %d " , ( uint32_t ) _prefs - > interference_threshold ) ;
} else if ( memcmp ( config , " cad " , 3 ) = = 0 ) {
sprintf ( reply , " > %s " , _prefs - > cad_enabled ? " on " : " off " ) ;
} else if ( memcmp ( config , " agc.reset.interval " , 18 ) = = 0 ) {
} else if ( memcmp ( config , " agc.reset.interval " , 18 ) = = 0 ) {
sprintf ( reply , " > %d " , ( ( uint32_t ) _prefs - > agc_reset_interval ) * 4 ) ;
sprintf ( reply , " > %d " , ( ( uint32_t ) _prefs - > agc_reset_interval ) * 4 ) ;
} else if ( memcmp ( config , " multi.acks " , 10 ) = = 0 ) {
} else if ( memcmp ( config , " multi.acks " , 10 ) = = 0 ) {