Commit 8845d9d0 authored by martin hou's avatar martin hou

Merge branch 'v20250816' into device-mgr

parents c79c5e7a 9cd8e9da
...@@ -106,6 +106,7 @@ function Jensen(log, conn) { ...@@ -106,6 +106,7 @@ function Jensen(log, conn) {
this.sleepChecker = null; this.sleepChecker = null;
this.lastTimerInvoked = new Date().getTime(); this.lastTimerInvoked = new Date().getTime();
this.wakeupTime = null;
const RECV_BUFF_SIZE = 512000; const RECV_BUFF_SIZE = 512000;
...@@ -177,11 +178,19 @@ function Jensen(log, conn) { ...@@ -177,11 +178,19 @@ function Jensen(log, conn) {
let now = new Date().getTime(); let now = new Date().getTime();
if (now - self.lastTimerInvoked > 6000) if (now - self.lastTimerInvoked > 6000)
{ {
if (typeof(self.onwakeup) == 'function') self.onwakeup(); // 应该要连续多次5秒的间隔才能算从休眠中恢复
// 这个状态很可能只是一次临时唤醒,我需要更准确的彻底恢复
if (typeof(self.onwakeup) == 'function')
{
setTimeout(function() {
let currentTime = new Date().getTime();
if (currentTime - self.wakeupTime < 200) self.onwakeup();
}, 100);
self.wakeupTime = now;
}
} }
self.lastTimerInvoked = now; self.lastTimerInvoked = now;
}, 5000); }, 5000);
console.log('休眠检测准备完毕');
}; };
this.initialize = async function() { this.initialize = async function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment