From edbb03e9b31d06901c4bbb04d98c0c27ca3e25c4 Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Thu, 18 May 2023 23:40:06 +0200 Subject: [PATCH 1/7] Add chamber temperature to PrinterStatus --- src/app/model/printer.model.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/model/printer.model.ts b/src/app/model/printer.model.ts index ccc402616..254624f48 100644 --- a/src/app/model/printer.model.ts +++ b/src/app/model/printer.model.ts @@ -2,6 +2,7 @@ export interface PrinterStatus { status: PrinterState; bed: Temperature; tool0: Temperature; + chamber: Temperature; fanSpeed: number; } From bb07b97d8a868806f029a8744af7f593db4ba4e6 Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Thu, 18 May 2023 23:52:17 +0200 Subject: [PATCH 2/7] Feed model with cha,ber temp --- src/app/services/socket/socket.octoprint.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/services/socket/socket.octoprint.service.ts b/src/app/services/socket/socket.octoprint.service.ts index 0c20c3da2..6dd63ecef 100644 --- a/src/app/services/socket/socket.octoprint.service.ts +++ b/src/app/services/socket/socket.octoprint.service.ts @@ -232,6 +232,11 @@ export class OctoPrintSocketService implements SocketService { set: Math.round(message?.current?.temps[0]?.tool0?.target), unit: '°C', }; + this.printerStatus.chamber = { + current: Math.round(message?.current?.temps[0]?.chamber?.actual), + set: Math.round(message?.current?.temps[0]?.chamber?.target), + unit: '°C', + } } this.printerStatus.status = PrinterState[message.current.state.text.toLowerCase()]; From 24fca58a0caadf98e2ef707a9ca5b11a533919f7 Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Fri, 19 May 2023 00:30:24 +0200 Subject: [PATCH 3/7] Mush the acquired temperature reading into the bottombar This hijack the existing HTML element for the enclosure plugin... --- src/app/bottom-bar/bottom-bar.component.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/app/bottom-bar/bottom-bar.component.ts b/src/app/bottom-bar/bottom-bar.component.ts index 7b2b607c1..7abeeded9 100644 --- a/src/app/bottom-bar/bottom-bar.component.ts +++ b/src/app/bottom-bar/bottom-bar.component.ts @@ -7,6 +7,7 @@ import { NotificationType, PrinterState, PrinterStatus, TemperatureReading } fro import { NotificationService } from '../notification/notification.service'; import { EnclosureService } from '../services/enclosure/enclosure.service'; import { SocketService } from '../services/socket/socket.service'; +import { PurgeFilamentComponent } from '../filament/purge-filament/purge-filament.component'; @Component({ selector: 'app-bottom-bar', @@ -26,6 +27,8 @@ export class BottomBarComponent implements OnDestroy { private enclosureService: EnclosureService, private notificationService: NotificationService, ) { + + if (this.configService.getAmbientTemperatureSensorName() !== null) { this.subscriptions.add( timer(10000, 15000).subscribe(() => { @@ -44,6 +47,19 @@ export class BottomBarComponent implements OnDestroy { ); } + this.subscriptions.add( + this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { + if (printerStatus.chamber.current > 0) { + let chamberReading: TemperatureReading = { + temperature: printerStatus.chamber.current, + humidity: 0, + unit: printerStatus.chamber.unit + }; + this.enclosureTemperature = chamberReading; + } + }), + ); + this.subscriptions.add( this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { this.setStatusText(this.getStringStatus(printerStatus?.status)); From 09f5332799fea63a0d80ebc5576d34e15b6178d1 Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Sun, 21 May 2023 20:37:45 +0200 Subject: [PATCH 4/7] Remove unused import that IDE added by itself --- src/app/bottom-bar/bottom-bar.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/bottom-bar/bottom-bar.component.ts b/src/app/bottom-bar/bottom-bar.component.ts index 7abeeded9..d44469ba1 100644 --- a/src/app/bottom-bar/bottom-bar.component.ts +++ b/src/app/bottom-bar/bottom-bar.component.ts @@ -7,7 +7,6 @@ import { NotificationType, PrinterState, PrinterStatus, TemperatureReading } fro import { NotificationService } from '../notification/notification.service'; import { EnclosureService } from '../services/enclosure/enclosure.service'; import { SocketService } from '../services/socket/socket.service'; -import { PurgeFilamentComponent } from '../filament/purge-filament/purge-filament.component'; @Component({ selector: 'app-bottom-bar', @@ -28,7 +27,6 @@ export class BottomBarComponent implements OnDestroy { private notificationService: NotificationService, ) { - if (this.configService.getAmbientTemperatureSensorName() !== null) { this.subscriptions.add( timer(10000, 15000).subscribe(() => { From e470bfcc4680f8ac8a6bcce4a8952e093e07741a Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Wed, 24 May 2023 18:38:01 +0200 Subject: [PATCH 5/7] changes from codefactor CI steps --- src/app/bottom-bar/bottom-bar.component.ts | 5 ++--- src/app/services/socket/socket.octoprint.service.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/bottom-bar/bottom-bar.component.ts b/src/app/bottom-bar/bottom-bar.component.ts index d44469ba1..ce317a295 100644 --- a/src/app/bottom-bar/bottom-bar.component.ts +++ b/src/app/bottom-bar/bottom-bar.component.ts @@ -26,7 +26,6 @@ export class BottomBarComponent implements OnDestroy { private enclosureService: EnclosureService, private notificationService: NotificationService, ) { - if (this.configService.getAmbientTemperatureSensorName() !== null) { this.subscriptions.add( timer(10000, 15000).subscribe(() => { @@ -48,10 +47,10 @@ export class BottomBarComponent implements OnDestroy { this.subscriptions.add( this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { if (printerStatus.chamber.current > 0) { - let chamberReading: TemperatureReading = { + const chamberReading: TemperatureReading = { temperature: printerStatus.chamber.current, humidity: 0, - unit: printerStatus.chamber.unit + unit: printerStatus.chamber.unit, }; this.enclosureTemperature = chamberReading; } diff --git a/src/app/services/socket/socket.octoprint.service.ts b/src/app/services/socket/socket.octoprint.service.ts index 6dd63ecef..13cb40bc7 100644 --- a/src/app/services/socket/socket.octoprint.service.ts +++ b/src/app/services/socket/socket.octoprint.service.ts @@ -236,7 +236,7 @@ export class OctoPrintSocketService implements SocketService { current: Math.round(message?.current?.temps[0]?.chamber?.actual), set: Math.round(message?.current?.temps[0]?.chamber?.target), unit: '°C', - } + }; } this.printerStatus.status = PrinterState[message.current.state.text.toLowerCase()]; From 0024f4d904ed30b0f378463b81c9e9c3439e9e37 Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Wed, 24 May 2023 18:40:08 +0200 Subject: [PATCH 6/7] Subscribe to the native chamber tempterture update only if enclosure plugin is not configured --- src/app/bottom-bar/bottom-bar.component.ts | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/app/bottom-bar/bottom-bar.component.ts b/src/app/bottom-bar/bottom-bar.component.ts index ce317a295..e9694a532 100644 --- a/src/app/bottom-bar/bottom-bar.component.ts +++ b/src/app/bottom-bar/bottom-bar.component.ts @@ -42,20 +42,21 @@ export class BottomBarComponent implements OnDestroy { }); }), ); - } - - this.subscriptions.add( - this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { - if (printerStatus.chamber.current > 0) { - const chamberReading: TemperatureReading = { - temperature: printerStatus.chamber.current, - humidity: 0, - unit: printerStatus.chamber.unit, - }; - this.enclosureTemperature = chamberReading; - } - }), - ); + } + else { + this.subscriptions.add( + this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { + if (printerStatus.chamber.current > 0) { + const chamberReading: TemperatureReading = { + temperature: printerStatus.chamber.current, + humidity: 0, + unit: printerStatus.chamber.unit, + }; + this.enclosureTemperature = chamberReading; + } + }), + ); + } this.subscriptions.add( this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { From 77d799b3c085d4f8ded942c95a87d01e4771283c Mon Sep 17 00:00:00 2001 From: "Ybalrid (Arthur Brainville)" Date: Wed, 24 May 2023 18:43:08 +0200 Subject: [PATCH 7/7] More styling changes from codefactor --- src/app/bottom-bar/bottom-bar.component.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/bottom-bar/bottom-bar.component.ts b/src/app/bottom-bar/bottom-bar.component.ts index e9694a532..2ca107469 100644 --- a/src/app/bottom-bar/bottom-bar.component.ts +++ b/src/app/bottom-bar/bottom-bar.component.ts @@ -42,8 +42,7 @@ export class BottomBarComponent implements OnDestroy { }); }), ); - } - else { + } else { this.subscriptions.add( this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => { if (printerStatus.chamber.current > 0) { @@ -56,7 +55,7 @@ export class BottomBarComponent implements OnDestroy { } }), ); - } + } this.subscriptions.add( this.socketService.getPrinterStatusSubscribable().subscribe((printerStatus: PrinterStatus): void => {