When the definition of the s_lorawan_settings structure was in the project files (main.h before WisBlock API), I could modify it to achieve a different default configuration when the flash is reset. I mean the first time a previous configuration file doesn't exist in flash, or a reboot with the ATR command is performed.
I think it is convenient to allow modifications on these default settings according to the project requirements. To mention two scenarios:
When flashing firmware for several devices, I would like to modify only the LoRaWAN credentials and use a new default configuration to preset the send_repeat_time, the lora_region, or any other parameter. Otherwise, I always need to use the AT commands or the App to change those values.
Sometimes, a network server requires a different subband selection. For instance, subband 2 is the one used/recommended in TTN or Helium for several regions. Currently, there's no AT command to change this, and the only option is in the App.
Since the api_set_credentials() is intended for hardcoding the parameters and ignores any other interaction from flash I didn't consider it suitable for this purpose. However, my suggestion is based on a similar approach that I called api_enable_default_settings_modifications().
Example:
void setup_app(void)
{
g_enable_ble = true;
// Optional default settings modifications
g_default_settings_modified.lora_region = 8; // US915 region
g_default_settings_modified.subband_channels = 2; // Subband 2
g_default_settings_modified.send_repeat_time = 300000; // 5 minutes
// Inform API modifications in the default_settings
api_enable_default_settings_modifications();
}
When the definition of the
s_lorawan_settings
structure was in the project files (main.h before WisBlock API), I could modify it to achieve a different default configuration when the flash is reset. I mean the first time a previous configuration file doesn't exist in flash, or a reboot with the ATR command is performed.I think it is convenient to allow modifications on these default settings according to the project requirements. To mention two scenarios:
When flashing firmware for several devices, I would like to modify only the LoRaWAN credentials and use a new default configuration to preset the send_repeat_time, the lora_region, or any other parameter. Otherwise, I always need to use the AT commands or the App to change those values.
Sometimes, a network server requires a different subband selection. For instance, subband 2 is the one used/recommended in TTN or Helium for several regions. Currently, there's no AT command to change this, and the only option is in the App.
Since the
api_set_credentials()
is intended for hardcoding the parameters and ignores any other interaction from flash I didn't consider it suitable for this purpose. However, my suggestion is based on a similar approach that I calledapi_enable_default_settings_modifications()
.Example: