新增静态库及配置

This commit is contained in:
LokLiang
2025-07-09 15:41:50 +08:00
parent ea4f688ba0
commit 1e82069ac7
14 changed files with 1799 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
list(APPEND incs ".") list(APPEND incs ".")
list(APPEND incs "../components/lib")
list(APPEND incs "../components/system/include") list(APPEND incs "../components/system/include")
list(APPEND incs "../components/system/source") list(APPEND incs "../components/system/source")
list(APPEND incs "../components/system/source/k_kit") list(APPEND incs "../components/system/source/k_kit")
@@ -6,7 +7,6 @@ list(APPEND incs "../components/system/source/shell")
list(APPEND incs "drivers/data_port/usb-host") list(APPEND incs "drivers/data_port/usb-host")
list(APPEND incs "drivers/data_port/ble_spp") list(APPEND incs "drivers/data_port/ble_spp")
list(APPEND incs "drivers/data_port/socket_inet") list(APPEND incs "drivers/data_port/socket_inet")
list(APPEND incs "lib-out")
@@ -22,7 +22,9 @@ list(APPEND srcs "button/button.c")
list(APPEND srcs "button/multi_button.c") list(APPEND srcs "button/multi_button.c")
list(APPEND srcs "config/board_config.c") list(APPEND srcs "config/board_config.c")
list(APPEND srcs "config/app_config.c") list(APPEND srcs "config/app_config.c")
list(APPEND srcs "config/app_log.c")
list(APPEND srcs "utils/crc.c") list(APPEND srcs "utils/crc.c")
list(APPEND srcs "utils/sb_aes.c")
if(CONFIG_BUILD_BLE) if(CONFIG_BUILD_BLE)
list(APPEND srcs "drivers/data_port/ble_spp/ble_spp_server.c") list(APPEND srcs "drivers/data_port/ble_spp/ble_spp_server.c")

View File

@@ -6,13 +6,16 @@
#include <string.h> #include <string.h>
/* 配置 */ /* 配置 */
#include "ota.h"
#include "config/board_config.h" #include "config/board_config.h"
#include "config/app_config.h" #include "config/app_config.h"
#include "config/app_log.h"
/* SDK */ /* SDK */
#include "esp_err.h" #include "esp_err.h"
#include "hal/spi_types.h" #include "hal/spi_types.h"
#include "spbelib_interface.h"
#include "lib_shell.h"
#include "ota.h"
/* 驱动 */ /* 驱动 */
#include "drivers/ws2812_spi/ws2812_spi.h" #include "drivers/ws2812_spi/ws2812_spi.h"
@@ -37,7 +40,6 @@ nvs_handle g_nvs_hdl; // nvs 句柄
os_work_q_t g_work_q_hdl_low; // 低于 default_os_work_q_hdl 优先级的工作队列 os_work_q_t g_work_q_hdl_low; // 低于 default_os_work_q_hdl 优先级的工作队列
static void _init_nvs(void); static void _init_nvs(void);
static void _init_work_q(void);
static void _init_ws2812(void); static void _init_ws2812(void);
static void _change_mode_event_button(button_hdl_t *handle, press_event_t event); static void _change_mode_event_button(button_hdl_t *handle, press_event_t event);
static void _vset_cb(sh_t *sh_hdl); static void _vset_cb(sh_t *sh_hdl);
@@ -50,20 +52,22 @@ void work_app_main(void *arg)
/* 初始化配置 */ /* 初始化配置 */
board_cfg_init(); // 板级配置 board_cfg_init(); // 板级配置
app_cfg_init(); // 应用配置 app_cfg_init(); // 应用配置
app_log_init(); // 应用记录
/* 初始化 OTA 功能*/ /* 初始化 OTA 功能*/
ota_partition_check(); ota_partition_check();
/* 初始化其他优先级的工作队列 */
_init_work_q();
/* 初始化按键检测和控制 */
btn_attach(&g_cfg_board->key_reset, _change_mode_event_button, EVENT_PRESS_UP | EVENT_PRESS_DOWN | EVENT_LONG_PRESS_HOLD);
/* 初始化 ws2812 */ /* 初始化 ws2812 */
_init_ws2812(); _init_ws2812();
ws2812_spi_shell_register(); // 用于测试 ws2812 的 shell 命令 ws2812_spi_shell_register(); // 用于测试 ws2812 的 shell 命令
/* 启动静态库功能 */
sblib_init(SBLIB_INIT_ADAPTER);
lib_shell_register(); // 静态库接口命令
/* 初始化按键检测和控制 */
btn_attach(&g_cfg_board->key_reset, _change_mode_event_button, EVENT_PRESS_UP | EVENT_PRESS_DOWN | EVENT_LONG_PRESS_HOLD);
/* 启动 shell */ /* 启动 shell */
os_thread_sleep(100); os_thread_sleep(100);
shell_start(_vset_cb); shell_start(_vset_cb);
@@ -79,15 +83,6 @@ static void _init_nvs(void)
} }
} }
static void _init_work_q(void)
{
/* 不使用以节省内存 */
// os_work_q_create(&g_work_q_hdl_low,
// "app-work_q-low",
// 0x2000,
// OS_PRIORITY_LOW);
}
static void _init_ws2812(void) static void _init_ws2812(void)
{ {
#if (CONFIG_LED_STRIP_MAX_LEDS) #if (CONFIG_LED_STRIP_MAX_LEDS)
@@ -113,3 +108,36 @@ static void _change_mode_event_button(button_hdl_t *handle, press_event_t event)
SYS_LOG_DBG("button stat: %s", stat_tab[event]); SYS_LOG_DBG("button stat: %s", stat_tab[event]);
} }
} }
// 导出符号,供 linker script 使用
#include "utils/sb_aes.h"
#include "drivers/data_port/sb_data_port.h"
#include "drivers/data_port/uart/uart_port.h"
#if defined(CONFIG_BUILD_BLE)
#include "drivers/data_port/ble_spp/ble_spp_server.h"
#endif
#if defined(CONFIG_BUILD_WIFI)
#include "drivers/data_port/socket_inet/socket_inet.h"
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#include "drivers/data_port/usb-host/usbport.h"
#endif
void _exporter_reference_symbols(void)
{
btn_attach(NULL, NULL, 0);
sb_aes_init();
sb_data_port_start(NULL);
sb_uart_port_init();
sh_init_vt100(NULL, NULL, NULL);
shell_start(NULL);
ws2812_spi_led_strip_init(0, 0);
#if defined(CONFIG_BUILD_BLE)
sb_ble_server_port_init(NULL);
#endif
#if defined(CONFIG_BUILD_WIFI)
socket_inet_init();
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3)
usbport_init();
#endif
}

View File

@@ -54,7 +54,7 @@ static cfg_app_t const s_cfg_app_default = {
.strip_pwrup = 0, // 使用灯带上电效果 .strip_pwrup = 0, // 使用灯带上电效果
.strip_show_rf = 0, // 在灯带中用一个灯来显示射频数据接口状态的灯效图层 .strip_show_rf = 0, // 在灯带中用一个灯来显示射频数据接口状态的灯效图层
.strip_link_fc = 0, // 开启灯带联动飞控 .strip_link_fc = 0, // 开启灯带联动飞控
.ws2812_bat_led_mode = 1, // 电量灯效, 0: 关闭, 1: 普通飞控, 2: 竞速飞控, 3: 固定翼飞控 .ws2812_bat_led_mode = 0, // 电量灯效, 0: 关闭, 1: 普通飞控, 2: 竞速飞控, 3: 固定翼飞控
}, },
.ws2812_bat_led_direction = 0, // 0: 正向1: 反向(正反向是指灯珠的连接方式,正向是指从第一个灯珠开始,反向是指从最后一个灯珠开始) .ws2812_bat_led_direction = 0, // 0: 正向1: 反向(正反向是指灯珠的连接方式,正向是指从第一个灯珠开始,反向是指从最后一个灯珠开始)
.ws2812_bat_led_color = 0xFFFFFF, // 电量灯颜色, RGB颜色值,如 0xFFFFFF 代表白色(默认) .ws2812_bat_led_color = 0xFFFFFF, // 电量灯颜色, RGB颜色值,如 0xFFFFFF 代表白色(默认)

276
app/config/app_log.c Normal file
View File

@@ -0,0 +1,276 @@
/**
* @file app_log.c
* @author LokLiang
* @brief app_log.h 模块源码
* @version 0.1
* @date 2023-11-242
*
* @copyright Copyright (c) 2023
*
*/
#include "app_log.h"
#include "nvs.h"
#include "utils/crc.h"
#include "os/os.h"
#undef CONFIG_SYS_LOG_LEVEL
#define CONFIG_SYS_LOG_LEVEL SYS_LOG_LEVEL_INF
#define SYS_LOG_DOMAIN "APLOG"
#define CONS_ABORT()
#include "sys_log.h"
#define _NVS_KEY_MAIN "log-main"
/* 数据区 -------------------------------------------------------------------------------------- */
extern nvs_handle g_nvs_hdl;
static struct
{
os_time_t flight_time_start;
} s_cm;
/* nvs 接口 ------------------------------------------------------------------------------------ */
static int _read_key(const char *key, void *out_value, size_t tar_length, uint32_t *crc_base);
static int _set_crc(const void *struct_base, size_t struct_length, uint32_t *crc_base);
static int _do_factory_set(log_app_t *log);
/**
* @brief 读取指定的数据,并按给出的特性进行校验,返回校验结果
*
* @param key 在 nvs 的存储块的键值
* @param out_value[out] 输出内存
* @param tar_length 输出的内存预期的长度
* @param crc_base[io] CRC 校验值所在内存块的地址(绝对值)。输入:校验值,输出:新的正确校验值
* @retval 0 正确读取了已存储数据
* @retval 1 nvs 模块可用, CRC 校验值已更新
* @retval -1 nvs 模块不可用
*/
static int _read_key(const char *key, void *out_value, size_t tar_length, uint32_t *crc_base)
{
size_t required_size = 0;
esp_err_t err = ESP_OK;
/* 在确认已存储的数据长度前,仅获取长度以免数据溢出 */
err = nvs_get_blob(g_nvs_hdl, key, NULL, &required_size);
if (err != ESP_OK)
{
SYS_LOG_WRN("failed to read prfsdata data length, err:%d", err);
return -1;
}
if (required_size != tar_length)
{
SYS_LOG_WRN("invalid prfsdata length, length:%d, err:%d", required_size, err);
return -1;
}
/* 读出已存储的数据 */
err = nvs_get_blob(g_nvs_hdl, key, out_value, &required_size);
if (err != ESP_OK)
{
SYS_LOG_ERR("failed to read prfsdata data, err:%d", err);
return -1;
}
/* 设置并校验 CRC */
if (_set_crc(out_value, tar_length, crc_base))
{
SYS_LOG_WRN("read frs failed, incorrect crc and update");
return 1;
}
return 0;
}
/**
* @brief 校验并更新结构体中 CRC 的值。
* 这将校验整个结构(包含 CRC 本身),因此 CRC 自身的初始值为 0然后更新 CRC 的结果到结构中
*
* @param struct_base 待分析和设置的内存块
* @param struct_length 待分析和设置的内存块的实际长度
* @param crc_base[io] CRC 校验值所在内存块的地址(绝对值)
* @retval 0 校验正确
* @retval 1 校验错误,并且设置了正确的校验值
*/
static int _set_crc(const void *struct_base, size_t struct_length, uint32_t *crc_base)
{
// 校验读出来的数据的正确性
uint32_t crc_read = *crc_base;
*crc_base = 0;
*crc_base = crc32_calc(0, struct_base, struct_length);
return (crc_read != *crc_base);
}
static int _do_factory_set(log_app_t *log)
{
memset(log, 0, sizeof(*log));
log->flight_data.crc16 = crc16_calc(NULL, 0);
return app_log_do_save(log);
}
/**
* @brief 初始化
*/
void app_log_init(void)
{
SYS_ASSERT(g_nvs_hdl != 0, "");
}
/**
* @brief 使内存的数据恢复到默认设置
*
* @retval 0 操作成功
* @retval -1 操作失败
*/
int app_log_factory_set(void)
{
log_app_t *log = os_malloc(sizeof(log_app_t));
if (log == NULL)
{
SYS_LOG_WRN("malloc fail");
return -1;
}
int ret = _do_factory_set(log);
os_free(log);
return ret;
}
/**
* @brief 立即执行保存 配置数据 到 nvs 的动作
*
* @param delay_ms 0: 立即保存, > 0 多少毫秒后执行保存
* @return int @ref esp_err_t
*/
int app_log_do_save(log_app_t *log)
{
log->version = APP_LOG_DATA_VER;
_set_crc(log, sizeof(*log), &log->crc32);
esp_err_t err = nvs_set_blob(g_nvs_hdl, _NVS_KEY_MAIN, log, sizeof(*log));
if (err != ESP_OK)
{
SYS_LOG_WRN("nvs_set_blob() err: %d", err);
}
return err;
}
/* 读接口 -------------------------------------------------------------------------------------- */
/**
* @brief 读取日志信息
* 将从 nvs 读取已保存的数据到内存 log_app_t 中。
* 当出现以下情况时,配置数据被恢复到默认值:
* nvs 未初始化或操作失败;
* 使用 app_log_factory_set() 立即恢复到默认值;
* 结构体的长度 log_app_t 发生改变;
* APP_CONFIG_DATA_VER 定义的值发生改变;
*
* @param out_log[out] 用于保存日志信息的内存
* @retval 0 成功读取已有记录
* @retval 1 已恢复默认设置
* @retval -1 nvs 操作失败
*/
int app_log_read(log_app_t *out_log)
{
int ret = _read_key(_NVS_KEY_MAIN, out_log, sizeof(*out_log), &out_log->crc32);
if (ret)
{
goto use_default_prfs;
}
if (out_log->version != APP_LOG_DATA_VER)
{
ret = 1;
SYS_LOG_WRN("Upgrade to the latest version: %u ==> %u", out_log->version, APP_LOG_DATA_VER);
goto use_default_prfs;
}
return ret;
use_default_prfs:
_do_factory_set(out_log);
return ret;
}
/* 写接口 -------------------------------------------------------------------------------------- */
/**
* @brief 开始计时
*
*/
void app_log_flight_time_start(void)
{
log_app_t *log = os_malloc(sizeof(log_app_t));
if (log == NULL)
{
SYS_LOG_WRN("malloc fail");
return;
}
if (log->flight_data.flight_number < __ARRAY_SIZE(log->flight_data.datas))
{
s_cm.flight_time_start = os_get_sys_time();
}
else
{
s_cm.flight_time_start = 0;
SYS_LOG_INF("The maximum number of groups: %d", __ARRAY_SIZE(log->flight_data.datas));
}
os_free(log);
}
/**
* @brief 结束计时,并保存这个记录
*
*/
void app_log_flight_time_stop(void)
{
if (s_cm.flight_time_start == 0)
{
SYS_LOG_WRN("never exec app_log_flight_time_start()");
return;
}
log_app_t *log = os_malloc(sizeof(log_app_t));
if (log == NULL)
{
SYS_LOG_WRN("malloc fail");
return;
}
os_time_t time_cost_sec = (os_get_sys_time() - s_cm.flight_time_start) / 1000;
if (time_cost_sec > 10)
{
log->flight_data.datas[log->flight_data.flight_number++] = time_cost_sec;
log->flight_data.crc16 = crc16_calc(log->flight_data.datas, sizeof(log->flight_data.datas[0]) * log->flight_data.flight_number);
app_log_do_save(log);
}
s_cm.flight_time_start = 0;
os_free(log);
}
/**
* @brief 清除全部计时记录
*
*/
void app_log_flight_time_clr(void)
{
log_app_t *log = os_malloc(sizeof(log_app_t));
if (log == NULL)
{
SYS_LOG_WRN("malloc fail");
return;
}
memset(&log->flight_data, 0, sizeof(log->flight_data));
app_log_do_save(log);
os_free(log);
}

74
app/config/app_log.h Normal file
View File

@@ -0,0 +1,74 @@
/**
* @file app_log.h
* @author LokLiang
* @brief 用于应用控制程序的统一配置的数据结构
* @version 0.1
* @date 2023-11-24
*
* @copyright Copyright (c) 2023
*
* 本模块实现功能:
* 1. 统一定义应用程序需要存储的所有数据;
* 2. 依赖 nfs 模块,使当前数据与内部存储的数据实现同步;
* 3. 依赖 sh_vset 模块,并提供其对应的所有设置实现函数;
*
* 对数据的读操作:
* 上层应用:应用和模式管理模块和控制模块
* 对外提 app_log_read() 读取数据
*
* 对数据的写操作:
* 上层应用:
* 为所有成员提供专门的写入接口,内部数据被立即更新。
*
* 数据的默认值:
* 当出现以下情况时,配置数据被恢复到默认值:
* nvs 未初始化或操作失败;
* 使用 app_log_factory_set() 恢复到默认值;
* 结构体的长度 log_app_t 发生改变;
* APP_LOG_DATA_VER 定义的值发生改变(在 app_log.c 内部定义);
*
*/
#pragma once
#include "sys_types.h"
#define APP_LOG_DATA_VER 1 /* 对应 log_app_t::version */
/* 数据结构 ------------------------------------------------------------------------------------ */
typedef struct
{
uint16_t flight_number; // 当前记录的飞行次数
uint16_t crc16; // CRC16
uint16_t datas[2048];
} flight_data_t;
typedef struct // 设备配置统一数据结构
{
uint32_t version; // 配置版本,修改 APP_LOG_DATA_VER 的值后, nvs 已同步的数据被恢复到默认值
flight_data_t flight_data;
uint32_t crc32; // 校验数据(可放于任何位置)
} log_app_t;
/* nvs 接口 ------------------------------------------------------------------------------------ */
void app_log_init(void); // 初始化
int app_log_factory_set(void); // 使内存的数据恢复到默认设置,注意不会被立即保存到 nvs 中
int app_log_do_save(log_app_t *log); // 保存配置数据 到 nvs 的动作
/* 读接口 -------------------------------------------------------------------------------------- */
int app_log_read(log_app_t *out_log);
/* 操作接口 ------------------------------------------------------------------------------------ */
/* 写接口 -------------------------------------------------------------------------------------- */
void app_log_flight_time_start(void);
void app_log_flight_time_stop(void);
void app_log_flight_time_clr(void);

89
app/utils/sb_aes.c Normal file
View File

@@ -0,0 +1,89 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mbedtls/aes.h"
#define RAWDATALEN 16
// uint8_t rawData[RAWDATALEN];
uint8_t aes_iv[16];
// aes key加密和解密要用同样的key
uint8_t aes_key[16] = {0xFE, 0x63, 0x96, 0xF9, 0x5C, 0xEF, 0xB8, 0xF4, 0x07, 0x05, 0xD1, 0xB6, 0xEB, 0xAB, 0xEA, 0x07};
uint8_t aes_iv_original[16] = {0x3D, 0x27, 0x4E, 0x83, 0x43, 0x5D, 0x30, 0xEC, 0x62, 0xEB, 0x90, 0x3A, 0xAC, 0x60, 0x12, 0xF5};
mbedtls_aes_context aes;
void sb_aes_init()
{
// 初始化aes上下文
mbedtls_aes_init(&aes);
}
void reset_iv()
{
// 该函数用于每次加密、解密前重置iv值iv值的内容是随意定的只要起到不是随便就能猜中的IV值即可。
// 加、解密所用的iv值必须相同。此处把iv值设置为0~15
memcpy(aes_iv, aes_iv_original, 16);
}
int sb_aes_encrypt(uint8_t *crypt_data, int crypt_len, uint8_t *output_data)
{
int ret;
// 设置加密的key
mbedtls_aes_setkey_enc(&aes, aes_key, 128);
reset_iv(); // 因为调用mbedtls_aes_crypt_cbc后传入的iv值会有变化重置iv值会有变化
ret = mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_ENCRYPT, crypt_len, aes_iv, crypt_data, output_data);
if (ret)
{
return -1;
}
return crypt_len;
}
int sb_aes_decrypt(uint8_t *crypt_data, int crypt_len, uint8_t *output_data)
{
int ret;
// 设置解密的key
mbedtls_aes_setkey_dec(&aes, aes_key, 128);
reset_iv(); // 因为调用mbedtls_aes_crypt_cbc后传入的iv值会有变化重置iv值会有变化
ret = mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_DECRYPT, crypt_len, aes_iv, crypt_data, output_data);
if (ret)
{
return -1;
}
return crypt_len;
}
// void app_main(void)
//{
// uint8_t encData[RAWDATALEN] = { 0 };
// uint8_t decData[RAWDATALEN] = { 0 };
// sb_aes_init(); // 初始化aes上下文
// // 打印原始数据
// printf("rawData:\t");
// for (int i = 0; i < RAWDATALEN; i++) {
// printf("%02x, ", rawData[i]);
// }
// printf("\n");
// // 加密
// int encresult = sb_aes_encrypt(rawData, sizeof(rawData), encData);
// printf("enc data(%d):\t", encresult);
// for (int i = 0; i < RAWDATALEN; i++) {
// printf("%02x, ", encData[i]);
// }
// printf("\n");
// // 解密
// int decresult = sb_aes_decrypt(encData, RAWDATALEN, decData);
// printf("dec data(%d):\t", decresult);
// for (int i = 0; i < RAWDATALEN; i++) {
// printf("%02x, ", decData[i]);
// }
// printf("\n");
//}

14
app/utils/sb_aes.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* DEFINES
****************************************************************************************
*/
void sb_aes_init();
int sb_aes_encrypt(uint8_t *crypt_data, int crypt_len, uint8_t *output_data);
int sb_aes_decrypt(uint8_t *crypt_data, int crypt_len, uint8_t *output_data);

941
app/utils/trigonometric.c Normal file
View File

@@ -0,0 +1,941 @@
#include "trigonometric.h"
static int16_t const s_sin_tab[901];
int16_t sin_s16(int16_t deg)
{
if (deg < 0)
{
deg = 3600 - (-deg % 3600);
}
else
{
deg %= 3600;
}
if (deg <= 900)
{
return s_sin_tab[deg];
}
if (deg <= 1800)
{
return s_sin_tab[1800 - deg];
}
if (deg <= 2700)
{
return -s_sin_tab[deg - 1800];
}
return -s_sin_tab[3600 - deg];
}
int16_t cos_s16(int16_t deg)
{
return sin_s16(deg + 900);
}
static int16_t const s_sin_tab[901] = {
[0] = 0L, // 0.000000,
[1] = 57L, // 0.001745,
[2] = 114L, // 0.003491,
[3] = 171L, // 0.005236,
[4] = 228L, // 0.006981,
[5] = 285L, // 0.008727,
[6] = 343L, // 0.010472,
[7] = 400L, // 0.012217,
[8] = 457L, // 0.013962,
[9] = 514L, // 0.015707,
[10] = 571L, // 0.017452,
[11] = 629L, // 0.019197,
[12] = 686L, // 0.020942,
[13] = 743L, // 0.022687,
[14] = 800L, // 0.024432,
[15] = 857L, // 0.026177,
[16] = 914L, // 0.027922,
[17] = 972L, // 0.029666,
[18] = 1029L, // 0.031411,
[19] = 1086L, // 0.033155,
[20] = 1143L, // 0.034899,
[21] = 1200L, // 0.036644,
[22] = 1257L, // 0.038388,
[23] = 1314L, // 0.040132,
[24] = 1372L, // 0.041876,
[25] = 1429L, // 0.043619,
[26] = 1486L, // 0.045363,
[27] = 1543L, // 0.047106,
[28] = 1600L, // 0.048850,
[29] = 1657L, // 0.050593,
[30] = 1714L, // 0.052336,
[31] = 1772L, // 0.054079,
[32] = 1829L, // 0.055822,
[33] = 1886L, // 0.057564,
[34] = 1943L, // 0.059306,
[35] = 2000L, // 0.061049,
[36] = 2057L, // 0.062791,
[37] = 2114L, // 0.064532,
[38] = 2171L, // 0.066274,
[39] = 2228L, // 0.068015,
[40] = 2285L, // 0.069756,
[41] = 2342L, // 0.071497,
[42] = 2399L, // 0.073238,
[43] = 2456L, // 0.074979,
[44] = 2513L, // 0.076719,
[45] = 2570L, // 0.078459,
[46] = 2627L, // 0.080199,
[47] = 2684L, // 0.081939,
[48] = 2741L, // 0.083678,
[49] = 2798L, // 0.085417,
[50] = 2855L, // 0.087156,
[51] = 2912L, // 0.088894,
[52] = 2969L, // 0.090633,
[53] = 3026L, // 0.092371,
[54] = 3083L, // 0.094108,
[55] = 3140L, // 0.095846,
[56] = 3197L, // 0.097583,
[57] = 3254L, // 0.099320,
[58] = 3311L, // 0.101056,
[59] = 3368L, // 0.102793,
[60] = 3425L, // 0.104528,
[61] = 3481L, // 0.106264,
[62] = 3538L, // 0.107999,
[63] = 3595L, // 0.109734,
[64] = 3652L, // 0.111469,
[65] = 3709L, // 0.113203,
[66] = 3766L, // 0.114937,
[67] = 3822L, // 0.116671,
[68] = 3879L, // 0.118404,
[69] = 3936L, // 0.120137,
[70] = 3993L, // 0.121869,
[71] = 4050L, // 0.123601,
[72] = 4106L, // 0.125333,
[73] = 4163L, // 0.127065,
[74] = 4220L, // 0.128796,
[75] = 4276L, // 0.130526,
[76] = 4333L, // 0.132256,
[77] = 4390L, // 0.133986,
[78] = 4446L, // 0.135716,
[79] = 4503L, // 0.137445,
[80] = 4560L, // 0.139173,
[81] = 4616L, // 0.140901,
[82] = 4673L, // 0.142629,
[83] = 4730L, // 0.144356,
[84] = 4786L, // 0.146083,
[85] = 4843L, // 0.147809,
[86] = 4899L, // 0.149535,
[87] = 4956L, // 0.151261,
[88] = 5012L, // 0.152986,
[89] = 5069L, // 0.154710,
[90] = 5125L, // 0.156434,
[91] = 5182L, // 0.158158,
[92] = 5238L, // 0.159881,
[93] = 5295L, // 0.161604,
[94] = 5351L, // 0.163326,
[95] = 5408L, // 0.165048,
[96] = 5464L, // 0.166769,
[97] = 5520L, // 0.168489,
[98] = 5577L, // 0.170209,
[99] = 5633L, // 0.171929,
[100] = 5689L, // 0.173648,
[101] = 5746L, // 0.175367,
[102] = 5802L, // 0.177085,
[103] = 5858L, // 0.178802,
[104] = 5915L, // 0.180519,
[105] = 5971L, // 0.182236,
[106] = 6027L, // 0.183951,
[107] = 6083L, // 0.185667,
[108] = 6139L, // 0.187381,
[109] = 6196L, // 0.189095,
[110] = 6252L, // 0.190809,
[111] = 6308L, // 0.192522,
[112] = 6364L, // 0.194234,
[113] = 6420L, // 0.195946,
[114] = 6476L, // 0.197657,
[115] = 6532L, // 0.199368,
[116] = 6588L, // 0.201078,
[117] = 6644L, // 0.202787,
[118] = 6700L, // 0.204496,
[119] = 6756L, // 0.206204,
[120] = 6812L, // 0.207912,
[121] = 6868L, // 0.209619,
[122] = 6924L, // 0.211325,
[123] = 6980L, // 0.213030,
[124] = 7036L, // 0.214735,
[125] = 7092L, // 0.216440,
[126] = 7147L, // 0.218143,
[127] = 7203L, // 0.219846,
[128] = 7259L, // 0.221548,
[129] = 7315L, // 0.223250,
[130] = 7370L, // 0.224951,
[131] = 7426L, // 0.226651,
[132] = 7482L, // 0.228351,
[133] = 7538L, // 0.230050,
[134] = 7593L, // 0.231748,
[135] = 7649L, // 0.233445,
[136] = 7704L, // 0.235142,
[137] = 7760L, // 0.236838,
[138] = 7816L, // 0.238533,
[139] = 7871L, // 0.240228,
[140] = 7927L, // 0.241922,
[141] = 7982L, // 0.243615,
[142] = 8037L, // 0.245307,
[143] = 8093L, // 0.246999,
[144] = 8148L, // 0.248690,
[145] = 8204L, // 0.250380,
[146] = 8259L, // 0.252069,
[147] = 8314L, // 0.253758,
[148] = 8370L, // 0.255446,
[149] = 8425L, // 0.257133,
[150] = 8480L, // 0.258819,
[151] = 8535L, // 0.260505,
[152] = 8591L, // 0.262189,
[153] = 8646L, // 0.263873,
[154] = 8701L, // 0.265556,
[155] = 8756L, // 0.267238,
[156] = 8811L, // 0.268920,
[157] = 8866L, // 0.270600,
[158] = 8921L, // 0.272280,
[159] = 8976L, // 0.273959,
[160] = 9031L, // 0.275637,
[161] = 9086L, // 0.277315,
[162] = 9141L, // 0.278991,
[163] = 9196L, // 0.280667,
[164] = 9251L, // 0.282341,
[165] = 9306L, // 0.284015,
[166] = 9361L, // 0.285688,
[167] = 9415L, // 0.287361,
[168] = 9470L, // 0.289032,
[169] = 9525L, // 0.290702,
[170] = 9580L, // 0.292372,
[171] = 9634L, // 0.294040,
[172] = 9689L, // 0.295708,
[173] = 9744L, // 0.297375,
[174] = 9798L, // 0.299041,
[175] = 9853L, // 0.300706,
[176] = 9907L, // 0.302370,
[177] = 9962L, // 0.304033,
[178] = 10016L, // 0.305695,
[179] = 10071L, // 0.307357,
[180] = 10125L, // 0.309017,
[181] = 10179L, // 0.310676,
[182] = 10234L, // 0.312335,
[183] = 10288L, // 0.313992,
[184] = 10342L, // 0.315649,
[185] = 10397L, // 0.317305,
[186] = 10451L, // 0.318959,
[187] = 10505L, // 0.320613,
[188] = 10559L, // 0.322266,
[189] = 10613L, // 0.323917,
[190] = 10667L, // 0.325568,
[191] = 10721L, // 0.327218,
[192] = 10775L, // 0.328867,
[193] = 10829L, // 0.330514,
[194] = 10883L, // 0.332161,
[195] = 10937L, // 0.333807,
[196] = 10991L, // 0.335452,
[197] = 11045L, // 0.337095,
[198] = 11099L, // 0.338738,
[199] = 11153L, // 0.340380,
[200] = 11206L, // 0.342020,
[201] = 11260L, // 0.343660,
[202] = 11314L, // 0.345298,
[203] = 11368L, // 0.346936,
[204] = 11421L, // 0.348572,
[205] = 11475L, // 0.350207,
[206] = 11528L, // 0.351842,
[207] = 11582L, // 0.353475,
[208] = 11635L, // 0.355107,
[209] = 11689L, // 0.356738,
[210] = 11742L, // 0.358368,
[211] = 11796L, // 0.359997,
[212] = 11849L, // 0.361625,
[213] = 11902L, // 0.363251,
[214] = 11955L, // 0.364877,
[215] = 12009L, // 0.366501,
[216] = 12062L, // 0.368125,
[217] = 12115L, // 0.369747,
[218] = 12168L, // 0.371368,
[219] = 12221L, // 0.372988,
[220] = 12274L, // 0.374607,
[221] = 12327L, // 0.376224,
[222] = 12380L, // 0.377841,
[223] = 12433L, // 0.379456,
[224] = 12486L, // 0.381070,
[225] = 12539L, // 0.382683,
[226] = 12592L, // 0.384295,
[227] = 12644L, // 0.385906,
[228] = 12697L, // 0.387516,
[229] = 12750L, // 0.389124,
[230] = 12803L, // 0.390731,
[231] = 12855L, // 0.392337,
[232] = 12908L, // 0.393942,
[233] = 12960L, // 0.395546,
[234] = 13013L, // 0.397148,
[235] = 13065L, // 0.398749,
[236] = 13118L, // 0.400349,
[237] = 13170L, // 0.401948,
[238] = 13222L, // 0.403545,
[239] = 13275L, // 0.405142,
[240] = 13327L, // 0.406737,
[241] = 13379L, // 0.408330,
[242] = 13431L, // 0.409923,
[243] = 13484L, // 0.411514,
[244] = 13536L, // 0.413104,
[245] = 13588L, // 0.414693,
[246] = 13640L, // 0.416281,
[247] = 13692L, // 0.417867,
[248] = 13744L, // 0.419452,
[249] = 13796L, // 0.421036,
[250] = 13847L, // 0.422618,
[251] = 13899L, // 0.424199,
[252] = 13951L, // 0.425779,
[253] = 14003L, // 0.427358,
[254] = 14054L, // 0.428935,
[255] = 14106L, // 0.430511,
[256] = 14158L, // 0.432086,
[257] = 14209L, // 0.433659,
[258] = 14261L, // 0.435231,
[259] = 14312L, // 0.436802,
[260] = 14364L, // 0.438371,
[261] = 14415L, // 0.439939,
[262] = 14466L, // 0.441506,
[263] = 14518L, // 0.443071,
[264] = 14569L, // 0.444635,
[265] = 14620L, // 0.446198,
[266] = 14671L, // 0.447759,
[267] = 14722L, // 0.449319,
[268] = 14773L, // 0.450878,
[269] = 14824L, // 0.452435,
[270] = 14875L, // 0.453990,
[271] = 14926L, // 0.455545,
[272] = 14977L, // 0.457098,
[273] = 15028L, // 0.458650,
[274] = 15079L, // 0.460200,
[275] = 15130L, // 0.461749,
[276] = 15180L, // 0.463296,
[277] = 15231L, // 0.464842,
[278] = 15282L, // 0.466387,
[279] = 15332L, // 0.467930,
[280] = 15383L, // 0.469472,
[281] = 15433L, // 0.471012,
[282] = 15484L, // 0.472551,
[283] = 15534L, // 0.474088,
[284] = 15584L, // 0.475624,
[285] = 15635L, // 0.477159,
[286] = 15685L, // 0.478692,
[287] = 15735L, // 0.480224,
[288] = 15785L, // 0.481754,
[289] = 15835L, // 0.483282,
[290] = 15885L, // 0.484810,
[291] = 15935L, // 0.486335,
[292] = 15985L, // 0.487860,
[293] = 16035L, // 0.489382,
[294] = 16085L, // 0.490904,
[295] = 16135L, // 0.492424,
[296] = 16184L, // 0.493942,
[297] = 16234L, // 0.495459,
[298] = 16284L, // 0.496974,
[299] = 16333L, // 0.498488,
[300] = 16383L, // 0.500000,
[301] = 16433L, // 0.501511,
[302] = 16482L, // 0.503020,
[303] = 16531L, // 0.504528,
[304] = 16581L, // 0.506034,
[305] = 16630L, // 0.507538,
[306] = 16679L, // 0.509041,
[307] = 16728L, // 0.510543,
[308] = 16778L, // 0.512043,
[309] = 16827L, // 0.513541,
[310] = 16876L, // 0.515038,
[311] = 16925L, // 0.516533,
[312] = 16974L, // 0.518027,
[313] = 17023L, // 0.519519,
[314] = 17071L, // 0.521010,
[315] = 17120L, // 0.522499,
[316] = 17169L, // 0.523986,
[317] = 17218L, // 0.525472,
[318] = 17266L, // 0.526956,
[319] = 17315L, // 0.528438,
[320] = 17363L, // 0.529919,
[321] = 17412L, // 0.531399,
[322] = 17460L, // 0.532876,
[323] = 17509L, // 0.534352,
[324] = 17557L, // 0.535827,
[325] = 17605L, // 0.537300,
[326] = 17653L, // 0.538771,
[327] = 17702L, // 0.540240,
[328] = 17750L, // 0.541708,
[329] = 17798L, // 0.543174,
[330] = 17846L, // 0.544639,
[331] = 17894L, // 0.546102,
[332] = 17942L, // 0.547563,
[333] = 17989L, // 0.549023,
[334] = 18037L, // 0.550481,
[335] = 18085L, // 0.551937,
[336] = 18132L, // 0.553392,
[337] = 18180L, // 0.554844,
[338] = 18228L, // 0.556296,
[339] = 18275L, // 0.557745,
[340] = 18323L, // 0.559193,
[341] = 18370L, // 0.560639,
[342] = 18417L, // 0.562083,
[343] = 18465L, // 0.563526,
[344] = 18512L, // 0.564967,
[345] = 18559L, // 0.566406,
[346] = 18606L, // 0.567844,
[347] = 18653L, // 0.569280,
[348] = 18700L, // 0.570714,
[349] = 18747L, // 0.572146,
[350] = 18794L, // 0.573576,
[351] = 18841L, // 0.575005,
[352] = 18887L, // 0.576432,
[353] = 18934L, // 0.577858,
[354] = 18981L, // 0.579281,
[355] = 19027L, // 0.580703,
[356] = 19074L, // 0.582123,
[357] = 19120L, // 0.583541,
[358] = 19167L, // 0.584958,
[359] = 19213L, // 0.586372,
[360] = 19259L, // 0.587785,
[361] = 19306L, // 0.589196,
[362] = 19352L, // 0.590606,
[363] = 19398L, // 0.592013,
[364] = 19444L, // 0.593419,
[365] = 19490L, // 0.594823,
[366] = 19536L, // 0.596225,
[367] = 19582L, // 0.597625,
[368] = 19628L, // 0.599024,
[369] = 19673L, // 0.600420,
[370] = 19719L, // 0.601815,
[371] = 19765L, // 0.603208,
[372] = 19810L, // 0.604599,
[373] = 19856L, // 0.605988,
[374] = 19901L, // 0.607376,
[375] = 19947L, // 0.608761,
[376] = 19992L, // 0.610145,
[377] = 20037L, // 0.611527,
[378] = 20083L, // 0.612907,
[379] = 20128L, // 0.614285,
[380] = 20173L, // 0.615662,
[381] = 20218L, // 0.617036,
[382] = 20263L, // 0.618408,
[383] = 20308L, // 0.619779,
[384] = 20353L, // 0.621148,
[385] = 20397L, // 0.622515,
[386] = 20442L, // 0.623880,
[387] = 20487L, // 0.625243,
[388] = 20531L, // 0.626604,
[389] = 20576L, // 0.627963,
[390] = 20620L, // 0.629320,
[391] = 20665L, // 0.630676,
[392] = 20709L, // 0.632029,
[393] = 20753L, // 0.633381,
[394] = 20798L, // 0.634731,
[395] = 20842L, // 0.636078,
[396] = 20886L, // 0.637424,
[397] = 20930L, // 0.638768,
[398] = 20974L, // 0.640110,
[399] = 21018L, // 0.641450,
[400] = 21062L, // 0.642788,
[401] = 21105L, // 0.644124,
[402] = 21149L, // 0.645458,
[403] = 21193L, // 0.646790,
[404] = 21236L, // 0.648120,
[405] = 21280L, // 0.649448,
[406] = 21323L, // 0.650774,
[407] = 21367L, // 0.652098,
[408] = 21410L, // 0.653421,
[409] = 21453L, // 0.654741,
[410] = 21497L, // 0.656059,
[411] = 21540L, // 0.657375,
[412] = 21583L, // 0.658689,
[413] = 21626L, // 0.660002,
[414] = 21669L, // 0.661312,
[415] = 21712L, // 0.662620,
[416] = 21754L, // 0.663926,
[417] = 21797L, // 0.665230,
[418] = 21840L, // 0.666532,
[419] = 21882L, // 0.667833,
[420] = 21925L, // 0.669131,
[421] = 21967L, // 0.670427,
[422] = 22010L, // 0.671721,
[423] = 22052L, // 0.673012,
[424] = 22094L, // 0.674302,
[425] = 22137L, // 0.675590,
[426] = 22179L, // 0.676876,
[427] = 22221L, // 0.678160,
[428] = 22263L, // 0.679441,
[429] = 22305L, // 0.680721,
[430] = 22347L, // 0.681998,
[431] = 22388L, // 0.683274,
[432] = 22430L, // 0.684547,
[433] = 22472L, // 0.685818,
[434] = 22513L, // 0.687088,
[435] = 22555L, // 0.688355,
[436] = 22596L, // 0.689620,
[437] = 22638L, // 0.690882,
[438] = 22679L, // 0.692143,
[439] = 22720L, // 0.693402,
[440] = 22761L, // 0.694658,
[441] = 22802L, // 0.695913,
[442] = 22844L, // 0.697165,
[443] = 22884L, // 0.698415,
[444] = 22925L, // 0.699663,
[445] = 22966L, // 0.700909,
[446] = 23007L, // 0.702153,
[447] = 23048L, // 0.703395,
[448] = 23088L, // 0.704634,
[449] = 23129L, // 0.705872,
[450] = 23169L, // 0.707107,
[451] = 23210L, // 0.708340,
[452] = 23250L, // 0.709571,
[453] = 23290L, // 0.710799,
[454] = 23330L, // 0.712026,
[455] = 23371L, // 0.713250,
[456] = 23411L, // 0.714473,
[457] = 23451L, // 0.715693,
[458] = 23491L, // 0.716911,
[459] = 23530L, // 0.718126,
[460] = 23570L, // 0.719340,
[461] = 23610L, // 0.720551,
[462] = 23649L, // 0.721760,
[463] = 23689L, // 0.722967,
[464] = 23728L, // 0.724172,
[465] = 23768L, // 0.725374,
[466] = 23807L, // 0.726575,
[467] = 23846L, // 0.727773,
[468] = 23886L, // 0.728969,
[469] = 23925L, // 0.730162,
[470] = 23964L, // 0.731354,
[471] = 24003L, // 0.732543,
[472] = 24042L, // 0.733730,
[473] = 24080L, // 0.734915,
[474] = 24119L, // 0.736097,
[475] = 24158L, // 0.737277,
[476] = 24196L, // 0.738455,
[477] = 24235L, // 0.739631,
[478] = 24273L, // 0.740805,
[479] = 24312L, // 0.741976,
[480] = 24350L, // 0.743145,
[481] = 24388L, // 0.744312,
[482] = 24427L, // 0.745476,
[483] = 24465L, // 0.746638,
[484] = 24503L, // 0.747798,
[485] = 24541L, // 0.748956,
[486] = 24578L, // 0.750111,
[487] = 24616L, // 0.751264,
[488] = 24654L, // 0.752415,
[489] = 24692L, // 0.753563,
[490] = 24729L, // 0.754710,
[491] = 24767L, // 0.755853,
[492] = 24804L, // 0.756995,
[493] = 24841L, // 0.758134,
[494] = 24879L, // 0.759271,
[495] = 24916L, // 0.760406,
[496] = 24953L, // 0.761538,
[497] = 24990L, // 0.762668,
[498] = 25027L, // 0.763796,
[499] = 25064L, // 0.764921,
[500] = 25100L, // 0.766044,
[501] = 25137L, // 0.767165,
[502] = 25174L, // 0.768284,
[503] = 25210L, // 0.769400,
[504] = 25247L, // 0.770513,
[505] = 25283L, // 0.771625,
[506] = 25320L, // 0.772734,
[507] = 25356L, // 0.773840,
[508] = 25392L, // 0.774944,
[509] = 25428L, // 0.776046,
[510] = 25464L, // 0.777146,
[511] = 25500L, // 0.778243,
[512] = 25536L, // 0.779338,
[513] = 25572L, // 0.780430,
[514] = 25608L, // 0.781520,
[515] = 25643L, // 0.782608,
[516] = 25679L, // 0.783693,
[517] = 25714L, // 0.784776,
[518] = 25750L, // 0.785857,
[519] = 25785L, // 0.786935,
[520] = 25820L, // 0.788011,
[521] = 25855L, // 0.789084,
[522] = 25891L, // 0.790155,
[523] = 25926L, // 0.791224,
[524] = 25960L, // 0.792290,
[525] = 25995L, // 0.793353,
[526] = 26030L, // 0.794415,
[527] = 26065L, // 0.795473,
[528] = 26099L, // 0.796530,
[529] = 26134L, // 0.797584,
[530] = 26168L, // 0.798635,
[531] = 26203L, // 0.799685,
[532] = 26237L, // 0.800731,
[533] = 26271L, // 0.801776,
[534] = 26305L, // 0.802817,
[535] = 26339L, // 0.803857,
[536] = 26373L, // 0.804894,
[537] = 26407L, // 0.805928,
[538] = 26441L, // 0.806960,
[539] = 26475L, // 0.807990,
[540] = 26509L, // 0.809017,
[541] = 26542L, // 0.810042,
[542] = 26576L, // 0.811064,
[543] = 26609L, // 0.812084,
[544] = 26642L, // 0.813101,
[545] = 26676L, // 0.814116,
[546] = 26709L, // 0.815128,
[547] = 26742L, // 0.816138,
[548] = 26775L, // 0.817145,
[549] = 26808L, // 0.818150,
[550] = 26841L, // 0.819152,
[551] = 26873L, // 0.820152,
[552] = 26906L, // 0.821149,
[553] = 26939L, // 0.822144,
[554] = 26971L, // 0.823136,
[555] = 27004L, // 0.824126,
[556] = 27036L, // 0.825113,
[557] = 27068L, // 0.826098,
[558] = 27100L, // 0.827081,
[559] = 27133L, // 0.828060,
[560] = 27165L, // 0.829038,
[561] = 27197L, // 0.830012,
[562] = 27228L, // 0.830984,
[563] = 27260L, // 0.831954,
[564] = 27292L, // 0.832921,
[565] = 27323L, // 0.833886,
[566] = 27355L, // 0.834848,
[567] = 27386L, // 0.835807,
[568] = 27418L, // 0.836764,
[569] = 27449L, // 0.837719,
[570] = 27480L, // 0.838671,
[571] = 27511L, // 0.839620,
[572] = 27542L, // 0.840567,
[573] = 27573L, // 0.841511,
[574] = 27604L, // 0.842452,
[575] = 27635L, // 0.843391,
[576] = 27666L, // 0.844328,
[577] = 27696L, // 0.845262,
[578] = 27727L, // 0.846193,
[579] = 27757L, // 0.847122,
[580] = 27787L, // 0.848048,
[581] = 27818L, // 0.848972,
[582] = 27848L, // 0.849893,
[583] = 27878L, // 0.850811,
[584] = 27908L, // 0.851727,
[585] = 27938L, // 0.852640,
[586] = 27968L, // 0.853551,
[587] = 27998L, // 0.854459,
[588] = 28027L, // 0.855364,
[589] = 28057L, // 0.856267,
[590] = 28086L, // 0.857167,
[591] = 28116L, // 0.858065,
[592] = 28145L, // 0.858960,
[593] = 28174L, // 0.859852,
[594] = 28203L, // 0.860742,
[595] = 28233L, // 0.861629,
[596] = 28261L, // 0.862514,
[597] = 28290L, // 0.863396,
[598] = 28319L, // 0.864275,
[599] = 28348L, // 0.865151,
[600] = 28377L, // 0.866025,
[601] = 28405L, // 0.866897,
[602] = 28434L, // 0.867765,
[603] = 28462L, // 0.868632,
[604] = 28490L, // 0.869495,
[605] = 28518L, // 0.870356,
[606] = 28547L, // 0.871214,
[607] = 28575L, // 0.872069,
[608] = 28603L, // 0.872922,
[609] = 28630L, // 0.873772,
[610] = 28658L, // 0.874620,
[611] = 28686L, // 0.875464,
[612] = 28713L, // 0.876307,
[613] = 28741L, // 0.877146,
[614] = 28768L, // 0.877983,
[615] = 28796L, // 0.878817,
[616] = 28823L, // 0.879649,
[617] = 28850L, // 0.880477,
[618] = 28877L, // 0.881303,
[619] = 28904L, // 0.882127,
[620] = 28931L, // 0.882948,
[621] = 28958L, // 0.883766,
[622] = 28985L, // 0.884581,
[623] = 29011L, // 0.885394,
[624] = 29038L, // 0.886204,
[625] = 29064L, // 0.887011,
[626] = 29091L, // 0.887815,
[627] = 29117L, // 0.888617,
[628] = 29143L, // 0.889416,
[629] = 29169L, // 0.890213,
[630] = 29195L, // 0.891007,
[631] = 29221L, // 0.891798,
[632] = 29247L, // 0.892586,
[633] = 29273L, // 0.893371,
[634] = 29298L, // 0.894154,
[635] = 29324L, // 0.894934,
[636] = 29349L, // 0.895712,
[637] = 29375L, // 0.896486,
[638] = 29400L, // 0.897258,
[639] = 29425L, // 0.898028,
[640] = 29450L, // 0.898794,
[641] = 29475L, // 0.899558,
[642] = 29500L, // 0.900319,
[643] = 29525L, // 0.901077,
[644] = 29550L, // 0.901833,
[645] = 29575L, // 0.902585,
[646] = 29599L, // 0.903335,
[647] = 29624L, // 0.904083,
[648] = 29648L, // 0.904827,
[649] = 29672L, // 0.905569,
[650] = 29696L, // 0.906308,
[651] = 29721L, // 0.907044,
[652] = 29745L, // 0.907777,
[653] = 29769L, // 0.908508,
[654] = 29792L, // 0.909236,
[655] = 29816L, // 0.909961,
[656] = 29840L, // 0.910684,
[657] = 29863L, // 0.911403,
[658] = 29887L, // 0.912120,
[659] = 29910L, // 0.912834,
[660] = 29934L, // 0.913545,
[661] = 29957L, // 0.914254,
[662] = 29980L, // 0.914960,
[663] = 30003L, // 0.915663,
[664] = 30026L, // 0.916363,
[665] = 30049L, // 0.917060,
[666] = 30072L, // 0.917755,
[667] = 30094L, // 0.918446,
[668] = 30117L, // 0.919135,
[669] = 30139L, // 0.919822,
[670] = 30162L, // 0.920505,
[671] = 30184L, // 0.921185,
[672] = 30206L, // 0.921863,
[673] = 30228L, // 0.922538,
[674] = 30250L, // 0.923210,
[675] = 30272L, // 0.923880,
[676] = 30294L, // 0.924546,
[677] = 30316L, // 0.925210,
[678] = 30338L, // 0.925871,
[679] = 30359L, // 0.926529,
[680] = 30381L, // 0.927184,
[681] = 30402L, // 0.927836,
[682] = 30423L, // 0.928486,
[683] = 30444L, // 0.929133,
[684] = 30465L, // 0.929776,
[685] = 30486L, // 0.930418,
[686] = 30507L, // 0.931056,
[687] = 30528L, // 0.931691,
[688] = 30549L, // 0.932324,
[689] = 30570L, // 0.932954,
[690] = 30590L, // 0.933580,
[691] = 30611L, // 0.934204,
[692] = 30631L, // 0.934826,
[693] = 30651L, // 0.935444,
[694] = 30671L, // 0.936060,
[695] = 30691L, // 0.936672,
[696] = 30711L, // 0.937282,
[697] = 30731L, // 0.937889,
[698] = 30751L, // 0.938493,
[699] = 30771L, // 0.939094,
[700] = 30790L, // 0.939693,
[701] = 30810L, // 0.940288,
[702] = 30829L, // 0.940881,
[703] = 30849L, // 0.941471,
[704] = 30868L, // 0.942057,
[705] = 30887L, // 0.942641,
[706] = 30906L, // 0.943223,
[707] = 30925L, // 0.943801,
[708] = 30944L, // 0.944376,
[709] = 30963L, // 0.944949,
[710] = 30981L, // 0.945519,
[711] = 31000L, // 0.946085,
[712] = 31018L, // 0.946649,
[713] = 31037L, // 0.947210,
[714] = 31055L, // 0.947768,
[715] = 31073L, // 0.948324,
[716] = 31091L, // 0.948876,
[717] = 31109L, // 0.949425,
[718] = 31127L, // 0.949972,
[719] = 31145L, // 0.950516,
[720] = 31163L, // 0.951057,
[721] = 31180L, // 0.951594,
[722] = 31198L, // 0.952129,
[723] = 31215L, // 0.952661,
[724] = 31233L, // 0.953191,
[725] = 31250L, // 0.953717,
[726] = 31267L, // 0.954240,
[727] = 31284L, // 0.954761,
[728] = 31301L, // 0.955278,
[729] = 31318L, // 0.955793,
[730] = 31335L, // 0.956305,
[731] = 31351L, // 0.956814,
[732] = 31368L, // 0.957319,
[733] = 31384L, // 0.957823,
[734] = 31401L, // 0.958323,
[735] = 31417L, // 0.958820,
[736] = 31433L, // 0.959314,
[737] = 31449L, // 0.959805,
[738] = 31465L, // 0.960294,
[739] = 31481L, // 0.960779,
[740] = 31497L, // 0.961262,
[741] = 31513L, // 0.961741,
[742] = 31528L, // 0.962218,
[743] = 31544L, // 0.962692,
[744] = 31559L, // 0.963163,
[745] = 31575L, // 0.963630,
[746] = 31590L, // 0.964095,
[747] = 31605L, // 0.964557,
[748] = 31620L, // 0.965016,
[749] = 31635L, // 0.965473,
[750] = 31650L, // 0.965926,
[751] = 31665L, // 0.966376,
[752] = 31679L, // 0.966823,
[753] = 31694L, // 0.967268,
[754] = 31708L, // 0.967709,
[755] = 31723L, // 0.968148,
[756] = 31737L, // 0.968583,
[757] = 31751L, // 0.969016,
[758] = 31765L, // 0.969445,
[759] = 31779L, // 0.969872,
[760] = 31793L, // 0.970296,
[761] = 31807L, // 0.970716,
[762] = 31821L, // 0.971134,
[763] = 31834L, // 0.971549,
[764] = 31848L, // 0.971961,
[765] = 31861L, // 0.972370,
[766] = 31874L, // 0.972776,
[767] = 31888L, // 0.973179,
[768] = 31901L, // 0.973579,
[769] = 31914L, // 0.973976,
[770] = 31927L, // 0.974370,
[771] = 31939L, // 0.974761,
[772] = 31952L, // 0.975149,
[773] = 31965L, // 0.975535,
[774] = 31977L, // 0.975917,
[775] = 31990L, // 0.976296,
[776] = 32002L, // 0.976672,
[777] = 32014L, // 0.977046,
[778] = 32026L, // 0.977416,
[779] = 32039L, // 0.977783,
[780] = 32050L, // 0.978148,
[781] = 32062L, // 0.978509,
[782] = 32074L, // 0.978867,
[783] = 32086L, // 0.979223,
[784] = 32097L, // 0.979575,
[785] = 32109L, // 0.979925,
[786] = 32120L, // 0.980271,
[787] = 32131L, // 0.980615,
[788] = 32142L, // 0.980955,
[789] = 32154L, // 0.981293,
[790] = 32164L, // 0.981627,
[791] = 32175L, // 0.981959,
[792] = 32186L, // 0.982287,
[793] = 32197L, // 0.982613,
[794] = 32207L, // 0.982935,
[795] = 32218L, // 0.983255,
[796] = 32228L, // 0.983571,
[797] = 32238L, // 0.983885,
[798] = 32249L, // 0.984196,
[799] = 32259L, // 0.984503,
[800] = 32269L, // 0.984808,
[801] = 32279L, // 0.985109,
[802] = 32288L, // 0.985408,
[803] = 32298L, // 0.985703,
[804] = 32308L, // 0.985996,
[805] = 32317L, // 0.986286,
[806] = 32327L, // 0.986572,
[807] = 32336L, // 0.986856,
[808] = 32345L, // 0.987136,
[809] = 32354L, // 0.987414,
[810] = 32363L, // 0.987688,
[811] = 32372L, // 0.987960,
[812] = 32381L, // 0.988228,
[813] = 32389L, // 0.988494,
[814] = 32398L, // 0.988756,
[815] = 32407L, // 0.989016,
[816] = 32415L, // 0.989272,
[817] = 32423L, // 0.989526,
[818] = 32431L, // 0.989776,
[819] = 32440L, // 0.990024,
[820] = 32448L, // 0.990268,
[821] = 32456L, // 0.990509,
[822] = 32463L, // 0.990748,
[823] = 32471L, // 0.990983,
[824] = 32479L, // 0.991216,
[825] = 32486L, // 0.991445,
[826] = 32494L, // 0.991671,
[827] = 32501L, // 0.991894,
[828] = 32508L, // 0.992115,
[829] = 32515L, // 0.992332,
[830] = 32522L, // 0.992546,
[831] = 32529L, // 0.992757,
[832] = 32536L, // 0.992966,
[833] = 32543L, // 0.993171,
[834] = 32549L, // 0.993373,
[835] = 32556L, // 0.993572,
[836] = 32562L, // 0.993768,
[837] = 32569L, // 0.993961,
[838] = 32575L, // 0.994151,
[839] = 32581L, // 0.994338,
[840] = 32587L, // 0.994522,
[841] = 32593L, // 0.994703,
[842] = 32599L, // 0.994881,
[843] = 32604L, // 0.995056,
[844] = 32610L, // 0.995227,
[845] = 32616L, // 0.995396,
[846] = 32621L, // 0.995562,
[847] = 32626L, // 0.995725,
[848] = 32632L, // 0.995884,
[849] = 32637L, // 0.996041,
[850] = 32642L, // 0.996195,
[851] = 32647L, // 0.996345,
[852] = 32652L, // 0.996493,
[853] = 32656L, // 0.996637,
[854] = 32661L, // 0.996779,
[855] = 32665L, // 0.996917,
[856] = 32670L, // 0.997053,
[857] = 32674L, // 0.997185,
[858] = 32679L, // 0.997314,
[859] = 32683L, // 0.997441,
[860] = 32687L, // 0.997564,
[861] = 32691L, // 0.997684,
[862] = 32694L, // 0.997801,
[863] = 32698L, // 0.997916,
[864] = 32702L, // 0.998027,
[865] = 32705L, // 0.998135,
[866] = 32709L, // 0.998240,
[867] = 32712L, // 0.998342,
[868] = 32715L, // 0.998441,
[869] = 32719L, // 0.998537,
[870] = 32722L, // 0.998630,
[871] = 32725L, // 0.998719,
[872] = 32727L, // 0.998806,
[873] = 32730L, // 0.998890,
[874] = 32733L, // 0.998971,
[875] = 32735L, // 0.999048,
[876] = 32738L, // 0.999123,
[877] = 32740L, // 0.999194,
[878] = 32742L, // 0.999263,
[879] = 32744L, // 0.999328,
[880] = 32747L, // 0.999391,
[881] = 32748L, // 0.999450,
[882] = 32750L, // 0.999507,
[883] = 32752L, // 0.999560,
[884] = 32754L, // 0.999610,
[885] = 32755L, // 0.999657,
[886] = 32757L, // 0.999701,
[887] = 32758L, // 0.999743,
[888] = 32759L, // 0.999781,
[889] = 32760L, // 0.999816,
[890] = 32762L, // 0.999848,
[891] = 32762L, // 0.999877,
[892] = 32763L, // 0.999903,
[893] = 32764L, // 0.999925,
[894] = 32765L, // 0.999945,
[895] = 32765L, // 0.999962,
[896] = 32766L, // 0.999976,
[897] = 32766L, // 0.999986,
[898] = 32766L, // 0.999994,
[899] = 32766L, // 0.999998,
[900] = 32767L, // 1.000000,
};

View File

@@ -0,0 +1,6 @@
#pragma once
#include <stdint.h>
int16_t sin_s16(int16_t deg); // deg: 0.1 角度, 返回: 分母为 0x7fffL 的分子值
int16_t cos_s16(int16_t deg); // deg: 0.1 角度, 返回: 分母为 0x7fffL 的分子值

View File

@@ -0,0 +1,19 @@
list(APPEND incs ".")
list(APPEND incs "../system/include")
list(APPEND incs "../system/source")
list(APPEND incs "../../app")
list(APPEND srcs "lib_shell.c")
idf_component_register(
INCLUDE_DIRS ${incs}
SRCS ${srcs}
)
if(CONFIG_IDF_TARGET_ESP32S3)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/spbelib_s3.a")
elseif(CONFIG_IDF_TARGET_ESP32C2)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/spbelib_c2.a")
else(CONFIG_IDF_TARGET_ESP32C3)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/spbelib_c3.a")
endif()

317
components/lib/lib_shell.c Normal file
View File

@@ -0,0 +1,317 @@
#include "lib_shell.h"
#include "shell/sh.h"
#include "shell/sh_vset.h"
#include "spbelib_interface.h"
#include "config/app_config.h"
#include <string.h>
#undef CONFIG_SYS_LOG_LEVEL
#define CONFIG_SYS_LOG_LEVEL SYS_LOG_LEVEL_INF
#include "sys_log.h"
static void _print_event(void);
SH_CMD_FN(_set_adapter_fcport_off); // set adapter fcport-off
SH_CMD_FN(_set_adapter_fcport_uart); // set adapter fcport-uart
SH_CMD_FN(_set_adapter_fcport_otg); // set adapter fcport-otg
SH_CMD_FN(_set_adapter_rf_off); // set adapter rf-off
SH_CMD_FN(_set_adapter_rf_ble); // set adapter rf-ble
SH_CMD_FN(_set_adapter_rf_ap); // set adapter rf-ap
SH_CMD_FN(_set_adapter_rf_sta); // set adapter rf-sta
SH_CMD_FN(_set_ble_name); // set ble name <...>
SH_CMD_FN(_set_ble_passwd); // set ble passwd <...>
SH_CMD_FN(_set_wifi_ap_ssid); // set wifi ap-ssid <...>
SH_CMD_FN(_set_wifi_ap_passwd); // set wifi ap-passwd <...>
SH_CMD_FN(_set_wifi_sta_ssid); // set wifi sta-ssid <...>
SH_CMD_FN(_set_wifi_sta_passwd); // set wifi sta-passwd <...>
SH_CMD_FN(_get_adapter_rf_status); // get adapter adapter rf-status
SH_CMD_FN(_get_ble_name); // get ble name
SH_CMD_FN(_get_ble_passwd); // get ble passwd
SH_CMD_FN(_get_wifi_ap_ssid); // get wifi ap-ssid
SH_CMD_FN(_get_wifi_ap_passwd); // get wifi ap-passwd
SH_CMD_FN(_get_wifi_sta_ssid); // get wifi sta-ssid
SH_CMD_FN(_get_wifi_sta_passwd); // get wifi sta-passwd
SH_DEF_SUB_CMD(
_sub_set_adapter,
SH_SETUP_CMD("fcport-off", "关闭飞控数据接口", _set_adapter_fcport_off, NULL), // set adapter fcport-off
SH_SETUP_CMD("fcport-uart", "使用 UART 连接飞控", _set_adapter_fcport_uart, NULL), // set adapter fcport-uart
SH_SETUP_CMD("fcport-otg", "使用 OTG 连接飞控", _set_adapter_fcport_otg, NULL), // set adapter fcport-otg
SH_SETUP_CMD("rf-off", "关闭无线功能", _set_adapter_rf_off, NULL), // set adapter rf-off
SH_SETUP_CMD("rf-ble", "打开蓝牙功能", _set_adapter_rf_ble, NULL), // set adapter rf-ble
SH_SETUP_CMD("rf-ap", "打开 AP 功能", _set_adapter_rf_ap, NULL), // set adapter rf-ap
SH_SETUP_CMD("rf-sta", "打开 STA 功能", _set_adapter_rf_sta, NULL), // set adapter rf-sta
);
SH_DEF_SUB_CMD(
_sub_set_opt,
SH_SETUP_CMD("adapter", "设置小黄砖功能", NULL, _sub_set_adapter), // set adapter <...>
);
SH_DEF_SUB_CMD(
_sub_set_ble,
SH_SETUP_CMD("name", "设置 BLE 设备名, 1 到 19 个字符", _set_ble_name, NULL), // set ble name <...>
SH_SETUP_CMD("passwd", "设置 BLE 透传密码, 0 到 12 个字符", _set_ble_passwd, NULL), // set ble passwd <...>
);
SH_DEF_SUB_CMD(
_sub_set_wifi,
SH_SETUP_CMD("ap-ssid", "参数", _set_wifi_ap_ssid, NULL), // set wifi ap-ssid <...>
SH_SETUP_CMD("ap-passwd", "参数", _set_wifi_ap_passwd, NULL), // set wifi ap-passwd <...>
SH_SETUP_CMD("sta-ssid", "参数", _set_wifi_sta_ssid, NULL), // set wifi sta-ssid <...>
SH_SETUP_CMD("sta-passwd", "参数", _set_wifi_sta_passwd, NULL), // set wifi sta-passwd <...>
);
SH_DEF_SUB_CMD(
_sub_set_param,
SH_SETUP_CMD("ble", "参数", NULL, _sub_set_ble), // set ble <...>
SH_SETUP_CMD("wifi", "参数", NULL, _sub_set_wifi), // set wifi <...>
);
SH_DEF_SUB_CMD(
_sub_get_adapter,
SH_SETUP_CMD("rf-status", "查询小黄砖射频状态", _get_adapter_rf_status, NULL), // get adapter rf-status
);
SH_DEF_SUB_CMD(
_sub_get_ble,
SH_SETUP_CMD("name", "打印 BLE 设备名", _get_ble_name, NULL), // get ble name
SH_SETUP_CMD("passwd", "打印 BLE 透传密码", _get_ble_passwd, NULL), // get ble passwd
);
SH_DEF_SUB_CMD(
_sub_get_wifi,
SH_SETUP_CMD("ap-ssid", "参数", _get_wifi_ap_ssid, NULL), // get wifi ap-ssid
SH_SETUP_CMD("ap-passwd", "参数", _get_wifi_ap_passwd, NULL), // get wifi ap-passwd
SH_SETUP_CMD("sta-ssid", "参数", _get_wifi_sta_ssid, NULL), // get wifi sta-ssid
SH_SETUP_CMD("sta-passwd", "参数", _get_wifi_sta_passwd, NULL), // get wifi sta-passwd
);
SH_DEF_SUB_CMD(
_sub_get,
SH_SETUP_CMD("adapter", "打印当前射频状态", NULL, _sub_get_adapter), // get adapter <...>
SH_SETUP_CMD("ble", "参数", NULL, _sub_get_ble), // get ble <...>
SH_SETUP_CMD("wifi", "参数", NULL, _sub_get_wifi), // get wifi <...>
);
SH_DEF_CMD(
_register_cmd,
SH_SETUP_CMD("set", "执行控制动作", NULL, _sub_set_opt), // set <...>
SH_SETUP_CMD("set", "执行参数设置", NULL, _sub_set_param), // set <...>
SH_SETUP_CMD("get", "获取状态", NULL, _sub_get), // get <...>
);
void lib_shell_register(void)
{
SYS_LOG_INF("Register notify event");
sblib_regist_notify_event(_print_event);
_print_event();
sh_register_cmd(&_register_cmd);
}
SH_CMD_FN(_set_adapter_fcport_off)
{
return sblib_control(LIB_CONTROL_FCPORT_OFF);
}
SH_CMD_FN(_set_adapter_fcport_uart)
{
return sblib_control(LIB_CONTROL_FCPORT_UART);
}
SH_CMD_FN(_set_adapter_fcport_otg)
{
return sblib_control(LIB_CONTROL_FCPORT_OTG);
}
SH_CMD_FN(_set_adapter_rf_off)
{
return sblib_control(LIB_CONTROL_RF_OFF);
}
SH_CMD_FN(_set_adapter_rf_ble)
{
return sblib_control(LIB_CONTROL_RF_BLE);
}
SH_CMD_FN(_set_adapter_rf_ap)
{
return sblib_control(LIB_CONTROL_RF_AP);
}
SH_CMD_FN(_set_adapter_rf_sta)
{
return sblib_control(LIB_CONTROL_RF_STA);
}
SH_CMD_FN(_set_ble_name)
{
int len = 0;
int ret = -1;
if (argc > 0)
{
len = strlen(argv[0]);
}
ret = app_cfg_set_device_name_ble(argv[0], len);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_BLE_NAME_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_set_ble_passwd)
{
int len = 0;
int ret = -1;
if (argc > 0)
{
len = strlen(argv[0]);
}
ret = app_cfg_set_psPassword(argv[0], len);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_BLE_PASSWD_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_set_wifi_ap_ssid)
{
int ret = app_cfg_set_wifi_ap_ssid(argv[0]);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_WIFI_AP_SSID_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_set_wifi_ap_passwd)
{
int ret = app_cfg_set_wifi_ap_password(argv[0]);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_WIFI_AP_PASSWD_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_set_wifi_sta_ssid)
{
int ret = app_cfg_set_wifi_sta_ssid(argv[0]);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_WIFI_STA_SSID_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_set_wifi_sta_passwd)
{
int ret = app_cfg_set_wifi_sta_password(argv[0]);
if (ret == 0)
{
sblib_send_event(LIB_EVENT_WIFI_STA_PASSWD_SET, 0, NULL);
}
return ret;
}
SH_CMD_FN(_get_adapter_rf_status)
{
static const char *const rf_mode_tab[] = {
[DATA_BRIDGE_RF_MODE_OFF] = "无线已关闭",
[DATA_BRIDGE_RF_MODE_BLE] = "蓝牙模式",
[DATA_BRIDGE_RF_MODE_WIFI_AP] = "AP 模式",
[DATA_BRIDGE_RF_MODE_WIFI_STA] = "STA 模式",
};
sh_echo(sh_hdl, "当前射频状态:%s\r\n", rf_mode_tab[g_cfg_app->rf_mode]);
return 0;
}
SH_CMD_FN(_get_ble_name)
{
char ble_name[__ARRAY_SIZE(g_cfg_app->device_name_ble) + 1] = {0};
memcpy(ble_name, g_cfg_app->device_name_ble, sizeof(g_cfg_app->device_name_ble));
sh_echo(sh_hdl, "%s\r\n", ble_name);
return 0;
}
SH_CMD_FN(_get_ble_passwd)
{
char passwd[__ARRAY_SIZE(g_cfg_app->psPassword) + 1] = {0};
memcpy(passwd, g_cfg_app->psPassword, sizeof(g_cfg_app->psPassword));
sh_echo(sh_hdl, "%s\r\n", passwd);
return 0;
}
SH_CMD_FN(_get_wifi_ap_ssid)
{
sh_echo(sh_hdl, "%s\r\n", g_cfg_app->app_config_wifi_para.wifi_ap_ssid);
return 0;
}
SH_CMD_FN(_get_wifi_ap_passwd)
{
sh_echo(sh_hdl, "%s\r\n", g_cfg_app->app_config_wifi_para.wifi_ap_password);
return 0;
}
SH_CMD_FN(_get_wifi_sta_ssid)
{
sh_echo(sh_hdl, "%s\r\n", g_cfg_app->app_config_wifi_para.wifi_sta_ssid);
return 0;
}
SH_CMD_FN(_get_wifi_sta_passwd)
{
sh_echo(sh_hdl, "%s\r\n", g_cfg_app->app_config_wifi_para.wifi_sta_password);
return 0;
}
static void _print_event(void)
{
lib_event_t event;
do
{
static const char *const type_tab[] = {
[LIB_EVENT_NONE] = "未新事件",
[LIB_EVENT_FC_PORT_OFF] = "飞控数据接口关闭",
[LIB_EVENT_FC_PORT_UART] = "飞控数据接口为 UART",
[LIB_EVENT_FC_PORT_OTG] = "飞控数据接口为 OTG",
[LIB_EVENT_USBH_NO_START] = "USBH 接口未启动",
[LIB_EVENT_USBH_CDC] = "USBH 接口已连接 CDC 设备",
[LIB_EVENT_USBH_DFU] = "USBH 接口已连接 DFU 设备",
[LIB_EVENT_USBH_MSC] = "USBH 接口已连接 MSC 设备",
[LIB_EVENT_USBH_UNKNOW_DEVICE] = "USBH 接口已连接未知设备",
[LIB_EVENT_RF_OFF] = "射频已关闭",
[LIB_EVENT_RF_CHANGE_MODE] = "已准备好切换模式",
[LIB_EVENT_RF_BLE_IDLE] = "当前为 BLE 模式,未有设备连接",
[LIB_EVENT_RF_BLE_CONNECTED] = "当前为 BLE 模式,已连接",
[LIB_EVENT_RF_AP_IDLE] = "当前为 AP 模式,未有设备连接",
[LIB_EVENT_RF_AP_CONNECTED] = "当前为 AP 模式,已连接",
[LIB_EVENT_RF_STA_IDLE] = "当前为 STA 模式,未连接到 AP",
[LIB_EVENT_RF_STA_CONNECTED] = "当前为 STA 模式,已连接",
[LIB_EVENT_BLE_NAME_SET] = "BLE 名称已设置",
[LIB_EVENT_BLE_PASSWD_SET] = "BLE 密码已设置",
[LIB_EVENT_WIFI_AP_SSID_SET] = "WIFI AP SSID 已设置",
[LIB_EVENT_WIFI_AP_PASSWD_SET] = "WIFI AP 密码已设置",
[LIB_EVENT_WIFI_STA_SSID_SET] = "WIFI STA SSID 已设置",
[LIB_EVENT_WIFI_STA_PASSWD_SET] = "WIFI STA 密码已设置",
};
event = sblib_get_event();
if (event.type != LIB_EVENT_NONE)
{
if (event.type < __ARRAY_SIZE(type_tab) && type_tab[event.type] != NULL)
{
SYS_LOG_INF("******** Event: %s ********", type_tab[event.type]);
}
else
{
SYS_LOG_WRN("******** Unknown event: %d ********", event.type);
}
if (event.len > 0)
{
SYS_LOG_DUMP(event.data, event.len, 0, 0);
}
}
} while (event.type != LIB_EVENT_NONE);
}

View File

@@ -0,0 +1,14 @@
/**
* @file lib_shell.h
* @author your name (you@domain.com)
* @brief 通过 shell 演示和操作 spbelib.a 的功能
* @version 0.1
* @date 2025-04-07
*
* @copyright Copyright (c) 2025
*
*/
#pragma once
void lib_shell_register(void);

BIN
components/lib/spbelib_s3.a Normal file

Binary file not shown.