optimize timemaster first start of day
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -8,6 +8,7 @@ class TimemasterAction extends ActionBase {
|
||||
this.reconnectTimer = null;
|
||||
this.connected = false;
|
||||
this.handshakeDone = false;
|
||||
this.dataReceived = false;
|
||||
this.isError = false;
|
||||
this.errorText = null;
|
||||
this.noServer = false;
|
||||
@@ -111,6 +112,7 @@ class TimemasterAction extends ActionBase {
|
||||
}
|
||||
this.connected = false;
|
||||
this.handshakeDone = false;
|
||||
this.dataReceived = false;
|
||||
}
|
||||
|
||||
host() {
|
||||
@@ -286,7 +288,7 @@ class TimemasterAction extends ActionBase {
|
||||
|
||||
if (msg.type === 1 && Array.isArray(msg.arguments)) {
|
||||
if (msg.target === 'Info.UpdateLastWorkingHours') {
|
||||
console.log(`[Timemaster] ${msg.target}:`, JSON.stringify(msg.arguments).slice(0, 200));
|
||||
this.dataReceived = true;
|
||||
for (const arg of msg.arguments) {
|
||||
this.parseWorkingHours(arg);
|
||||
}
|
||||
@@ -462,7 +464,7 @@ class TimemasterAction extends ActionBase {
|
||||
if (this.noServer) {
|
||||
ctx.fillStyle = '#ff6b6b';
|
||||
ctx.font = 'bold 22px "Source Han Sans SC"';
|
||||
ctx.fillText('VPN?', cx, cy - 10);
|
||||
ctx.fillText(this.$UD.t('VPN?'), cx, cy - 10);
|
||||
ctx.fillStyle = '#888888';
|
||||
ctx.font = '16px "Source Han Sans SC"';
|
||||
ctx.fillText(this.$UD.t('No Host'), cx, cy + 16);
|
||||
@@ -476,10 +478,14 @@ class TimemasterAction extends ActionBase {
|
||||
cx, cy
|
||||
);
|
||||
}
|
||||
} else {
|
||||
} else if (this.dataReceived) {
|
||||
ctx.fillStyle = '#666666';
|
||||
ctx.font = 'bold 44px "Source Han Sans SC"';
|
||||
ctx.fillText('00:00', cx, cy);
|
||||
} else {
|
||||
ctx.fillStyle = '#444444';
|
||||
ctx.font = 'bold 22px "Source Han Sans SC"';
|
||||
ctx.fillText('Warten…', cx, cy);
|
||||
ctx.fillText(this.$UD.t('Waiting…'), cx, cy);
|
||||
}
|
||||
|
||||
// Bottom label
|
||||
|
||||
Reference in New Issue
Block a user