修复4号命令不能重复执行的bug
This commit is contained in:
		@@ -335,6 +335,8 @@ static void controlTask(void *arg)
 | 
				
			|||||||
                    printf("Displaying text: %s\r\n", g_current_command.text);
 | 
					                    printf("Displaying text: %s\r\n", g_current_command.text);
 | 
				
			||||||
                    DisplayMixedString(0, 0, g_current_command.text);
 | 
					                    DisplayMixedString(0, 0, g_current_command.text);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                display_timer = 2;  // 设置2秒计时器
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 兼容旧命令的处理逻辑(只有在非JSON命令时才执行)
 | 
					            // 兼容旧命令的处理逻辑(只有在非JSON命令时才执行)
 | 
				
			||||||
            else if(control_flag == 0 && g_current_command.cmd == 0)  // 兼容旧命令:关闭
 | 
					            else if(control_flag == 0 && g_current_command.cmd == 0)  // 兼容旧命令:关闭
 | 
				
			||||||
@@ -388,6 +390,20 @@ static void controlTask(void *arg)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 处理命令4的2秒计时器
 | 
				
			||||||
 | 
					        if(control_flag == CMD_DISPLAY_ONLY && display_timer > 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            display_timer--;
 | 
				
			||||||
 | 
					            if(display_timer == 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                printf("2 seconds elapsed, clearing screen for command 4\r\n");
 | 
				
			||||||
 | 
					                // 清屏
 | 
				
			||||||
 | 
					                OledClearScreen();
 | 
				
			||||||
 | 
					                // 重置控制标志,使其能够响应下一个命令4
 | 
				
			||||||
 | 
					                control_flag = 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 兼容旧的计时逻辑
 | 
					        // 兼容旧的计时逻辑
 | 
				
			||||||
        if(control_flag == 2 && g_current_command.cmd == 0)
 | 
					        if(control_flag == 2 && g_current_command.cmd == 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user