将BLE、WIFI的信息采用FLASH存储
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#if (CONFIG_PRODUCT_ID_SERTRF)
|
#if (CONFIG_PRODUCT_ID_SERTRF)
|
||||||
|
|
||||||
#define _DEFAULT_DEVICE_NAME_BLE "SpeedyBee SERTRF-BLE"
|
#define _DEFAULT_DEVICE_NAME_BLE "Sertorf"
|
||||||
#define _DEFAULT_DEVICE_NAME_WIFI "SpeedyBee SERTRF-WIF"
|
#define _DEFAULT_DEVICE_NAME_WIFI "Sertorf"
|
||||||
#define _DEFAULT_DRONE_DATA "MODE1_1.0"
|
#define _DEFAULT_DRONE_DATA "MODE1_1.0"
|
||||||
|
|
||||||
static cfg_app_t const s_cfg_app_default = {
|
static cfg_app_t const s_cfg_app_default = {
|
||||||
@@ -31,11 +31,11 @@ static cfg_app_t const s_cfg_app_default = {
|
|||||||
.uartBaudRate = 115200, // 串口透传波特率
|
.uartBaudRate = 115200, // 串口透传波特率
|
||||||
},
|
},
|
||||||
|
|
||||||
.wifi_ap_ipv4 = {192, 168, 1, 1}, // WIFI AP 模式下的 IP 地址
|
.wifi_ap_ipv4 = {192, 168, 1, 1}, // WIFI AP 模式下的 IP 地址
|
||||||
.app_config_wifi_para.wifi_ap_ssid = _DEFAULT_DEVICE_NAME_WIFI, // WIFI AP 模式下的 SSID
|
.app_config_wifi_para.wifi_ap_ssid = _DEFAULT_DEVICE_NAME_WIFI, // WIFI AP 模式下的 SSID
|
||||||
.app_config_wifi_para.wifi_ap_password = "", // WIFI AP 模式下的 密码
|
.app_config_wifi_para.wifi_ap_password = "", // WIFI AP 模式下的 密码
|
||||||
.app_config_wifi_para.wifi_sta_ssid = "eFLY", // WIFI STA 模式下的 SSID
|
.app_config_wifi_para.wifi_sta_ssid = _DEFAULT_DEVICE_NAME_WIFI, // WIFI STA 模式下的 SSID
|
||||||
.app_config_wifi_para.wifi_sta_password = "88888888", // WIFI STA 模式下的 密码
|
.app_config_wifi_para.wifi_sta_password = "88888888", // WIFI STA 模式下的 密码
|
||||||
|
|
||||||
.udp_port_passthrough_broadcast = 14550, // udp 透传端口(广播端口) TODO
|
.udp_port_passthrough_broadcast = 14550, // udp 透传端口(广播端口) TODO
|
||||||
.udp_port_command = 14551, // udp 命令端口(本地端口)
|
.udp_port_command = 14551, // udp 命令端口(本地端口)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ static void _sb_manufacturer_encode(uint8_t manufacturer_data[20])
|
|||||||
uint8_t ble_init(init_device_t *port)
|
uint8_t ble_init(init_device_t *port)
|
||||||
{
|
{
|
||||||
ble_server_init_t ble_init_param = {
|
ble_server_init_t ble_init_param = {
|
||||||
.device_name = "Sertorf", // 设备名
|
.device_name = g_cfg_app->device_name_ble, // 设备名
|
||||||
.manufacturer_data = _sb_manufacturer_encode, // 回调函数,生成 manufacturer[20] 设置厂商数据
|
.manufacturer_data = _sb_manufacturer_encode, // 回调函数,生成 manufacturer[20] 设置厂商数据
|
||||||
.connect_cb = ble_server_connect_handler, // 回调函数, NULL 值可用
|
.connect_cb = ble_server_connect_handler, // 回调函数, NULL 值可用
|
||||||
};
|
};
|
||||||
@@ -198,25 +198,30 @@ uint8_t wifi_init(init_device_t *port)
|
|||||||
/* 初始化 WIFI */
|
/* 初始化 WIFI */
|
||||||
wifi_init_t init_struct = {
|
wifi_init_t init_struct = {
|
||||||
.ap = {
|
.ap = {
|
||||||
.ssid = "Sertorf", /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
|
.ssid = {0},
|
||||||
.password = "", /**< Password of soft-AP. */
|
.password = {0}, /**< Password of soft-AP. */
|
||||||
.ip_v4 = {192, 168, 1, 1},
|
.ip_v4 = {0},
|
||||||
.gw_v4 = {192, 168, 1, 1},
|
.gw_v4 = {0},
|
||||||
.mask_v4 = {255, 255, 255, 0},
|
.mask_v4 = {255, 255, 255, 0},
|
||||||
.max_connection = 1,
|
.max_connection = 1,
|
||||||
.connect_cb = wifi_ap_connect_handler,
|
.connect_cb = wifi_ap_connect_handler,
|
||||||
},
|
},
|
||||||
.sta = {
|
.sta = {
|
||||||
#if 0
|
.ssid = {0},
|
||||||
.ssid = "KFXJ",
|
.password = {0},
|
||||||
.password = "Kfdx201*",
|
|
||||||
#else
|
|
||||||
.ssid = "Sertorf_sta",
|
|
||||||
.password = "12345678",
|
|
||||||
#endif
|
|
||||||
.connect_cb = wifi_sta_connect_handler,
|
.connect_cb = wifi_sta_connect_handler,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
//设置wifi参数
|
||||||
|
memcpy(&init_struct.ap.ssid, g_cfg_app->app_config_wifi_para.wifi_ap_ssid, 32);
|
||||||
|
memcpy(&init_struct.ap.password, g_cfg_app->app_config_wifi_para.wifi_ap_password, 64);
|
||||||
|
memcpy(&init_struct.ap.ip_v4, g_cfg_app->wifi_ap_ipv4, 4);
|
||||||
|
memcpy(&init_struct.ap.gw_v4, g_cfg_app->wifi_ap_ipv4, 4);
|
||||||
|
|
||||||
|
memcpy(&init_struct.sta.ssid, g_cfg_app->app_config_wifi_para.wifi_sta_ssid, 32);
|
||||||
|
memcpy(&init_struct.sta.password, g_cfg_app->app_config_wifi_para.wifi_sta_password, 64);
|
||||||
|
|
||||||
|
|
||||||
wifi_netif_init(&init_struct);
|
wifi_netif_init(&init_struct);
|
||||||
|
|
||||||
wifi_set_mode(WIFI_NETIF_MODE_AP);
|
wifi_set_mode(WIFI_NETIF_MODE_AP);
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "../data_port/socket_inet/socket_inet_server_shell.h"
|
#include "../data_port/socket_inet/socket_inet_server_shell.h"
|
||||||
#include "../data_port/socket_inet/wifi.h"
|
#include "../data_port/socket_inet/wifi.h"
|
||||||
#include "../data_port/socket_inet/socket_inet.h"
|
#include "../data_port/socket_inet/socket_inet.h"
|
||||||
|
#include "../../config/app_config.h"
|
||||||
|
#include "../../config/board_config.h"
|
||||||
#include "sys_log.h"
|
#include "sys_log.h"
|
||||||
|
|
||||||
#define PRODUCT0 0x24
|
#define PRODUCT0 0x24
|
||||||
|
|||||||
Reference in New Issue
Block a user