From 566ed7f3c2620e22f0e7df0c733b31a4187da502 Mon Sep 17 00:00:00 2001 From: zhangbo <zhangbo@qq.com> Date: 星期二, 29 七月 2025 18:07:58 +0800 Subject: [PATCH] V1.69 --- 源码/核心板/Src/main.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 38 insertions(+), 8 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" index b592840..153893e 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" @@ -94,10 +94,6 @@ { g_com_map[COM_INTERVAL]=100; } - if(dist_threshold<300) - {dist_threshold = 300;} - if(dist_threshold>15000) - {dist_threshold = 15000;} } u16 JDQ_time; int16_t g_commap_antdelay; @@ -109,6 +105,7 @@ parameter_init(); //deca_sleep(1000); HeartBeatInit(); + Modbus_RegMap(); #ifdef DEBUG_MODE // g_com_map[DEV_ROLE]=1; // g_com_map[DEV_ID]=1; @@ -145,9 +142,13 @@ OUT485_ENABLE; ComMapCheck(); - g_com_map[VERSION] = 0x013a; + g_com_map[VERSION] = 1<<8|69; 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) + {dist_threshold = 300;} + if(dist_threshold>15000) + {dist_threshold = 15000;} g_commap_antdelay = g_com_map[ANT_LENGTH]; JDQ_time = g_com_map[WAR_JDQ_TIME]*10; g_com_map[SW_TYPE] = SW_FANGZHUANG; @@ -223,7 +224,7 @@ void IdleTask(void) { - UART_CheckReceive(); + UART_CheckReceive(); UART_CheckSend(); if(heartbeat_timer>1000) @@ -244,7 +245,7 @@ // NVIC_SystemReset(); // } // } - flag_newsecond=0; + flag_newsecond=0; tagpos_binary=0; memcpy(ancidlist_send,ancidlist_rec,ancidlist_num*2); ancidlist_num=0; @@ -303,8 +304,36 @@ { SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader } + 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 +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); + printf("+++"); + delay_ms(20); + 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"); +} int main(void) { @@ -321,9 +350,10 @@ usart_send[1]=0xAA; usart_send_anc[0]=0x55; usart_send_anc[1]=0xAA; - + send_to_ECAN(); while(1) { + g_start_sync_flag=0; if(g_start_send_flag) { -- Gitblit v1.9.3