更新配置代码

This commit is contained in:
LokLiang
2025-04-10 10:57:28 +08:00
parent 59ca87af0d
commit 133181c542
10 changed files with 364 additions and 37 deletions

View File

@@ -100,7 +100,13 @@ typedef struct // 设备配置统一数据结构
bool ble : 1; // 使用 BLE
bool ap : 1; // 使用 WIFI AP 模式
bool sta : 1; // 使用 WIFI STA 模式
uint32_t reserve : 24;
bool strip_pwrup : 1; // 使用灯带上电效果
bool strip_show_rf : 1; // 在灯带中用一个灯来显示射频数据接口状态的灯效图层
bool strip_link_fc : 1; // 开启灯带联动飞控用于飞控状态监控MSP
bool bat_led_startup : 1; // 开启电量灯效
uint32_t reserve : 21; // 预留占位(原来是24个uint32)
} capacity;
struct
@@ -114,9 +120,18 @@ typedef struct // 设备配置统一数据结构
uint8_t mac_index; // 记录当前通过 WIFI 连接过的 APP 的 MAC 地址的序号
uint8_t mac_tab[6][6]; // 记录当前通过 WIFI 连接过的 APP 的 MAC 地址, 6 个 MAC 地址,每个 MAC 地址 6 字节,判断是否 APP 设备连接,用于决定是否停止对飞控状态监测
uint8_t product_id[6]; // 产品 ID
uint32_t reserve[32]; // 预留占位,下次更改时保证参数总长度不变,如超过预留长度后则当作新数据处理
uint8_t gyro_heat_value; // 陀螺仪加热值,单位温度,0为关闭,最大值为80℃
struct
{
bool temp_log_on : 1; // 温度日志开关
uint8_t temp_log_index : 5; // 温度日志最新索引
} temperature_log;
uint32_t reserve[37]; // 预留占位,下次更改时保证参数总长度不变,如超过预留长度后则当作新数据处理,sizeof(cfg_app_t) = 484UL
uint32_t crc32; // 校验数据(可放于任何位置)
} cfg_app_t;
@@ -140,6 +155,8 @@ extern const int *g_sys_log_on;
void app_cfg_set_sys_log(bool on);
void app_cfg_set_rf_mode_change(void); // 设置 g_cfg_app->rf_mode 的下一个模式
int app_cfg_set_rf_mode(data_bridge_rf_mode_t rf_mode);
int app_cfg_set_psPassword(const void *psPassword, int size);
int app_cfg_set_device_name_ble(const void *device_name_ble, int size);
int app_cfg_set_drone_data(const void *drone_data, int size);
@@ -157,5 +174,14 @@ int app_cfg_set_led_strip_sw(uint8_t sw);
int app_cfg_set_armed2close_rf_sw(bool sw);
int app_cfg_set_rf_parameters(const void *wifi_parameters, size_t size);
int app_cfg_set_wifi_ap_ssid(const void *ssid);
int app_cfg_set_wifi_ap_password(const void *password);
int app_cfg_set_wifi_sta_ssid(const void *ssid);
int app_cfg_set_wifi_sta_password(const void *password);
int app_cfg_set_mac_tab(uint8_t mac[6]);
int app_cfg_set_temp_log_on(bool sw);
int app_cfg_set_temp_log_index(uint8_t index);
int app_cfg_set_gyro_heat_value(uint8_t value);