From efcbd594997089650df9847d382791b816d6a895 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 6 Aug 2023 10:30:37 +0200 Subject: [PATCH 1/8] feat: add option to enable/disable additional_sensor values in the nevermore value Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelList.vue | 23 ++- .../TemperaturePanelListItemEdit.vue | 1 + .../TemperaturePanelListItemNevermore.vue | 111 +++++++++++++ ...TemperaturePanelListItemNevermoreValue.vue | 149 ++++++++++++++++++ 4 files changed, 280 insertions(+), 4 deletions(-) create mode 100644 src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue create mode 100644 src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue diff --git a/src/components/panels/Temperature/TemperaturePanelList.vue b/src/components/panels/Temperature/TemperaturePanelList.vue index 837feb0f9..c3a48c02d 100644 --- a/src/components/panels/Temperature/TemperaturePanelList.vue +++ b/src/components/panels/Temperature/TemperaturePanelList.vue @@ -22,7 +22,15 @@ + + @@ -36,8 +44,11 @@ import Component from 'vue-class-component' import { Mixins } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' +import TemperaturePanelListItemNevermore from '@/components/panels/Temperature/TemperaturePanelListItemNevermore.vue' -@Component +@Component({ + components: { TemperaturePanelListItemNevermore }, +}) export default class TemperaturePanelList extends Mixins(BaseMixin) { get available_heaters() { return this.$store.state.printer?.heaters?.available_heaters ?? [] @@ -65,6 +76,10 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) { .sort(this.sortObjectName) } + get existsNevermoreFilter() { + return 'nevermore' in this.$store.state.printer + } + get temperature_sensors() { return this.available_sensors .filter((fullName: string) => { @@ -80,8 +95,8 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) { .sort(this.sortObjectName) } - get tempObjects() { - return [...this.filteredHeaters, ...this.temperature_fans, ...this.temperature_sensors] + get heaterObjects() { + return [...this.filteredHeaters, ...this.temperature_fans] } sortObjectName(a: string, b: string) { diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue index 275c26c8e..9ac501c7a 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue @@ -67,6 +67,7 @@ export default class TemperaturePanelListItemEdit extends Mixins(BaseMixin) { get additionalValues() { if (this.objectName === 'z_thermal_adjust') return ['current_z_adjust'] + if (this.objectName === 'nevermore') return ['temperature', 'pressure', 'humidity', 'rpm'] return Object.keys(this.printerObjectAdditionalSensor).filter((key) => key !== 'temperature') } diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue new file mode 100644 index 000000000..2a6b2587d --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue new file mode 100644 index 000000000..f6fb8f57a --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -0,0 +1,149 @@ + + + From 1c6ada5644e37c53937fe6abce206cf828c6efc9 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 6 Aug 2023 10:32:49 +0200 Subject: [PATCH 2/8] fix: remove digits for gas value Signed-off-by: Stefan Dej --- .../TemperaturePanelListItemNevermoreValue.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index f6fb8f57a..264b57c82 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -88,9 +88,13 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM return null } + get digits() { + return this.keyName === 'gas' ? 0 : 1 + } + get formatValue() { - let intake_value = this.intake_value?.toFixed(1) - let exhaust_value = this.exhaust_value?.toFixed(1) + let intake_value = this.intake_value?.toFixed(this.digits) + let exhaust_value = this.exhaust_value?.toFixed(this.digits) if (this.intake_value === null) intake_value = '--' if (this.exhaust_value === null) exhaust_value = '--' @@ -101,8 +105,8 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get formatValue_min() { - let intake_value = this.intake_value_min?.toFixed(1) - let exhaust_value = this.exhaust_value_min?.toFixed(1) + let intake_value = this.intake_value_min?.toFixed(this.digits) + let exhaust_value = this.exhaust_value_min?.toFixed(this.digits) if (this.intake_value === null) intake_value = '--' if (this.exhaust_value === null) exhaust_value = '--' @@ -113,8 +117,8 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get formatValue_max() { - let intake_value = this.intake_value_max?.toFixed(1) - let exhaust_value = this.exhaust_value_max?.toFixed(1) + let intake_value = this.intake_value_max?.toFixed(this.digits) + let exhaust_value = this.exhaust_value_max?.toFixed(this.digits) if (this.intake_value === null) intake_value = '--' if (this.exhaust_value === null) exhaust_value = '--' From a9dc9ea26c99e0435229a5948ec548952f5e4276 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 6 Aug 2023 20:00:39 +0200 Subject: [PATCH 3/8] fix: use text-center for the values Signed-off-by: Stefan Dej --- .../panels/Temperature/TemperaturePanelListItemNevermore.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue index 2a6b2587d..65fd4c0b3 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermore.vue @@ -8,7 +8,7 @@ Nevermore - + {{ rpm }} RPM -   Date: Sun, 6 Aug 2023 20:00:55 +0200 Subject: [PATCH 4/8] fix: remove digits for pressure value Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelListItemNevermoreValue.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index 264b57c82..0fa732b5a 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -89,7 +89,7 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get digits() { - return this.keyName === 'gas' ? 0 : 1 + return ['gas', 'pressure'].includes(this.keyName) ? 0 : 1 } get formatValue() { From 04b6b779a0289173462536ba4b98062ea11a2b77 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 9 Aug 2023 01:10:09 +0200 Subject: [PATCH 5/8] refactor: Apply suggestions from rackrick Co-authored-by: rackrick <45207681+rackrick@users.noreply.github.com> --- ...TemperaturePanelListItemNevermoreValue.vue | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index 0fa732b5a..6777afdd7 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -93,32 +93,21 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get formatValue() { - let intake_value = this.intake_value?.toFixed(this.digits) - let exhaust_value = this.exhaust_value?.toFixed(this.digits) - if (this.intake_value === null) intake_value = '--' - if (this.exhaust_value === null) exhaust_value = '--' - - // return only the value, if unit is null - if (this.unit === null) return `${intake_value} > ${exhaust_value}` - - return `${intake_value} ${this.unit} > ${exhaust_value} ${this.unit}` + return getFormatedValue(this.intake_value, this.exhaust_value) } - get formatValue_min() { - let intake_value = this.intake_value_min?.toFixed(this.digits) - let exhaust_value = this.exhaust_value_min?.toFixed(this.digits) - if (this.intake_value === null) intake_value = '--' - if (this.exhaust_value === null) exhaust_value = '--' - - // return only the value, if unit is null - if (this.unit === null) return `${intake_value} > ${exhaust_value}` + get formatValue_min() { + return getFormatedValue(this.intake_value_min, this.exhaust_value_min) + } - return `${intake_value} ${this.unit} > ${exhaust_value} ${this.unit}` + get formatValue_max() { + return getFormatedValue(this.intake_value_max, this.exhaust_value_max) } - get formatValue_max() { - let intake_value = this.intake_value_max?.toFixed(this.digits) - let exhaust_value = this.exhaust_value_max?.toFixed(this.digits) + + getFormatedValue(intake: number | null, exhaust: number | null): string { + let intake_value = intake?.toFixed(this.digits) + let exhaust_value = exhaust?.toFixed(this.digits) if (this.intake_value === null) intake_value = '--' if (this.exhaust_value === null) exhaust_value = '--' From 2a3505948c0e9f79160987fa228b9bd88682bb8f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 9 Aug 2023 01:23:59 +0200 Subject: [PATCH 6/8] fix: fix getFormatedValue funciton Signed-off-by: Stefan Dej --- .../TemperaturePanelListItemNevermoreValue.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index 6777afdd7..54058e9e0 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -93,18 +93,17 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get formatValue() { - return getFormatedValue(this.intake_value, this.exhaust_value) + return this.getFormatedValue(this.intake_value, this.exhaust_value) } - get formatValue_min() { - return getFormatedValue(this.intake_value_min, this.exhaust_value_min) + get formatValue_min() { + return this.getFormatedValue(this.intake_value_min, this.exhaust_value_min) } - get formatValue_max() { - return getFormatedValue(this.intake_value_max, this.exhaust_value_max) + get formatValue_max() { + return this.getFormatedValue(this.intake_value_max, this.exhaust_value_max) } - getFormatedValue(intake: number | null, exhaust: number | null): string { let intake_value = intake?.toFixed(this.digits) let exhaust_value = exhaust?.toFixed(this.digits) From 11d5c61bc78d848d93061db741861b2a2bc2db6f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 9 Aug 2023 22:56:19 +0200 Subject: [PATCH 7/8] fix: fix min/max overlay values Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelListItemNevermoreValue.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index 54058e9e0..22750537f 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -5,9 +5,9 @@ {{ formatValue }} - {{ $t('Panels.TemperaturePanel.Max') }}: {{ formatValue_min }} + {{ $t('Panels.TemperaturePanel.Max') }}: {{ formatValue_max }}
- {{ $t('Panels.TemperaturePanel.Min') }}: {{ formatValue_max }} + {{ $t('Panels.TemperaturePanel.Min') }}: {{ formatValue_min }}
From ae4f609f67293f33c78fbe6c0c35d231d40a1689 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Wed, 9 Aug 2023 22:56:35 +0200 Subject: [PATCH 8/8] fix: hide values, if both values dont exists Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelListItemNevermoreValue.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue index 22750537f..e6968b54a 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItemNevermoreValue.vue @@ -133,7 +133,7 @@ export default class TemperaturePanelListItemNevermoreValue extends Mixins(BaseM } get isVisible() { - //if (this.intake_value === null && this.exhaust_value === null) return false + if (this.intake_value === null && this.exhaust_value === null) return false return this.guiSetting }