Adds KEY_EVENT_SECOND_TICK, generated once per real second from Clock_IncMS() via a new second_tick_flag and pushed through the normal event queue, so every foreground App's onEvent() receives it and decides independently whether to act. Removes the old global inactivity_timer (60s sleep from anywhere) entirely. HomeApp now accumulates its own idle-second counter and sleeps after 10s idle specifically while on the home screen; MenuApp's existing 10s auto-close is converted from onRun() polling to the same tick+reset pattern for consistency. Any non-tick key event resets each app's own counter to 0.
19 lines
452 B
C
19 lines
452 B
C
#ifndef __CLOCK_H__
|
||
#define __CLOCK_H__
|
||
|
||
#include "config.h"
|
||
|
||
// 全局软时钟变量声明
|
||
extern u8 current_hour;
|
||
extern u8 current_min;
|
||
extern u8 current_sec;
|
||
extern volatile u8 clock_updated;
|
||
extern volatile bit second_tick_flag; // 整秒滴答标志位,每次 current_sec 递增时置 1,供主循环转换为事件
|
||
|
||
/**
|
||
* @brief 系统软时钟毫秒递增更新 (在 1ms 中断中调用)
|
||
*/
|
||
void Clock_IncMS(void);
|
||
|
||
#endif // __CLOCK_H__
|