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 b7d1a3ced..847f5ce27 100644 --- a/src/app/printer.service.ts +++ b/src/app/printer.service.ts @@ -58,6 +58,19 @@ export class PrinterService { ); } }); + } 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})`,