提交一下

This commit is contained in:
RB 2025-04-27 15:05:15 +08:00
parent 453c64690a
commit 92c6bbf189
4 changed files with 27 additions and 25 deletions

View File

@ -151,6 +151,7 @@ class MRobotApp:
except Exception as e:
print(f"创建目录时出错: {e}")
# 更新 FreeRTOS 状态标签
def update_freertos_status(self, label):
if self.ioc_data:
@ -199,7 +200,8 @@ class MRobotApp:
self.header_files_frame = header_files_frame
self.update_header_files()
# 任务管理框
if self.ioc_data and self.check_freertos_enabled(self.ioc_data):
task_frame = tk.LabelFrame(module_task_frame, text="任务管理", padx=10, pady=10, font=("Arial", 10, "bold"))
task_frame.pack(side="left", fill="both", expand=True, padx=5)
self.task_frame = task_frame
@ -476,17 +478,21 @@ class MRobotApp:
print(f"生成 init.c 文件时出错: {e}")
# 修改 generate_action 方法
def generate_action(self):
def task():
# 检查并创建目录
# 检查并创建目录(与 FreeRTOS 状态无关的模块始终创建)
self.create_directories()
# 复制 .gitignore 文件
if self.add_gitignore_var.get():
self.copy_file_from_repo(".gitignore", ".gitignore")
# 如果启用了 FreeRTOS复制相关文件
if self.ioc_data and self.check_freertos_enabled(self.ioc_data):
self.copy_file_from_repo("src/freertos.c", os.path.join("Core", "Src", "freertos.c"))
# 定义需要处理的文件夹
# 定义需要处理的文件夹(与 FreeRTOS 状态无关)
folders = ["bsp", "component", "device", "module"]
# 遍历每个文件夹,复制选中的 .h 和 .c 文件
@ -514,6 +520,8 @@ class MRobotApp:
dest_path = os.path.join("User", folder, file_name)
self.copy_file_from_repo(src_path, dest_path)
# 如果启用了 FreeRTOS执行任务相关的生成逻辑
if self.ioc_data and self.check_freertos_enabled(self.ioc_data):
# 修改 user_task.c 文件
self.modify_user_task_file()
@ -528,6 +536,7 @@ class MRobotApp:
threading.Thread(target=task).start()
# 程序关闭时清理
def on_closing(self, root):
self.delete_repo()

View File

@ -27,9 +27,6 @@ void {{task_function}}(void *argument) {
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
while (1) {
/* 记录任务所使用的的栈空间 */
task_runtime.stack_water_mark.{{task_variable}} = osThreadGetStackSpace(osThreadGetId());
tick += delay_tick; /* 计算下一个唤醒时刻 */
/*User code begin*/

View File

@ -19,10 +19,6 @@ typedef struct {
osMessageQueueId_t user_msg; /* 用户自定义任务消息队列 */
} msgq;
struct {
{{heap_water_mark_definitions}}
} heap_water_mark; /* heap使用 */
struct {
{{freq_definitions}}
} freq; /* 任务运行频率 */