From 9eb8231c415e82a34b9a55188288fa2215e7c778 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 3 Jun 2024 13:13:40 +0800 Subject: [PATCH] update --- .vscode | 2 +- .../FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c | 2 +- .../FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h | 2 +- a8000_protocol | 2 +- encode_convert.bat | 22 ++++++++++++++++++++++ sdk | 2 +- usrc/main.cpp | 4 ++-- usrc/project_configs.h | 10 +++++----- usrc/public_service/common_hardware_init.c | 10 +++++----- .../subboard30_shake_module.cpp | 22 ++++++++++++---------- 10 files changed, 51 insertions(+), 27 deletions(-) create mode 100644 encode_convert.bat diff --git a/.vscode b/.vscode index ef748d9..13b0860 160000 --- a/.vscode +++ b/.vscode @@ -1 +1 @@ -Subproject commit ef748d9d2b722efecc06364d13cbc76a8dd23c92 +Subproject commit 13b086073e8e162b38e929b9ef54f84c5425db0a diff --git a/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c b/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c index 89c3633..7537718 100644 --- a/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c +++ b/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c @@ -26,7 +26,7 @@ * *---------------------------------------------------------------------------- * - * Portions Copyright 2016 STMicroelectronics International N.V. All rights reserved. + * Portions Copyright ?2016 STMicroelectronics International N.V. All rights reserved. * Portions Copyright (c) 2013 ARM LIMITED * All rights reserved. * Redistribution and use in source and binary forms, with or without diff --git a/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h b/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h index f53a132..2db20c5 100644 --- a/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h +++ b/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h @@ -26,7 +26,7 @@ * *---------------------------------------------------------------------------- * - * Portions Copyright 2016 STMicroelectronics International N.V. All rights reserved. + * Portions Copyright ?2016 STMicroelectronics International N.V. All rights reserved. * Portions Copyright (c) 2013 ARM LIMITED * All rights reserved. * Redistribution and use in source and binary forms, with or without diff --git a/a8000_protocol b/a8000_protocol index f9b196b..232ed7c 160000 --- a/a8000_protocol +++ b/a8000_protocol @@ -1 +1 @@ -Subproject commit f9b196b0c9c7b54739212c0c84bcfc60f84cc8bd +Subproject commit 232ed7c739e2ee86fe127f6364648a0d50378391 diff --git a/encode_convert.bat b/encode_convert.bat new file mode 100644 index 0000000..601e864 --- /dev/null +++ b/encode_convert.bat @@ -0,0 +1,22 @@ +@echo off +title Encoding Converter + +REM 指定的一种文件类型(只支持一类) +set fileType=*.h + +REM 是否遍历子目录:需要遍历则设置为:-Recurse,否则置为空 +REM set isRecurse= +set isRecurse=-Recurse + +REM 转换前的文件编码(可以随便填一个,程序自动判断) +set fromEnc=GBK + +REM 转换后的文件编码 +set toEnc=UTF-8 + +REM 转换后的文件名前缀,默认与转换的文件在同一目录,可以为空(如果为空则直接覆盖原文件) +REM set prefix= +set prefix= + +powershell.exe -command "$files = dir %fileType% %isRecurse%; $prefix = '%prefix%'; $from = '%fromEnc%'; $to = '%toEnc%'; $e = [System.Text.Encoding]; $sr = [System.IO.StreamReader]; $sw = [System.IO.StreamWriter]; $isSame=[string]::IsNullOrEmpty($prefix); function getEnc($encName){if('UTF-8' -eq $encName.ToUpper()){return [System.Text.UTF8Encoding]::new($false);}return [System.Text.Encoding]::GetEncoding($encName); }; function getFileEnc($data) {[object[]]$res = @([System.Text.Encoding]::Default,$false);if($data[0] -eq 0x2B -and $data[1] -eq 0x2F -and $data[2] -eq 0x76) { return @([System.Text.Encoding]::UTF7,$true);}elseif($data[0] -eq 0xEF -and $data[1] -eq 0xBB -and $data[2] -eq 0xBF) { return @([System.Text.Encoding]::UTF8,$true);}elseif($data[0] -eq 0xFF -and $data[1] -eq 0xFE) { return @([System.Text.Encoding]::Unicode,$true);}elseif($data[0] -eq 0xFE -and $data[1] -eq 0xFF) { return @([System.Text.Encoding]::BigEndianUnicode,$true);}elseif($data[0] -eq 0 -and $data[1] -eq 0 -and $data[2] -eq 0xFE -and $data[3] -eq 0xFF) { return @([System.Text.Encoding]::UTF32,$true);}else{ [int]$charByteCounter = 1; [byte]$curByte = 0; for ($i = 0; $i -lt $data.Length; $i++) {$curByte = $data[$i];if ($charByteCounter -eq 1){if ($curByte -ge 0x80){ while (( ($curByte = ($curByte -shl 1)) -band 0x80) -ne 0) {$charByteCounter++; } if ($charByteCounter -eq 1 -or $charByteCounter -gt 6) {return $res; }}}else{if (($curByte -band 0xC0) -ne 0x80){ return $res;}$charByteCounter--;} } if ($charByteCounter -gt 1) {return $res; } return @([System.Text.Encoding]::UTF8,$false);}}; if($files.Count -lt 1){Write-Host 'No Files...';exit; }; Write-Host ('Begin:'+(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')); foreach($file in $files){ $newFile = (Join-Path -Path $file.DirectoryName -ChildPath ($prefix+$file.BaseName+$file.Extension)); if($isSame){ $newFile = (Join-Path -Path $file.DirectoryName -ChildPath ('TEMP_'+$file.BaseName+$file.Extension));}; $fromEnc = (getEnc -encName $from); $toEnc = (getEnc -encName $to); $fileEnc = (getFileEnc -data ([System.IO.File]::ReadAllBytes($file.FullName))); if($fileEnc[0].BodyName -eq $toEnc.BodyName -and $fileEnc[1] -eq $false){ Write-Host ($file.FullName+',no need to convert.'); continue; } if($fromEnc -ne $fileEnc[0]){ Write-Host ($file.FullName+',encoding should be:' + $fileEnc[0].BodyName); $fromEnc = (getEnc -encName $fileEnc[0].BodyName); } $srIn = $sr::new($file.FullName,$fromEnc); $swOut = $sw::new($newFile,$false,$toEnc,4096); while(($line = $srIn.ReadLine()) -ne $null){$swOut.WriteLine($line);} $srIn.Close();$swOut.Flush();$swOut.Close(); if($isSame){Move-Item -Path $newFile -Destination $file -Force};}; Write-Host ('Files:'+$files.Count+',success...'); Write-Host ('End:'+(Get-Date -Format 'yyyy-MM-dd HH:mm:ss'));" +pause \ No newline at end of file diff --git a/sdk b/sdk index 1908f8a..faf6a7e 160000 --- a/sdk +++ b/sdk @@ -1 +1 @@ -Subproject commit 1908f8afec32ebb6009e3d43b6306572c8cb9c7e +Subproject commit faf6a7ee02b3b4d2efa1231430a64ed982ac0f84 diff --git a/usrc/main.cpp b/usrc/main.cpp index b32af1c..b2db067 100644 --- a/usrc/main.cpp +++ b/usrc/main.cpp @@ -18,7 +18,7 @@ void StartDefaultTask(void const* argument) { umain(); } void umain() { int32_t id = zdevice_id_mgr_get_device_id(); switch (id) { - case 30: // ҡģ + case 30: // 摇匀模组 subboard30_shake_module_board_init(); break; default: @@ -55,7 +55,7 @@ void umain() { GService::inst()->initialize(); switch (id) { - case 30: // ҡģ + case 30: // 摇匀模组 Subboard30ShakeModule::ins()->initialize(); break; diff --git a/usrc/project_configs.h b/usrc/project_configs.h index c69e6b2..2027443 100644 --- a/usrc/project_configs.h +++ b/usrc/project_configs.h @@ -9,9 +9,9 @@ #define PC_DEBUG_UART_RX_BUF_SIZE 1024 #define PC_DEBUG_LIGHT_GPIO PE2 -#define PC_SYS_DELAY_US_TIMER htim6 // USʱʱ -#define PC_SYS_ZTICKET_TIMER TIM11 // ϵͳticketʱ -#define PC_SYS_TIM_IRQ_SCHEDULER_TIMER htim7 // ж϶ʱжϵ +#define PC_SYS_DELAY_US_TIMER htim6 // US延时定时器 +#define PC_SYS_ZTICKET_TIMER TIM11 // 系统ticket定时器 +#define PC_SYS_TIM_IRQ_SCHEDULER_TIMER htim7 // 中断定时器中断调度器 #define PC_IRQ_PREEMPTPRIORITY_DEFAULT 5 @@ -38,5 +38,5 @@ * 10 0x080C0000 128k * 11 0x080E0000 128k */ -#define SN_FLASH_ADD 0x080E0000 // ʹ11洢SN -#define SN_FLASH_EARSE_SECTOR FLASH_SECTOR_11 \ No newline at end of file +#define SN_FLASH_ADD 0x080E0000 // 使用扇区11存储SN编码 +#define SN_FLASH_EARSE_SECTOR FLASH_SECTOR_11 diff --git a/usrc/public_service/common_hardware_init.c b/usrc/public_service/common_hardware_init.c index d3099e2..178d2fe 100644 --- a/usrc/public_service/common_hardware_init.c +++ b/usrc/public_service/common_hardware_init.c @@ -56,7 +56,7 @@ static void debug_uart_init() { GPIO_InitTypeDef GPIO_InitStruct = {0}; /*********************************************************************************************************************** - * IOʼ * + * IO初始化 * ***********************************************************************************************************************/ __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); @@ -82,7 +82,7 @@ static void debug_uart_init() { } /*********************************************************************************************************************** - * DMAʼ * + * DMA初始化 * ***********************************************************************************************************************/ HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 5, 0); HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn); @@ -150,18 +150,18 @@ static void can1_init() { void common_hardware_init() { /*********************************************************************************************************************** - * ϵͳʱʼ * + * 系统定时器初始化 * ***********************************************************************************************************************/ { MX_TIM6_Init(); MX_TIM7_Init(); } /*********************************************************************************************************************** - * Դڳʼ * + * 调试串口初始化 * ***********************************************************************************************************************/ debug_uart_init(); /*********************************************************************************************************************** - * CANʼ * + * CAN初始化 * ***********************************************************************************************************************/ can1_init(); } diff --git a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp index a9d28cd..69071fb 100644 --- a/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp +++ b/usrc/subboards/subboard30_shake_module/subboard30_shake_module.cpp @@ -2,6 +2,8 @@ extern "C" { #include "subboard30_shake_module_board.h" } +#include "sdk\components\step_motor_ctrl_module\step_motor_ctrl_module.hpp" +#include "public_service/public_service.hpp" #define TAG "ShakeModule" @@ -29,7 +31,7 @@ int32_t Subboard30ShakeModule::board_write_io(int32_t ioindex, int32_t val) { re void Subboard30ShakeModule::initialize() { -#if 0 +#if 1 /*********************************************************************************************************************** * ID1 * @@ -52,11 +54,11 @@ void Subboard30ShakeModule::initialize() { input[0].initAsInput(MOTOR1_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); input[1].initAsInput(MOTOR1_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - StepMotorCtrlModule::flash_config_t stepcfg = {0}; + StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.base_param.stepmotor_irun = 15; + stepcfg.stepmotor_irun = 15; - module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg); + module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion()); @@ -82,11 +84,11 @@ void Subboard30ShakeModule::initialize() { input[0].initAsInput(MOTOR2_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); input[1].initAsInput(MOTOR2_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - StepMotorCtrlModule::flash_config_t stepcfg = {0}; + StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.base_param.stepmotor_irun = 15; + stepcfg.stepmotor_irun = 15; - module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg); + module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion()); } @@ -111,11 +113,11 @@ void Subboard30ShakeModule::initialize() { input[0].initAsInput(MOTOR3_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); input[1].initAsInput(MOTOR3_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); - StepMotorCtrlModule::flash_config_t stepcfg = {0}; + StepMotorCtrlModule::config_t stepcfg = {0}; StepMotorCtrlModule::create_default_cfg(stepcfg); - stepcfg.base_param.stepmotor_irun = 15; + stepcfg.stepmotor_irun = 15; - module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), nullptr, &stepcfg); + module.initialize(getmoduleId(subid), &motor, input, ZARRAY_SIZE(input), &stepcfg); GService::inst()->getZCanProtocolParser()->registerModule(&module); ZLOGI(TAG, "motor%d readic version %x", subid, motor.readICVersion()); }