| | |
| | | <SetRegEntry> |
| | | <Number>0</Number> |
| | | <Key>DLGUARM</Key> |
| | | <Name></Name> |
| | | <Name>d</Name> |
| | | </SetRegEntry> |
| | | <SetRegEntry> |
| | | <Number>0</Number> |
| | |
| | | <Name>-T0</Name> |
| | | </SetRegEntry> |
| | | </TargetDriverDllRegistry> |
| | | <Breakpoint> |
| | | <Bp> |
| | | <Number>0</Number> |
| | | <Type>0</Type> |
| | | <LineNumber>327</LineNumber> |
| | | <EnabledFlag>1</EnabledFlag> |
| | | <Address>134266338</Address> |
| | | <ByteObject>0</ByteObject> |
| | | <HtxType>0</HtxType> |
| | | <ManyObjects>0</ManyObjects> |
| | | <SizeOfObject>0</SizeOfObject> |
| | | <BreakByAccess>0</BreakByAccess> |
| | | <BreakIfRCount>1</BreakIfRCount> |
| | | <Filename>D:\zhangbo\2024\Code\F103\UWB_SmallModule_F103\å©§æ®ç\Src\main.c</Filename> |
| | | <ExecCommand></ExecCommand> |
| | | <Expression>\\UWB_Projects\../Src/main.c\327</Expression> |
| | | </Bp> |
| | | <Bp> |
| | | <Number>1</Number> |
| | | <Type>0</Type> |
| | | <LineNumber>329</LineNumber> |
| | | <EnabledFlag>1</EnabledFlag> |
| | | <Address>134266350</Address> |
| | | <ByteObject>0</ByteObject> |
| | | <HtxType>0</HtxType> |
| | | <ManyObjects>0</ManyObjects> |
| | | <SizeOfObject>0</SizeOfObject> |
| | | <BreakByAccess>0</BreakByAccess> |
| | | <BreakIfRCount>1</BreakIfRCount> |
| | | <Filename>D:\zhangbo\2024\Code\F103\UWB_SmallModule_F103\å©§æ®ç\Src\main.c</Filename> |
| | | <ExecCommand></ExecCommand> |
| | | <Expression>\\UWB_Projects\../Src/main.c\329</Expression> |
| | | </Bp> |
| | | <Bp> |
| | | <Number>2</Number> |
| | | <Type>0</Type> |
| | | <LineNumber>331</LineNumber> |
| | | <EnabledFlag>1</EnabledFlag> |
| | | <Address>134266362</Address> |
| | | <ByteObject>0</ByteObject> |
| | | <HtxType>0</HtxType> |
| | | <ManyObjects>0</ManyObjects> |
| | | <SizeOfObject>0</SizeOfObject> |
| | | <BreakByAccess>0</BreakByAccess> |
| | | <BreakIfRCount>1</BreakIfRCount> |
| | | <Filename>D:\zhangbo\2024\Code\F103\UWB_SmallModule_F103\å©§æ®ç\Src\main.c</Filename> |
| | | <ExecCommand></ExecCommand> |
| | | <Expression>\\UWB_Projects\../Src/main.c\331</Expression> |
| | | </Bp> |
| | | <Bp> |
| | | <Number>3</Number> |
| | | <Type>0</Type> |
| | | <LineNumber>333</LineNumber> |
| | | <EnabledFlag>1</EnabledFlag> |
| | | <Address>134266374</Address> |
| | | <ByteObject>0</ByteObject> |
| | | <HtxType>0</HtxType> |
| | | <ManyObjects>0</ManyObjects> |
| | | <SizeOfObject>0</SizeOfObject> |
| | | <BreakByAccess>0</BreakByAccess> |
| | | <BreakIfRCount>1</BreakIfRCount> |
| | | <Filename>D:\zhangbo\2024\Code\F103\UWB_SmallModule_F103\å©§æ®ç\Src\main.c</Filename> |
| | | <ExecCommand></ExecCommand> |
| | | <Expression>\\UWB_Projects\../Src/main.c\333</Expression> |
| | | </Bp> |
| | | <Bp> |
| | | <Number>4</Number> |
| | | <Type>0</Type> |
| | | <LineNumber>335</LineNumber> |
| | | <EnabledFlag>1</EnabledFlag> |
| | | <Address>134266386</Address> |
| | | <ByteObject>0</ByteObject> |
| | | <HtxType>0</HtxType> |
| | | <ManyObjects>0</ManyObjects> |
| | | <SizeOfObject>0</SizeOfObject> |
| | | <BreakByAccess>0</BreakByAccess> |
| | | <BreakIfRCount>1</BreakIfRCount> |
| | | <Filename>D:\zhangbo\2024\Code\F103\UWB_SmallModule_F103\å©§æ®ç\Src\main.c</Filename> |
| | | <ExecCommand></ExecCommand> |
| | | <Expression>\\UWB_Projects\../Src/main.c\335</Expression> |
| | | </Bp> |
| | | </Breakpoint> |
| | | <Breakpoint/> |
| | | <WatchWindow1> |
| | | <Ww> |
| | | <count>0</count> |
| | |
| | | <ItemText>min_dist,0x0A</ItemText> |
| | | </Ww> |
| | | </WatchWindow1> |
| | | <WatchWindow2> |
| | | <Ww> |
| | | <count>0</count> |
| | | <WinNumber>2</WinNumber> |
| | | <ItemText>at_cmd2</ItemText> |
| | | </Ww> |
| | | <Ww> |
| | | <count>1</count> |
| | | <WinNumber>2</WinNumber> |
| | | <ItemText>frame_id</ItemText> |
| | | </Ww> |
| | | <Ww> |
| | | <count>2</count> |
| | | <WinNumber>2</WinNumber> |
| | | <ItemText>at_cmd3</ItemText> |
| | | </Ww> |
| | | </WatchWindow2> |
| | | <MemoryWindow1> |
| | | <Mm> |
| | | <WinNumber>1</WinNumber> |
| | |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | UART_PushFrame(usart_send,21); |
| | | |
| | | #endif |
| | | |
| | | //dwt_setdelayedtrxtime(final_tx_time);//设置finalå
åéæ¶é´T5 |
| | |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | UART_PushFrame(usart_send,21); |
| | | |
| | | #endif |
| | | |
| | | //dwt_setdelayedtrxtime(final_tx_time);//设置finalå
åéæ¶é´T5 |
| | |
| | | // g_Tagdist[taglist_pos]= 1; |
| | | } |
| | | #ifdef USART_SINGLE_OUTPUT |
| | | usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | | usart_send[4] = frame_seq_nb2;//æ°æ®æ®µé¿åº¦ |
| | | memcpy(&usart_send[5],&tag_id_recv,2); |
| | | memcpy(&usart_send[7],&dev_id,2); |
| | | if(tagdist_list[taglist_pos]<=0) |
| | | tagdist_list[taglist_pos]=0x2ffff; |
| | | memcpy(&usart_send[9],&tagdist_list[taglist_pos],4); |
| | | usart_send[13] = battary; |
| | | usart_send[14] = button; |
| | | usart_send[15] = firstpath_power; |
| | | usart_send[16] = rx_power; |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | if(g_com_map[MODBUS_MODE]!=1) |
| | | UART_PushFrame(usart_send,21); |
| | | // usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | // usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | | // usart_send[4] = frame_seq_nb2;//æ°æ®æ®µé¿åº¦ |
| | | // memcpy(&usart_send[5],&tag_id_recv,2); |
| | | // memcpy(&usart_send[7],&dev_id,2); |
| | | // if(tagdist_list[taglist_pos]<=0) |
| | | // tagdist_list[taglist_pos]=0x2ffff; |
| | | // memcpy(&usart_send[9],&tagdist_list[taglist_pos],4); |
| | | // usart_send[13] = battary; |
| | | // usart_send[14] = button; |
| | | // usart_send[15] = firstpath_power; |
| | | // usart_send[16] = rx_power; |
| | | // checksum = Checksum_u16(&usart_send[2],17); |
| | | // memcpy(&usart_send[19],&checksum,2); |
| | | // if(g_com_map[MODBUS_MODE]!=1) |
| | | // UART_PushFrame(usart_send,21); |
| | | memcpy(&usart_send[0],&dev_id,2); |
| | | memcpy(&usart_send[2],&tag_id_recv,2); |
| | | memcpy(&usart_send[4],&tagdist_list[taglist_pos],4); |
| | | |
| | | UART_PushFrame(usart_send,8); |
| | | #else |
| | | memcpy(&usart_send_anc[4+6*anc_report_num],&tag_id_recv,2); |
| | | memcpy(&usart_send_anc[6+6*anc_report_num],&tagdist_list[taglist_pos],4); |
| | |
| | | g_com_map[SPEEDFILTER_THRES]=10000; |
| | | g_com_map[FILTER_COEFFICIENT]=40; |
| | | g_com_map[WAR_JDQ_TIME] = 1; |
| | | |
| | | |
| | | g_com_map[NEARBASE_ID1]=0x12; |
| | | g_com_map[NEARBASE_ID2]=0x34; |
| | | |
| | | //memcpy(&g_com_map[BOARD_TYPE],boardtype,4); |
| | | save_com_map_to_flash(); |
| | | delay_ms(100); |
| | |
| | | #define RELAY1_STATE_INDEX 0x10 |
| | | #define RELAY2_STATE_INDEX 0x11 |
| | | |
| | | #define NEARBASE_ID1 0x11 |
| | | #define NEARBASE_ID2 0x12 |
| | | #define NEARBASE_ID3 0x13 |
| | | #define NEARBASE_ID4 0x14 |
| | | #define NEARBASE_ID5 0x15 |
| | | #define NEARBASE_ID6 0x16 |
| | | #define NEARBASE_ID7 0x17 |
| | | #define NEARBASE_ID8 0x18 |
| | | #define NEARBASE_ID9 0x19 |
| | | #define NEARBASE_ID10 0x1a |
| | | |
| | | #define POWER 0x1B |
| | | #define IMU_THRES 0x1C |
| | | #define NOMOVESLEEP_TIME 0x1D |
| | |
| | | |
| | | OUT485_ENABLE; |
| | | ComMapCheck(); |
| | | g_com_map[VERSION] = 1<<8|69; |
| | | g_com_map[VERSION] = 1<<8|76; |
| | | FLASH_Read(FLASH_HARDWARE_FLAG, (uint8_t*)&g_com_map[HARDWAREFLAG_INDEX], 16); |
| | | dist_threshold = (g_com_map[SPEEDFILTER_THRES]*10)/(1000/g_com_map[COM_INTERVAL]); |
| | | if(dist_threshold<300) |
| | |
| | | |
| | | if(g_com_map[DEV_ROLE]) |
| | | { |
| | | printf("æ ç¾ID: %d .\r\n",dev_id); |
| | | printf("é讯é´é: %d ms.\r\n",g_com_map[COM_INTERVAL]); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | // printf("æ ç¾ID: %d .\r\n",dev_id); |
| | | // printf("é讯é´é: %d ms.\r\n",g_com_map[COM_INTERVAL]); |
| | | // printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | }else{ |
| | | |
| | | anchor_type = dev_id%g_com_map[MAX_REPORT_ANC_NUM]; |
| | | printf("åºç«ID: %x .\r\n",dev_id); |
| | | printf("åºç«ç±»å: %c .\r\n",anchor_type+0x41); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | // printf("åºç«ID: %x .\r\n",dev_id); |
| | | // printf("åºç«ç±»å: %c .\r\n",anchor_type+0x41); |
| | | // printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | } |
| | | OUT485_DISABLE; |
| | | // printf("DEVICE PAIRID: %d .\r\n",g_com_map[PAIR_ID]); |
| | |
| | | { |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | } |
| | | g_com_map[RELAY1_STATE_INDEX] = READ_RELAY1; |
| | | g_com_map[RELAY2_STATE_INDEX] = READ_RELAY2; |
| | | // g_com_map[RELAY1_STATE_INDEX] = READ_RELAY1; |
| | | // g_com_map[RELAY2_STATE_INDEX] = READ_RELAY2; |
| | | |
| | | } |
| | | uint8_t at_cmd[3]={0x2B,0x2B,0x2B}; |
| | | uint8_t at_cmd1[2]={0x41,0x54}; |
| | | char at_cmd2[20]={"AT+CAN=500,70,NDTF\r\n"}; //AT+CAN?\r\n |
| | | //uint8_t at_cmd[3]={0x2B,0x2B,0x2B}; |
| | | //uint8_t at_cmd1[2]={0x41,0x54}; |
| | | |
| | | char at_cmd2[22]={"AT+CAN=500,0000,NDTF\r\n"}; //AT+CAN?\r\n |
| | | char at_cmd3[9]={"AT+CAN?\r\n"}; |
| | | char at_cmd4[9]={"AT+EXAT\r\n"}; |
| | | void send_to_ECAN() |
| | | { |
| | | // UART_PushFrame(at_cmd,3); |
| | | // |
| | | // UART_PushFrame(at_cmd1,2); |
| | | //// delay_ms(1); |
| | | // UART_PushFrame((uint8_t*)at_cmd2,20); |
| | | //// delay_ms(1); |
| | | // UART_PushFrame((uint8_t*)at_cmd3,9); |
| | | //// delay_ms(1); |
| | | // UART_PushFrame((uint8_t*)at_cmd4,9); |
| | | // g_com_map[NEARBASE_ID1]=0x12; |
| | | // g_com_map[NEARBASE_ID2]=0x34; |
| | | uint8_t id_high = g_com_map[NEARBASE_ID1]; // 0x12 |
| | | uint8_t id_low = g_com_map[NEARBASE_ID2]; // 0x34 |
| | | |
| | | |
| | | uint16_t frame_id = (id_high << 8) | id_low; |
| | | |
| | | uint32_t decimal_id = frame_id; // 0x1234 = 4660 |
| | | |
| | | if(decimal_id > 0x1FFFFFFF) |
| | | { |
| | | printf("é误ï¼å¸§IDè¶
åºæ©å±å¸§èå´ï¼"); |
| | | return; |
| | | } |
| | | |
| | | const char *frame_type = (frame_id <= 0x7FF) ? "NDTF" : "EDTF"; |
| | | |
| | | |
| | | snprintf(at_cmd2, sizeof(at_cmd2), |
| | | "AT+CAN=250,%x,%s\r\n", |
| | | frame_id, |
| | | frame_type); |
| | | |
| | | printf("+++"); |
| | | delay_ms(20); |
| | | delay_ms(500); |
| | | |
| | | printf("AT"); |
| | | delay_ms(20); |
| | | printf("AT+CAN=500,0,NDTF\r\n"); |
| | | delay_ms(1); |
| | | printf("AT+CAN?\r\n"); |
| | | delay_ms(1); |
| | | printf("AT+EXAT\r\n"); |
| | | delay_ms(500); |
| | | |
| | | |
| | | printf("%s", at_cmd2); |
| | | |
| | | delay_ms(200); |
| | | |
| | | printf("%s", at_cmd3); |
| | | |
| | | delay_ms(200); |
| | | |
| | | printf("%s", at_cmd4); |
| | | } |
| | | |
| | | int main(void) |