更新配置代码
This commit is contained in:
@@ -37,8 +37,7 @@ const int *g_sys_log_on = &s_cfg_app.sys_log_on;
|
||||
static os_work_t s_work_hdl_save;
|
||||
|
||||
/* 默认的程序设置代码文件 */
|
||||
#include "app_config/developing.h"
|
||||
#include "app_config/SBDEMO.h"
|
||||
#include "app_config/_default_config.h"
|
||||
|
||||
/* nvs 接口 ------------------------------------------------------------------------------------ */
|
||||
|
||||
@@ -258,6 +257,18 @@ void app_cfg_set_rf_mode_change(void)
|
||||
app_cfg_do_save(1000);
|
||||
}
|
||||
|
||||
int app_cfg_set_rf_mode(data_bridge_rf_mode_t rf_mode)
|
||||
{
|
||||
if (rf_mode >= DATA_BRIDGE_RF_MODE_MAX)
|
||||
{
|
||||
SYS_LOG_WRN("rf_mode: %d", rf_mode);
|
||||
return -1;
|
||||
}
|
||||
s_cfg_app.rf_mode = rf_mode;
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_psPassword(const void *psPassword, int size)
|
||||
{
|
||||
if (size > sizeof(s_cfg_app.psPassword))
|
||||
@@ -355,6 +366,75 @@ int app_cfg_set_rf_parameters(const void *wifi_parameters, size_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_wifi_ap_ssid(const void *ssid)
|
||||
{
|
||||
if (ssid == NULL)
|
||||
{
|
||||
SYS_LOG_WRN("ssid is empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(ssid) >= __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_ssid))
|
||||
{
|
||||
SYS_LOG_WRN("size: %u > %u", strlen(ssid), __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_ssid));
|
||||
return -1;
|
||||
}
|
||||
strncpy(s_cfg_app.app_config_wifi_para.wifi_ap_ssid, ssid, __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_ssid));
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
int app_cfg_set_wifi_ap_password(const void *password)
|
||||
{
|
||||
if (password == NULL)
|
||||
{
|
||||
SYS_LOG_WRN("password is empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(password) >= __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_password))
|
||||
{
|
||||
SYS_LOG_WRN("size: %u > %u", strlen(password), __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_password));
|
||||
return -1;
|
||||
}
|
||||
strncpy(s_cfg_app.app_config_wifi_para.wifi_ap_password, password, __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_ap_password));
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
int app_cfg_set_wifi_sta_ssid(const void *ssid)
|
||||
{
|
||||
if (ssid == NULL)
|
||||
{
|
||||
SYS_LOG_WRN("ssid is empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(ssid) >= __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_ssid))
|
||||
{
|
||||
SYS_LOG_WRN("size: %u > %u", strlen(ssid), __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_ssid));
|
||||
return -1;
|
||||
}
|
||||
strncpy(s_cfg_app.app_config_wifi_para.wifi_sta_ssid, ssid, __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_ssid));
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
int app_cfg_set_wifi_sta_password(const void *password)
|
||||
{
|
||||
if (password == NULL)
|
||||
{
|
||||
SYS_LOG_WRN("password is empty");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(password) >= __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_password))
|
||||
{
|
||||
SYS_LOG_WRN("size: %u > %u", strlen(password), __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_password));
|
||||
return -1;
|
||||
}
|
||||
strncpy(s_cfg_app.app_config_wifi_para.wifi_sta_password, password, __ARRAY_SIZE(s_cfg_app.app_config_wifi_para.wifi_sta_password));
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_drone_data(const void *drone_data, int size)
|
||||
{
|
||||
if (size > sizeof(s_cfg_app.drone_data))
|
||||
@@ -445,3 +525,30 @@ int app_cfg_set_mac_tab(uint8_t mac[6])
|
||||
app_cfg_do_save(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_temp_log_on(bool sw)
|
||||
{
|
||||
// SYS_LOG_INF("set temp log on: %d", sw);
|
||||
s_cfg_app.temperature_log.temp_log_on = !!sw;
|
||||
app_cfg_do_save(100);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_temp_log_index(uint8_t index)
|
||||
{
|
||||
// SYS_LOG_INF("set temp log index: %d", index);
|
||||
s_cfg_app.temperature_log.temp_log_index = index;
|
||||
app_cfg_do_save(100);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_cfg_set_gyro_heat_value(uint8_t value)
|
||||
{
|
||||
if (value > 60)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
s_cfg_app.gyro_heat_value = value;
|
||||
app_cfg_do_save(100);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user