Compare commits

...

8 Commits

Author SHA1 Message Date
d11e9edf36 升级功能优化 2024-01-05 17:04:46 +08:00
4ffcff9f1b 添加‘投影激光设备’的控制 2023-12-29 11:50:36 +08:00
20a463febf 处理IO中断偶然性丢失数据的BUG 2023-12-20 17:13:54 +08:00
d280ca2a05 解决偶然性误报“车辆进站”语音 2023-12-19 16:44:02 +08:00
6787001a2d V1.25 2023-12-15 15:33:12 +08:00
61abe568b4 V1.24 2023-12-14 14:03:38 +08:00
edf95ec041 V1.23 2023-11-23 14:21:12 +08:00
f2e8c43e2e V1.22 南京金龙CAN数据调整 2023-11-20 10:20:45 +08:00
8 changed files with 240 additions and 358 deletions

232
.gitignore vendored
View File

@ -1,223 +1,9 @@
WpfApp1/.vs/WpfApp1/FileContentIndex/7ce5a04a-68b0-4b93-a3a9-5ba64bbb8303.vsidx
WpfApp1/.vs/WpfApp1/v16/.suo
WpfApp1/.vs/WpfApp1/v17/.suo
WpfApp1/.vs/WpfApp1/v17/Preview/Browse.VC.db
WpfApp1/WpfApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs
WpfApp1/WpfApp1/obj/Debug/App.g.cs
WpfApp1/WpfApp1/obj/Debug/App.g.i.cs
WpfApp1/WpfApp1/obj/Debug/DesignTimeResolveAssemblyReferences.cache
WpfApp1/WpfApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
WpfApp1/WpfApp1/obj/Debug/MainWindow.baml
WpfApp1/WpfApp1/obj/Debug/MainWindow.g.cs
WpfApp1/WpfApp1/obj/Debug/MainWindow.g.i.cs
WpfApp1/WpfApp1/obj/Debug/SeniorWindow.g.i.cs
WpfApp1/WpfApp1/obj/Debug/WpfApp1_MarkupCompile.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1_MarkupCompile.i.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1.csproj.AssemblyReference.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1.csproj.CoreCompileInputs.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1.csproj.FileListAbsolute.txt
WpfApp1/WpfApp1/obj/Debug/WpfApp1.csproj.GenerateResource.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1.csproj.SuggestedBindingRedirects.cache
WpfApp1/WpfApp1/obj/Debug/WpfApp1.exe
WpfApp1/WpfApp1/obj/Debug/WpfApp1.g.resources
WpfApp1/WpfApp1/obj/Debug/WpfApp1.pdb
WpfApp1/WpfApp1/obj/Debug/WpfApp1.Properties.Resources.resources
WpfApp1/WpfApp1/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
WpfApp1/WpfApp1/bin/Debug/WpfApp1.exe
WpfApp1/WpfApp1/bin/Debug/WpfApp1.exe.config
WpfApp1/WpfApp1/bin/Debug/WpfApp1.pdb
GD32F103C8T6/App/Output/Debug/Exe/App.bin
GD32F103C8T6/App/Output/Debug/Exe/App.elf
GD32F103C8T6/App/Output/Debug/Exe/App.hex
GD32F103C8T6/App/Output/Debug/Exe/App.ind
GD32F103C8T6/App/Output/Debug/Exe/App.map
GD32F103C8T6/App/Output/Debug/Obj/App/ak517.d
GD32F103C8T6/App/Output/Debug/Obj/App/ak517.o
GD32F103C8T6/App/Output/Debug/Obj/App/api.d
GD32F103C8T6/App/Output/Debug/Obj/App/api.o
GD32F103C8T6/App/Output/Debug/Obj/App/app.d
GD32F103C8T6/App/Output/Debug/Obj/App/app.o
GD32F103C8T6/App/Output/Debug/Obj/App/can_parsing.d
GD32F103C8T6/App/Output/Debug/Obj/App/can_parsing.o
GD32F103C8T6/App/Output/Debug/Obj/App/can.d
GD32F103C8T6/App/Output/Debug/Obj/App/can.o
GD32F103C8T6/App/Output/Debug/Obj/App/delay.d
GD32F103C8T6/App/Output/Debug/Obj/App/delay.o
GD32F103C8T6/App/Output/Debug/Obj/App/diaodu.d
GD32F103C8T6/App/Output/Debug/Obj/App/diaodu.o
GD32F103C8T6/App/Output/Debug/Obj/App/fmc.d
GD32F103C8T6/App/Output/Debug/Obj/App/fmc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_adc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_adc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_bkp.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_bkp.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_can.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_can.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_crc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_crc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dac.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dac.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dbg.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dbg.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dma.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_dma.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_enet.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_enet.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_exmc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_exmc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_exti.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_exti.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_fmc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_fmc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_fwdgt.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_fwdgt.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_gpio.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_gpio.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_i2c.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_i2c.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_md_Vectors.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_md_Vectors.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_misc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_misc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_pmu.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_pmu.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_rcu.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_rcu.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_rtc.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_rtc.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_sdio.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_sdio.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_spi.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_spi.o
GD32F103C8T6/App/Output/Debug/Obj/App/GD32F10x_Startup.d
GD32F103C8T6/App/Output/Debug/Obj/App/GD32F10x_Startup.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_timer.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_timer.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_usart.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_usart.o
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_wwdgt.d
GD32F103C8T6/App/Output/Debug/Obj/App/gd32f10x_wwdgt.o
GD32F103C8T6/App/Output/Debug/Obj/App/gpio.d
GD32F103C8T6/App/Output/Debug/Obj/App/gpio.o
GD32F103C8T6/App/Output/Debug/Obj/App/iap.d
GD32F103C8T6/App/Output/Debug/Obj/App/iap.o
GD32F103C8T6/App/Output/Debug/Obj/App/iic.d
GD32F103C8T6/App/Output/Debug/Obj/App/iic.o
GD32F103C8T6/App/Output/Debug/Obj/App/ir.d
GD32F103C8T6/App/Output/Debug/Obj/App/ir.o
GD32F103C8T6/App/Output/Debug/Obj/App/m62429.d
GD32F103C8T6/App/Output/Debug/Obj/App/m62429.o
GD32F103C8T6/App/Output/Debug/Obj/App/main.d
GD32F103C8T6/App/Output/Debug/Obj/App/main.o
GD32F103C8T6/App/Output/Debug/Obj/App/qgel50x.d
GD32F103C8T6/App/Output/Debug/Obj/App/qgel50x.o
GD32F103C8T6/App/Output/Debug/Obj/App/SEGGER_THUMB_Startup.d
GD32F103C8T6/App/Output/Debug/Obj/App/SEGGER_THUMB_Startup.o
GD32F103C8T6/App/Output/Debug/Obj/App/setting.d
GD32F103C8T6/App/Output/Debug/Obj/App/setting.o
GD32F103C8T6/App/Output/Debug/Obj/App/spi.d
GD32F103C8T6/App/Output/Debug/Obj/App/spi.o
GD32F103C8T6/App/Output/Debug/Obj/App/system_gd32f10x.d
GD32F103C8T6/App/Output/Debug/Obj/App/system_gd32f10x.o
GD32F103C8T6/App/Output/Debug/Obj/App/system.d
GD32F103C8T6/App/Output/Debug/Obj/App/system.o
GD32F103C8T6/App/Output/Debug/Obj/App/task.d
GD32F103C8T6/App/Output/Debug/Obj/App/task.o
GD32F103C8T6/App/Output/Debug/Obj/App/timer.d
GD32F103C8T6/App/Output/Debug/Obj/App/timer.o
GD32F103C8T6/App/Output/Debug/Obj/App/usart.d
GD32F103C8T6/App/Output/Debug/Obj/App/usart.o
GD32F103C8T6/App/Output/Debug/Obj/App/v58.d
GD32F103C8T6/App/Output/Debug/Obj/App/v58.o
GD32F103C8T6/App/Output/Debug/Obj/App/wdgt.d
GD32F103C8T6/App/Output/Debug/Obj/App/wdgt.o
GD32F103C8T6/Bootloader/Output/Debug/Exe/Bootloader.elf
GD32F103C8T6/Bootloader/Output/Debug/Exe/Bootloader.hex
GD32F103C8T6/Bootloader/Output/Debug/Exe/Bootloader.ind
GD32F103C8T6/Bootloader/Output/Debug/Exe/Bootloader.map
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/delay.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/delay.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_adc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_adc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_bkp.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_bkp.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_can.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_can.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_crc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_crc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dac.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dac.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dbg.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dbg.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dma.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_dma.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_enet.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_enet.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_exmc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_exmc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_exti.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_exti.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_fmc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_fmc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_fwdgt.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_fwdgt.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_gpio.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_gpio.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_i2c.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_i2c.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_md_Vectors.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_md_Vectors.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_misc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_misc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_pmu.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_pmu.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_rcu.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_rcu.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_rtc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_rtc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_sdio.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_sdio.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_spi.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_spi.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/GD32F10x_Startup.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/GD32F10x_Startup.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_timer.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_timer.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_usart.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_usart.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_wwdgt.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gd32f10x_wwdgt.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/main.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/main.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/SEGGER_THUMB_Startup.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/SEGGER_THUMB_Startup.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/system_gd32f10x.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/system_gd32f10x.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/task.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/task.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/timer.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/timer.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/usart.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/usart.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/wdgt.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/wdgt.o
GD32F103C8T6/Bootloader/Bootloader_Debug.jlink
GD32F103C8T6/App/App_Debug.jlink
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/fmc.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/fmc.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gpio.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/gpio.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/iap.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/iap.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/setting.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/setting.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/spi.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/spi.o
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/system.d
GD32F103C8T6/Bootloader/Output/Debug/Obj/Bootloader/system.o
GD32F103C8T6/GD32F10x.emSession
GD32F103C8T6/._GD32F10x.emProject
GD32F103C8T6/App/Output/Debug/Obj/App/v58-e8e109c7.o.tmp
WpfApp1/.vs/WpfApp1/FileContentIndex/294201ea-13b4-4ce6-87c7-fe11eac372a1.vsidx
GD32F103C8T6/GD32F10x.emSession
协议文档/~$通信协议说明.docx
WpfApp1/.vs/*
WpfApp1/WpfApp1/obj/*
WpfApp1/WpfApp1/bin/*
GD32F103C8T6/App/Output/*
GD32F103C8T6/Bootloader/Output/*
GD32F103C8T6/._GD32F10x.emProject
*.emSession
*.jlink
._*

View File

@ -23,6 +23,7 @@ static uint16_t upgrade_write_index = 0;
/* 升级包数据接收长度 */
static uint8_t upgrade_rx_buffer[1024] = {0};
static void api_write_upgrade_buffer(void);
static void api_notify_upgrade(uint8_t *buffer, uint16_t length);
static void api_notify_get_fhss_channel(void);
static void api_package(uint8_t type, uint8_t command, uint8_t *data, uint8_t length);
@ -199,6 +200,16 @@ void api_upload_data_forwarding(uint8_t type, uint8_t value)
__weak void api_notify_data_forwarding(uint8_t type, uint8_t value) { }
static void api_write_upgrade_buffer(void)
{
/* 写入升级包数据 */
fmc_write_bytes(FMC_ADDRESS_UPGRADE_BUFFER + upgrade_write_index * FMC_PAGE_SIZE, upgrade_rx_buffer, upgrade_rx_index / 4 + (upgrade_rx_index % 4 ? 1 : 0));
upgrade_write_index++;
upgrade_rx_length += upgrade_rx_index;
upgrade_rx_index = 0;
}
/**
* @brief
*/
@ -226,23 +237,21 @@ static void api_notify_upgrade(uint8_t *buffer, uint16_t length)
upgrade_pack_index = 0;
}
for (uint16_t i = 0; i < pack_length; i++)
upgrade_rx_buffer[upgrade_rx_index++] = buffer[i + 9];
if (index == upgrade_pack_index + 1)
{
/* 更改ARM接收到的升级包序号 */
upgrade_pack_index = index;
if (upgrade_rx_index >= 1024 || upgrade_pack_index == upgrade_pack_count)
for (uint16_t i = 0; i < pack_length; i++)
{
/* 写入升级包数据 */
fmc_write_bytes(FMC_ADDRESS_UPGRADE_BUFFER + upgrade_write_index * FMC_PAGE_SIZE, upgrade_rx_buffer, upgrade_rx_index / 4 + (upgrade_rx_index % 4 ? 1 : 0));
upgrade_rx_buffer[upgrade_rx_index++] = buffer[i + 9];
upgrade_write_index++;
upgrade_rx_length += upgrade_rx_index;
upgrade_rx_index = 0;
if (upgrade_rx_index >= 1024)
api_write_upgrade_buffer();
}
if (upgrade_pack_index == upgrade_pack_count)
api_write_upgrade_buffer();
/* 通知上位机当前升级包成功接收 */
api_response_success(API_COMMAND_UPGRADE);

View File

@ -22,7 +22,7 @@
#define API_FRAME_RESPONSE (0x01) /* 响应帧 */
#define API_FRAME_NOTIFICATION (0x02) /* 通知帧 */
#define SOFTWARE_VERSION ("V1.21")
#define SOFTWARE_VERSION ("V1.28")
#define HARDWARE_VERSION ("V1.01")
extern uint8_t api_upgrade_mode;

View File

@ -73,28 +73,44 @@ void can_jinlong_parsing(uint32_t id, uint8_t *data, uint8_t *door_front, uint8_
{
switch (id)
{
case 0x18F0B117:
//case 0x18F0B117:
// /* 左转向 */
// *turn_left = (data[1] & 0x01) == 0x01 ? 0 : 1;
// /* 右转向 */
// *turn_right = (data[1] >> 1 & 0x01) == 0x01 ? 0 : 1;
// /* 前门 */
// if ((data[2] & 0x01) == 0x01)
// *door_front = 0;
// if ((data[2] >> 1 & 0x01) == 0x01)
// *door_front = 1;
// /* 中门 */
// if ((data[2] >> 2 & 0x01) == 0x01)
// *door_back = 0;
// if ((data[2] >> 3 & 0x01) == 0x01)
// *door_back = 1;
// break;
//case 0x18F0BA17:
// /* 倒车 */
// *reversing = data[7] == 0xDF ? 0 : 1;
// break;
case 0x18F40117:
/* 左转向 */
*turn_left = (data[1] & 0x01) == 0x01 ? 0 : 1;
*turn_left = (data[1] >> 6 & 0x01) == 0x01 ? 0 : 1;
/* 右转向 */
*turn_right = (data[1] >> 1 & 0x01) == 0x01 ? 0 : 1;
*turn_right = (data[1] >> 7 & 0x01) == 0x01 ? 0 : 1;
/* 前门 */
if ((data[2] & 0x01) == 0x01)
*door_front = 0;
if ((data[2] >> 1 & 0x01) == 0x01)
*door_front = 1;
/* 中门 */
if ((data[2] >> 2 & 0x01) == 0x01)
*door_back = 0;
if ((data[2] >> 3 & 0x01) == 0x01)
*door_back = 1;
*door_front = (data[0] >> 1 & 0x01) == 0x01 ? 0 : 1;
/* 后门 */
*door_back = (data[0] & 0x01) == 0x01 ? 0 : 1;
break;
case 0x18F0BA17:
case 0x18F101D0:
/* 倒车 */
*reversing = data[7] == 0xDF ? 0 : 1;
*reversing = data[3] & 0x07 ? 0 : 1;
break;
}
}

View File

@ -85,6 +85,8 @@ void v58_volume_down(void)
*/
void v58_stop(void)
{
delay_ms(100);
/* 停止 */
v58_send_pulse(1);

View File

@ -2,19 +2,20 @@
#include "can_parsing.h"
#define STROBE_LIGHT_MODE_SETTING_INDEX (0x00)
#define CAN_TYPE_SETTING_INDEX (0x01)
#define STROBE_LIGHT_ENABLE_SETTING_INDEX (0x02)
#define VOLUME_LEVEL_SETTING_INDEX (0x03)
#define STROBE_LIGHT_MODE_SETTING_INDEX (0x00)
#define CAN_TYPE_SETTING_INDEX (0x01)
#define STROBE_LIGHT_ENABLE_SETTING_INDEX (0x02)
#define VOLUME_LEVEL_SETTING_INDEX (0x03)
static uint64_t can_rx_led_timestamp = 0;
static uint64_t diaodu_rx_led_timestamp = 0;
static uint64_t run_led_timestamp = 0;
static uint64_t diaodu_status_rx_timestamp = 0;
static uint8_t vehicle_status_trigger_mode = 0; /* 车辆状态触发方式:0 IO; 1 CAN */
static uint8_t door_front_status = 1, door_front_status_temporary = 1;
static uint8_t door_back_status = 1, door_back_status_temporary = 1;
static uint8_t door_status = 1, door_status_temporary = 2;
static uint8_t door_status = 2, door_status_temporary = 2;
static uint8_t turn_left_status = 1, turn_left_status_temporary = 1;
static uint8_t turn_left_parsing_count = 0; /* 转向接收次数 */
static uint8_t turn_right_status = 1, turn_right_status_temporary = 1;
@ -51,6 +52,8 @@ static uint8_t diaodu_upload_status = 0;
static void strobe_light_reset(void);
/* 频闪灯闪烁*/
static void strobe_light_toggle(uint8_t count);
/* 投影灯控制 */
static void lp_light_write(uint8_t status);
/* 设置音量级别 */
static void set_volume_level(uint8_t level);
@ -88,28 +91,33 @@ void gpio_interrupt_callback(uint32_t pin)
switch (pin)
{
case DOOR_FRONT_PIN:
door_front_status_temporary = gpio_input_bit_get(DOOR_FRONT_PERIPH, DOOR_FRONT_PIN);
door_front_upload_status = 0x01;
vehicle_status_trigger_mode = 0;
door_front_status_temporary = gpio_input_bit_get(DOOR_FRONT_PERIPH, DOOR_FRONT_PIN);
break;
case DOOR_BACK_PIN:
door_back_status_temporary = gpio_input_bit_get(DOOR_BACK_PERIPH, DOOR_BACK_PIN);
door_back_upload_status = 0x01;
vehicle_status_trigger_mode = 0;
door_back_status_temporary = gpio_input_bit_get(DOOR_BACK_PERIPH, DOOR_BACK_PIN);
break;
case TURN_LEFT_PIN:
turn_left_status_temporary = gpio_input_bit_get(TURN_LEFT_PERIPH, TURN_LEFT_PIN);
turn_left_upload_status = 0x01;
vehicle_status_trigger_mode = 0;
turn_left_status_temporary = gpio_input_bit_get(TURN_LEFT_PERIPH, TURN_LEFT_PIN);
break;
case TURN_RIGHT_PIN:
turn_right_status_temporary = gpio_input_bit_get(TURN_RIGHT_PERIPH, TURN_RIGHT_PIN);
turn_right_upload_status = 0x01;
vehicle_status_trigger_mode = 0;
turn_right_status_temporary = gpio_input_bit_get(TURN_RIGHT_PERIPH, TURN_RIGHT_PIN);
break;
case REVERSING_PIN:
reversing_status_temporary = gpio_input_bit_get(REVERSING_PERIPH, REVERSING_PIN);
reversing_upload_status = 0x01;
vehicle_status_trigger_mode = 0;
reversing_status_temporary = gpio_input_bit_get(REVERSING_PERIPH, REVERSING_PIN);
break;
}
}
@ -194,11 +202,14 @@ void app_init(void)
static void strobe_light_reset(void)
{
gpio_bit_write(LED_STROBE_PERIPH, LED_STROBE_PIN, RESET);
/* 恢复投影灯状态 */
lp_light_write(0);
}
static void strobe_light_toggle(uint8_t count)
{
while(count--)
while (count--)
{
gpio_bit_write(LED_STROBE_PERIPH, LED_STROBE_PIN, SET);
delay_ms(100);
@ -207,6 +218,14 @@ static void strobe_light_toggle(uint8_t count)
}
}
static void lp_light_write(uint8_t status)
{
/* 激光投影设备 */
gpio_bit_write(LP_FRONT_DOOR_PERIPH, LP_FRONT_DOOR_PIN, (bit_status)status);
gpio_bit_write(LP_BACK_DOOR_PERIPH, LP_BACK_DOOR_PIN, (bit_status)status);
gpio_bit_write(LP_CAR_REAR_PERIPH, LP_CAR_REAR_PIN, (bit_status)status);
}
static void led_parsing_task(uint8_t uuid)
{
/* 超过 2s 未检测到CAN数据变化熄灭发送指示灯 */
@ -240,11 +259,11 @@ static void set_volume_level(uint8_t level)
strobe_light_flashing_enable = 0x00;
break;
case 0x01:
m62429_set_vol(9);
m62429_set_vol(7);
strobe_light_flashing_enable = 0x01;
break;
case 0x02:
m62429_set_vol(8);
m62429_set_vol(5);
strobe_light_flashing_enable = 0x01;
break;
case 0x03:
@ -348,22 +367,26 @@ static void can_parsing_task(uint8_t uuid)
{
can_channge_status = 1;
door_front_upload_status = 0x01;
vehicle_status_trigger_mode = 1;
}
if (door_back_status_temporary != door_back_status)
{
can_channge_status = 1;
door_back_upload_status = 0x01;
vehicle_status_trigger_mode = 1;
}
if (turn_left_status_temporary != turn_left_status)
{
can_channge_status = 1;
turn_left_upload_status = 0x01;
vehicle_status_trigger_mode = 1;
}
if (turn_right_status_temporary != turn_right_status)
{
vehicle_status_trigger_mode = 1;
can_channge_status = 1;
turn_right_upload_status = 0x01;
}
@ -372,9 +395,10 @@ static void can_parsing_task(uint8_t uuid)
{
can_channge_status = 1;
reversing_upload_status = 0x01;
vehicle_status_trigger_mode = 1;
}
if(can_channge_status == 1)
if (can_channge_status == 1)
{
gpio_bit_write(LED_CAN_PERIPH, LED_CAN_PIN, SET);
can_rx_led_timestamp = timestamp;
@ -396,6 +420,9 @@ static void strobe_light_operate_task(uint8_t uuid)
return;
}
lp_light_write(1);
strobe_light_flashing_count += 1;
if (strobe_light_flashing_mode == 0)
@ -412,7 +439,7 @@ static void strobe_light_operate_task(uint8_t uuid)
else if (strobe_light_flashing_mode == 1)
{
/* 频闪 */
gpio_bit_toggle(LED_STROBE_PERIPH, LED_STROBE_PIN);
gpio_bit_write(LED_STROBE_PERIPH, LED_STROBE_PIN, !(strobe_light_flashing_count % 2));
if (strobe_light_flashing_count >= 4)
{
@ -427,7 +454,8 @@ static void strobe_light_operate_task(uint8_t uuid)
else if (strobe_light_flashing_mode == 2)
{
/* 爆闪 */
gpio_bit_toggle(LED_STROBE_PERIPH, LED_STROBE_PIN);
gpio_bit_write(LED_STROBE_PERIPH, LED_STROBE_PIN, !(strobe_light_flashing_count % 2));
// gpio_bit_toggle(LED_STROBE_PERIPH, LED_STROBE_PIN);
if (strobe_light_flashing_count >= 20)
{
@ -463,6 +491,10 @@ static void vehicle_status_parsing_task(uint8_t uuid)
uint8_t door_change = 0;
/* IO状态下必须保持是实时状态 */
if (vehicle_status_trigger_mode == 0)
reversing_status_temporary = gpio_input_bit_get(REVERSING_PERIPH, REVERSING_PIN);
/* 倒车状态判断 */
if (reversing_status != reversing_status_temporary)
{
@ -474,8 +506,16 @@ static void vehicle_status_parsing_task(uint8_t uuid)
/* 优先级最高, 如果状态为触发, 关闭语音 */
if (reversing_status == 0)
{
v58_stop();
/* 修改系统当前状态 */
diaodu_status = 0xFF;
door_status = 0x01;
turn_left_status = 0x01;
turn_right_status = 0x01;
}
goto EXECUTE;
}
@ -483,54 +523,20 @@ static void vehicle_status_parsing_task(uint8_t uuid)
if (reversing_status == 0)
return;
/* 进出站状态判断 */
if (diaodu_status_temporry != 0 && diaodu_status != diaodu_status_temporry)
/* IO状态下必须保持是实时状态 */
if (vehicle_status_trigger_mode == 0)
{
/* 当前为出站状态, 如果之前是进站状态,则停止播报, 否则不处理 */
if(diaodu_status_temporry == 2)
{
if(diaodu_status == 1)
{
status = 0x00;
status_type = 5;
}
}
/* 到站 */
else if (diaodu_status_temporry == 1)
{
status = 0x01;
status_type = 4;
/* 优先级最高,关闭语音 */
v58_stop();
}
diaodu_status = diaodu_status_temporry;
goto EXECUTE;
door_front_status_temporary = gpio_input_bit_get(DOOR_FRONT_PERIPH, DOOR_FRONT_PIN);
door_back_status_temporary = gpio_input_bit_get(DOOR_BACK_PERIPH, DOOR_BACK_PIN);
}
/* 如果一直处于进站状态, 超过 2 分钟, 则取消该状态, 并停止语音 */
if (diaodu_status == 1)
{
if(diaodu_status_rx_timestamp != 0 &&
timestamp - diaodu_status_rx_timestamp >= 120000)
{
/* 修改为出站状态 */
diaodu_arrival_or_departure_parsing(0x02);
goto EXECUTE;
}
}
if (door_front_status_temporary != door_front_status)
if (door_front_status != door_front_status_temporary)
door_front_status = door_front_status_temporary;
if (door_back_status_temporary != door_back_status)
if (door_back_status != door_back_status_temporary)
door_back_status = door_back_status_temporary;
//door_status_temporary = door_front_status_temporary + door_back_status_temporary;
door_status_temporary = door_front_status_temporary | door_back_status_temporary;
door_status_temporary = door_front_status_temporary & door_back_status_temporary;
if (door_status != door_status_temporary)
{
@ -541,8 +547,8 @@ static void vehicle_status_parsing_task(uint8_t uuid)
status_type = 0;
}
/* 当前后门开启后 */
if(door_status == 0)
/* 当前后门开启后 */
if (door_status == 0)
{
/* 进站状态, 不继续执行 */
if (diaodu_status == 1)
@ -554,20 +560,85 @@ static void vehicle_status_parsing_task(uint8_t uuid)
diaodu_status_temporry = diaodu_status = 0;
}
turn_left_status = 0x01;
turn_right_status = 0x01;
/* 不处理其他数据 */
goto EXECUTE;
}
/* 当前、后车门状态关闭, 才进行调度处理 */
if (door_status == 1)
{
/* 进出站状态判断 */
if (diaodu_status_temporry != 0 && diaodu_status != diaodu_status_temporry)
{
/* 当前为出站状态, 如果之前是进站状态,则停止播报, 否则不处理 */
if (diaodu_status_temporry == 2)
{
if (diaodu_status == 1)
{
status = 0x00;
status_type = 5;
door_status = 0x01;
turn_left_status = 0x01;
turn_right_status = 0x01;
diaodu_status = diaodu_status_temporry;
goto EXECUTE;
}
diaodu_status = diaodu_status_temporry;
return;
}
/* 到站 */
else if (diaodu_status_temporry == 1)
{
status = 0x01;
status_type = 4;
/* 优先级最高,关闭语音 */
v58_stop();
door_status = 0x01;
turn_left_status = 0x01;
turn_right_status = 0x01;
diaodu_status = diaodu_status_temporry;
goto EXECUTE;
}
}
}
/* 如果一直处于进站状态, 超过 2 分钟, 则取消该状态, 并停止语音 */
if (diaodu_status == 1)
{
/* 修改为出站状态 */
if (diaodu_status_rx_timestamp != 0 &&
timestamp - diaodu_status_rx_timestamp >= 120000)
diaodu_arrival_or_departure_parsing(0x02);
return;
}
/* 左转弯状态判断 */
if (turn_left_status != turn_left_status_temporary)
{
/* 如果未触发状态, 需进行二次判断 */
if (turn_left_status_temporary == 1)
/* 只有通过IO接收的数据才需要做脉冲判断 */
if (vehicle_status_trigger_mode == 0)
{
turn_left_parsing_count++;
/* 如果未触发状态, 需进行二次判断 */
if (turn_left_status_temporary == 1)
{
turn_left_parsing_count++;
if (turn_left_parsing_count < 3)
goto TURN_RIGHT_STATUS_TAG2;
if (turn_left_parsing_count < 3)
goto TURN_RIGHT_STATUS_TAG2;
}
}
turn_left_parsing_count = 0;
@ -583,7 +654,7 @@ static void vehicle_status_parsing_task(uint8_t uuid)
status_type = 1;
//printf("left status = %d \r\n", status);
// printf("left status = %d \r\n", status);
goto EXECUTE;
}
@ -593,13 +664,17 @@ TURN_RIGHT_STATUS_TAG2:
/* 右转弯状态判断 */
if (turn_right_status != turn_right_status_temporary)
{
/* 如果未触发状态, 需进行二次判断 */
if (turn_right_status_temporary == 1)
/* 只有通过IO接收的数据才需要做脉冲判断 */
if (vehicle_status_trigger_mode == 0)
{
turn_right_parsing_count++;
/* 如果未触发状态, 需进行二次判断 */
if (turn_right_status_temporary == 1)
{
turn_right_parsing_count++;
if (turn_right_parsing_count < 3)
goto EXECUTE;
if (turn_right_parsing_count < 3)
goto EXECUTE;
}
}
turn_right_parsing_count = 0;
@ -610,12 +685,12 @@ TURN_RIGHT_STATUS_TAG2:
else
{
turn_right_status = turn_right_status_temporary;
status = turn_right_status == 0 ? 1 : 0;
status_type = 2;
//printf("right status = %d \r\n", status);
// printf("right status = %d \r\n", status);
goto EXECUTE;
}
@ -628,7 +703,7 @@ TURN_RIGHT_STATUS_TAG2:
if (emergency_flashers_status != emergency_flashers_status_temporary)
{
emergency_flashers_status = emergency_flashers_status_temporary;
if (emergency_flashers_status_temporary == 0)
{
/* 挂起 频闪灯控制任务 */
@ -644,9 +719,9 @@ TURN_RIGHT_STATUS_TAG2:
task_resume(emergency_flashers_operate_task_uuid);
#if defined(USE_AK517)
ak517_please_note_that();
ak517_please_note_that();
#elif defined(USE_QGEL50X)
qgel50x_please_note_that();
qgel50x_please_note_that();
#endif
}
else if (emergency_flashers_status_temporary == 1)
@ -789,26 +864,6 @@ void diaodu_arrival_or_departure_parsing(uint8_t status)
gpio_bit_write(LED_DIAODU_PERIPH, LED_DIAODU_PIN, SET);
}
//void ir_key_triggered(uint8_t key)
//{
// uint8_t level = 0x00;
// if (key == 0x98) /* + */
// level = volume_level - 1;
// else if (key == 0x68) /* - */
// level = volume_level + 1;
// else if(key == 0xA2)
// level = 3;
// else
// return;
// strobe_light_toggle(2);
// set_volume_level(level);
// api_upload_data_forwarding(0x06, level);
//}
void api_notify_data_upload(uint8_t *buffer, uint16_t length)
{
led_tx_update();
@ -909,8 +964,7 @@ void api_notify_data_forwarding(uint8_t type, uint8_t value)
break;
case 0x05:
diaodu_upload_status = 0x01;
diaodu_status_temporry = value;
diaodu_arrival_or_departure_parsing(value);
break;
case 0x06:

View File

@ -1,5 +1,7 @@
#include "main.h"
static uint32_t can_filter_id[9] = {0x18FED925, 0x18F00503, 0x18FDA589, 0x18FE419B, 0x18F00503, 0x18A70017, 0x18F40117, 0x18F101D0, 0x18FFD117};
static void bsp_initialization(void);
int main(void)
@ -26,6 +28,9 @@ static void bsp_initialization(void)
/* CAN0 初始化, 波特率250 */
can_config(CAN0, 250);
/* CAN0 设置过滤 (允许列表ID通过) */
can_set_filter_by_id(CAN0, can_filter_id, 9);
/* 上位机 通讯串口 初始化 */
usart_config(HOST_USART_PERIPH, 115200, USART_PM_NONE);
@ -44,21 +49,13 @@ static void bsp_initialization(void)
gpio_config(VOLUME_3_PERIPH, VOLUME_3_PIN, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, nullptr);
gpio_config(VOLUME_4_PERIPH, VOLUME_4_PIN, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, nullptr);
/* 前门 检测引脚 初始化 */
/* 前门 后门 左转弯 右转弯 倒车 检测引脚 初始化 */
gpio_interrupt_config(DOOR_FRONT_PERIPH, DOOR_FRONT_PIN, EXTI_TRIG_BOTH);
/* 后门 检测引脚 初始化 */
gpio_interrupt_config(DOOR_BACK_PERIPH, DOOR_BACK_PIN, EXTI_TRIG_BOTH);
/* 左转弯 检测引脚 初始化 */
gpio_interrupt_config(TURN_LEFT_PERIPH, TURN_LEFT_PIN, EXTI_TRIG_BOTH);
/* 右转弯 检测引脚 初始化 */
gpio_interrupt_config(TURN_RIGHT_PERIPH, TURN_RIGHT_PIN, EXTI_TRIG_BOTH);
/* 倒车 检测引脚 初始化 */
gpio_interrupt_config(REVERSING_PERIPH, REVERSING_PIN, EXTI_TRIG_BOTH);
/* 功放控制脚,默认开启 */
gpio_config(AMP_CTRL_PERIPH, AMP_CTRL_PIN, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SET);
@ -69,7 +66,13 @@ static void bsp_initialization(void)
gpio_config(V58_STATUS_PERIPH, V58_STATUS_PIN, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, nullptr);
iic_config(M62429_SDA_PERIPH, M62429_SDA_PIN, M62429_SCL_PERIPH, M62429_SCL_PIN);
/* 激光投影设备 控制引脚 初始化 */
gpio_config(LP_FRONT_DOOR_PERIPH, LP_FRONT_DOOR_PIN, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, RESET);
gpio_config(LP_BACK_DOOR_PERIPH, LP_BACK_DOOR_PIN, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, RESET);
gpio_config(LP_CAR_REAR_PERIPH, LP_CAR_REAR_PIN, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, RESET);
/* CAN指示灯 控制引脚 初始化 */
gpio_config(LED_CAN_PERIPH, LED_CAN_PIN, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, RESET);

View File

@ -104,6 +104,18 @@
#define M62429_SDA_PERIPH GPIOB
#define M62429_SDA_PIN GPIO_PIN_11
/* 激光投影设备(前门) */
#define LP_FRONT_DOOR_PERIPH GPIOC
#define LP_FRONT_DOOR_PIN GPIO_PIN_13
/* 激光投影设备(后门) */
#define LP_BACK_DOOR_PERIPH GPIOC
#define LP_BACK_DOOR_PIN GPIO_PIN_14
/* 激光投影设备(车尾) */
#define LP_CAR_REAR_PERIPH GPIOC
#define LP_CAR_REAR_PIN GPIO_PIN_15
#define LED_CAN_PERIPH GPIOA
#define LED_CAN_PIN GPIO_PIN_5