From: xue <2144439972@qq.com> Date: Tue, 13 Jan 2026 09:31:06 +0000 (+0800) Subject: 定时刷新常亮屏函数 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=539f6486b5b5e6570ae72016e13281307c040d97;p=mirrors%2FFD230.git 定时刷新常亮屏函数 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index 4b6c8c958..e8eb5935b 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -42,6 +42,10 @@ namespace OHOS void StopCountUpTimer(void); int GetCountUpValue() const; + // 常亮屏刷新定时器(用于压测模式,每50分钟刷新一次,避免1小时超时) + void StartAlwaysOnRefreshTimer(); + void StopAlwaysOnRefreshTimer(); + // 故事模式超时定时器(1分钟无文本切换则退出) void StartStoryModeTimeoutTimer(void); void StopStoryModeTimeoutTimer(void); @@ -380,6 +384,8 @@ namespace OHOS bool m_countUpActive; // 计数定时器是否激活 int m_countUpValue; // 当前计数值 int m_countUpTarget; // 计数目标值 + bool m_alwaysOnRefreshActive; // 常亮屏刷新定时器是否激活 + uint32_t m_alwaysOnRefreshTime; // 常亮屏刷新剩余时间(秒) uint32_t m_currentFps; // 当前帧率 // IMEI状态管理 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index 85a58ae9f..bd95bdd0f 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -119,6 +119,7 @@ extern "C" { m_reminderHideActive(false), m_reminderHideTime(0), m_otaCountdownActive(false), m_otaCountdownValue(0), m_countUpActive(false), m_countUpValue(0), m_countUpTarget(0), + m_alwaysOnRefreshActive(false), m_alwaysOnRefreshTime(0), m_currentFps(60), m_simStatus(0), m_cat1PowerStatus(0), m_signalStrength(0), m_networkStatus(0), m_networkType(0), @@ -1512,6 +1513,17 @@ extern "C" { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TimeDisplayCallback: %s", currentTime.c_str()); } + // 处理常亮屏刷新定时器(每50分钟刷新一次,避免1小时超时) + if (m_alwaysOnRefreshActive) { + m_alwaysOnRefreshTime++; + // 50分钟 = 3000秒 + if (m_alwaysOnRefreshTime >= 3000) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TimeDisplayCallback: Refreshing screen always-on (50 minutes elapsed)"); + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + m_alwaysOnRefreshTime = 0; // 重置计数器 + } + } + // 处理提醒隐藏定时器 if (m_reminderHideActive) { if (m_reminderHideTime > 0) { @@ -2986,11 +2998,11 @@ extern "C" { ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING); } - // 3. 设置常亮屏 + // 3. 设置常亮屏(在ChangeView之后设置,确保不会被视图切换逻辑覆盖) ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); - // 4. 循环播放 FactoryMode.mp3(使用 ln_audio_simple_play_loop,支持循环播放,无需线程) - // 音量由按键直接控制(AUDIO_STREAM_VOICE_ASSISTANT),无需手动设置 + StartAlwaysOnRefreshTimer(); + const char *factory_mode_file = "/user/res/music/FactoryMode.mp3"; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleJumpDialogueSpeaking: Playing file: %s (will loop)", factory_mode_file); @@ -3002,6 +3014,26 @@ extern "C" { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleJumpDialogueSpeaking: Successfully started loop playback"); } } + + void ThunderBirdModel::StartAlwaysOnRefreshTimer() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartAlwaysOnRefreshTimer: Starting periodic refresh (every 50 minutes)"); + m_alwaysOnRefreshActive = true; + m_alwaysOnRefreshTime = 0; // 从0开始计数,每50分钟(3000秒)刷新一次 + + // 确保时间显示定时器正在运行(用于定期检查) + if (m_timeDisplayTimer == nullptr) { + StartTimeDisplayTimer(1000); // 1秒间隔 + } + } + + void ThunderBirdModel::StopAlwaysOnRefreshTimer() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StopAlwaysOnRefreshTimer"); + m_alwaysOnRefreshActive = false; + m_alwaysOnRefreshTime = 0; + } + void ThunderBirdModel::HandleBluetoothConnect(const char *bluetoothAddress) { auto* mainView = ThunderBirdMainView::GetInstance();