From 92ffaba03621e312b0620f22cd1f184522ee8f3e Mon Sep 17 00:00:00 2001 From: zhyinch <zhyinch@gmail.com> Date: 星期六, 22 六月 2019 16:21:20 +0800 Subject: [PATCH] 32位ID --- 源码/核心板/Src/application/serial_at_cmd_app.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/serial_at_cmd_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/serial_at_cmd_app.c" index 5c6c8c6..4e82425 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/serial_at_cmd_app.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/serial_at_cmd_app.c" @@ -71,12 +71,18 @@ } else if(!memcmp(m_frame_data, "ID", 2)) { - g_com_map[DEV_ID] = 0; + for(uint8_t i=3; i < m_frame_data_len; i++) { - if(m_frame_data[i]<58 && m_frame_data[i]>47) + if(m_frame_data[i]<='9' && m_frame_data[i]>='0') { - g_com_map[DEV_ID] = g_com_map[DEV_ID]*10 + m_frame_data[i]- '0'; + dev_id = (dev_id<<4)|(m_frame_data[i]- '0'); + }else if(m_frame_data[i]<='f' && m_frame_data[i]>='a') + { + dev_id = (dev_id<<4)|(m_frame_data[i]- 'a'+10); + }else if(m_frame_data[i]<='F' && m_frame_data[i]>='A') + { + dev_id = (dev_id<<4)|(m_frame_data[i]- 'A'+10); } else { @@ -84,8 +90,10 @@ break; } } + g_com_map[DEV_ID_L] = dev_id; + g_com_map[DEV_ID_H] = dev_id>>16; Dw1000_App_Init(); - printf("set dev id = %d. \r\n", g_com_map[DEV_ID]); + printf("set dev id = %x. \r\n", dev_id); save_com_map_to_flash(); }else if(!memcmp(m_frame_data, "INT", 3)) { -- Gitblit v1.9.3