fix(vd960DBN): 修复无法设置 IoT 模式的 bug
This commit is contained in:
@@ -303,6 +303,8 @@ void load_cfg_from_flash(void)
|
||||
g_sub_code_enable.wbdus_enable = (g_sub_code_enable.code_set >> 5) & 0x01;
|
||||
g_sub_code_enable.radar_enable = (g_sub_code_enable.code_set >> 6) & 0x01;
|
||||
|
||||
PRINT("\nSub_Code: 0x%04X, net_enable:%d, iot_enable:%d\n", g_sub_code_enable.code_set, g_sub_code_enable.net_enable, g_sub_code_enable.iot_enable);
|
||||
|
||||
// g_sub_code_enable.laser_enable = (g_sub_code_enable.code_set >> 9) & 0x01;
|
||||
// g_sub_code_enable.lora_enable = (g_sub_code_enable.code_set >> 15) & 0x01;
|
||||
|
||||
@@ -314,6 +316,7 @@ void output_cfg_from_flash(void)
|
||||
// if(g_flag_debug)
|
||||
// {
|
||||
PRINT("\nBaud1:%d, Baud2:%d\n", g_storage_uart_baud, g_storage_uart_baud_2);
|
||||
PRINT("\nSub_Code:0x%04X\n", g_sub_code_enable.code_set);
|
||||
PRINT("\nGet Net config:\n");
|
||||
PRINT("Local Net Config: "
|
||||
" mac:%02X-%02X-%02X-%02X-%02X-%02X\n"
|
||||
@@ -368,7 +371,6 @@ void update_sub_code_enable(void)
|
||||
if(mBuff == NULL)
|
||||
{
|
||||
PRINT("Err_When_malloc__\n");
|
||||
free(mBuff);
|
||||
return;
|
||||
}
|
||||
memset(mBuff, 0, CFG_FLASH_BLOCK_SIZE);
|
||||
@@ -381,6 +383,7 @@ void update_sub_code_enable(void)
|
||||
SPI_Flash_Write(mBuff, DEV_CNG_ADDR_BASE, CFG_FLASH_BLOCK_SIZE);
|
||||
|
||||
free(mBuff);
|
||||
Delay_Ms(50);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -535,6 +535,23 @@ static uint8_t unpack_packs(uint8_t *pkg, uint8_t len)
|
||||
}
|
||||
set_response_buf(&g_buf_ble_response, MAGIC_BYTE_DBN_DEFAULT, _cmd, tmp_ble_buf, 1);
|
||||
} //end if g_buf_ble_response.cmd == CMD_DBN_MODIFY_PASS
|
||||
else if(g_buf_ble_response.cmd == CMD_DBN_SET_SUB_CODE){
|
||||
g_sub_code_enable.code_set = pkg[4] | (pkg[5] << 8);
|
||||
PRINT("\nWill_set_sub_code:0x%04X\n", g_sub_code_enable.code_set);
|
||||
|
||||
g_sub_code_enable.net_enable = g_sub_code_enable.code_set & 0x01;
|
||||
g_sub_code_enable.iot_enable = (g_sub_code_enable.code_set >> 1) & 0x01;
|
||||
g_sub_code_enable.custom_enable = (g_sub_code_enable.code_set >> 2) & 0x01;
|
||||
g_sub_code_enable.loop_enable = (g_sub_code_enable.code_set >> 3) & 0x01;
|
||||
g_sub_code_enable.dgdus_enable = (g_sub_code_enable.code_set >> 4) & 0x01;
|
||||
g_sub_code_enable.wbdus_enable = (g_sub_code_enable.code_set >> 5) & 0x01;
|
||||
g_sub_code_enable.radar_enable = (g_sub_code_enable.code_set >> 6) & 0x01;
|
||||
g_sub_code_enable.laser_enable = (g_sub_code_enable.code_set >> 9) & 0x01;
|
||||
g_sub_code_enable.lora_enable = (g_sub_code_enable.code_set >> 15) & 0x01;
|
||||
|
||||
|
||||
update_sub_code_enable();
|
||||
}
|
||||
else if(g_buf_ble_response.cmd == CMD_DBN_SET_IOT_NET)
|
||||
{
|
||||
for(i = 0, j = 0, k = 0; i < g_buf_ble_response.dat_len; i++)
|
||||
@@ -751,6 +768,11 @@ void manage_dbn_ble_default(uint8_t *pkg, uint8_t len)
|
||||
{
|
||||
set_response_iot_topic(&g_buf_ble_response);
|
||||
} break;
|
||||
case CMD_DBN_SET_SUB_CODE:
|
||||
{
|
||||
PRINT("\nSet_Sub_Code\n");
|
||||
unpack_packs(pkg, len);
|
||||
} break;
|
||||
case CMD_DBN_RESET_DEV:
|
||||
{
|
||||
//Restart Dev
|
||||
|
||||
@@ -28,7 +28,7 @@ extern "C" {
|
||||
* 1 UDP + 2 TCP + 1 TCP_LISTEN = 4
|
||||
*/
|
||||
#define WCHNET_NUM_UDP 1 /* SSC 模式需要 UDP */
|
||||
#define WCHNET_NUM_TCP 2 /* JSON(1) + SSC client(1) max */
|
||||
#define WCHNET_NUM_TCP 1 //2 /* JSON(1) + SSC client(1) max */
|
||||
#define WCHNET_NUM_IPRAW 0 /* Number of IPRAW connections */
|
||||
|
||||
#define WCHNET_NUM_TCP_LISTEN 1 /* Number of TCP listening (required internally) */
|
||||
|
||||
@@ -23,6 +23,8 @@ void set_ble_safe_pass(uint8_t * devpass);
|
||||
void alter_dev_serila(uint8_t *serial);
|
||||
void alter_dev_baud(uint8_t *baudbuf);
|
||||
|
||||
void update_sub_code_enable(void);
|
||||
|
||||
void factory_dev_info(void);
|
||||
void output_cfg_from_flash(void);
|
||||
void load_cfg_from_flash(void);
|
||||
|
||||
Reference in New Issue
Block a user