From 8deee98ad1c94f59ebc42d292ad7160e0d7112fd Mon Sep 17 00:00:00 2001 From: Harley Glossop Date: Thu, 2 Apr 2020 22:31:35 +0100 Subject: [PATCH 1/4] Go into standby if unable to contact OctoPrint --- src/app/printer.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/printer.service.ts b/src/app/printer.service.ts index b7d1a3ced..451c9f910 100644 --- a/src/app/printer.service.ts +++ b/src/app/printer.service.ts @@ -58,6 +58,9 @@ export class PrinterService { ); } }); + } else if (error.status === 0) { + this.router.navigate(['/standby']); + this.notificationService.disableNotifications(); } else { const printerStatus: PrinterStatusAPI = { status: `error (${error.status})`, From 7d6ccf771459b60860dd81acf262dec4a25a6ca7 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Fri, 3 Apr 2020 19:09:05 +0200 Subject: [PATCH 2/4] test --- tmp.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tmp.txt diff --git a/tmp.txt b/tmp.txt new file mode 100644 index 000000000..e69de29bb From c82405c7de217893da9caca80e510dfa59e9d8e6 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Fri, 3 Apr 2020 19:41:26 +0200 Subject: [PATCH 3/4] introduce boot grace time --- src/app/notification/notification.service.ts | 10 +++++++++- src/app/printer.service.ts | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/app/notification/notification.service.ts b/src/app/notification/notification.service.ts index 534faa3e9..1b8fd480c 100644 --- a/src/app/notification/notification.service.ts +++ b/src/app/notification/notification.service.ts @@ -9,10 +9,14 @@ export class NotificationService { private observable: Observable; private observer: Observer; private hideNotifications = false; + private bootGrace = true; public constructor() { this.observable = new Observable((observer: Observer): void => { this.observer = observer; + setTimeout((): void => { + this.bootGrace = false; + }, 30000); }).pipe(shareReplay(1)); } @@ -27,7 +31,7 @@ export class NotificationService { } public setError(heading: string, text: string): void { - if (!this.hideNotifications) { + if ((!this.hideNotifications && !this.bootGrace) || (this.bootGrace && !text.endsWith('0 Unknown Error'))) { this.observer.next({ heading, text, type: 'error' }); } } @@ -45,6 +49,10 @@ export class NotificationService { public getObservable(): Observable { return this.observable; } + + public getBootGrace(): boolean { + return this.bootGrace; + } } export interface Notification { diff --git a/src/app/printer.service.ts b/src/app/printer.service.ts index 451c9f910..847f5ce27 100644 --- a/src/app/printer.service.ts +++ b/src/app/printer.service.ts @@ -58,9 +58,19 @@ export class PrinterService { ); } }); - } else if (error.status === 0) { - this.router.navigate(['/standby']); - this.notificationService.disableNotifications(); + } else if (error.status === 0 && this.notificationService.getBootGrace()) { + const printerStatus: PrinterStatusAPI = { + status: `connecting ...`, + nozzle: { + current: 0, + set: 0, + }, + heatbed: { + current: 0, + set: 0, + }, + }; + observer.next(printerStatus); } else { const printerStatus: PrinterStatusAPI = { status: `error (${error.status})`, From c343a65dccf6ca9fcd03287e4a636069c75b2b70 Mon Sep 17 00:00:00 2001 From: UnchartedBull Date: Tue, 7 Apr 2020 11:40:03 +0200 Subject: [PATCH 4/4] delete tmp.txt --- tmp.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tmp.txt diff --git a/tmp.txt b/tmp.txt deleted file mode 100644 index e69de29bb..000000000