Skip to content

Commit

Permalink
feat: Nevermore Controller support
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Nov 16, 2024
1 parent c27822d commit edb3bc0
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 6 deletions.
124 changes: 120 additions & 4 deletions src/components/widgets/thermals/TemperatureTargets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
<td class="temp-actual">
<v-tooltip
left
:disabled="[item.measured_max_temp, item.measured_min_temp].every(x => x === undefined)"
:disabled="item.measured_max_temp == null && item.measured_min_temp == null"
>
<template #activator="{ on, attrs }">
<div
Expand All @@ -232,15 +232,65 @@
</span>
</div>
</template>
<span v-if="[item.measured_max_temp, item.measured_min_temp].every(x => x !== undefined)">
<span>{{ $t('app.general.label.high') }}: {{ item.measured_max_temp.toFixed(1) }}°C</span><br>
<span>{{ $t('app.general.label.low') }}: {{ item.measured_min_temp.toFixed(1) }}°C</span>
<span>
{{ $t('app.general.label.high') }}: {{ item.measured_max_temp?.toFixed(1) ?? '-' }}°C<br>
{{ $t('app.general.label.low') }}: {{ item.measured_min_temp?.toFixed(1) ?? '-' }}°C
</span>
</v-tooltip>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr
v-for="item in nevermore"
:key="item.key"
>
<td>
<v-icon
small
:color="item.color"
>
$fan
</v-icon>
</td>
<td class="temp-name">
<span class="legend-item">
{{ item.prettyName }}
</span>
</td>
<td
class="temp-actual"
:colspan="showRateOfChange ? 3 : 2"
>
<span>
<template v-for="sensor in getNevermoreSensors(item)">
<v-tooltip
:key="sensor"
left
:disabled="sensor.disableTooltip"
>
<template #activator="{ on, attrs }">
<div
v-bind="attrs"
v-on="on"
>
<component :is="sensor.small ? 'small' : 'span'">
{{ sensor.intake ?? '-' }} &rarr; {{ sensor.exhaust ?? '-' }}{{ sensor.unit }}
</component>
</div>
</template>
<span>
{{ $t('app.general.label.high') }}: {{ sensor.intake_max ?? '-' }} &rarr; {{ sensor.exhaust_max ?? '-' }}{{ sensor.unit }}<br>
{{ $t('app.general.label.low') }}: {{ sensor.intake_min ?? '-' }} &rarr; {{ sensor.exhaust_min ?? '-' }}{{ sensor.unit }}
</span>
</v-tooltip>
</template>
<small v-if="item.rpm != null">{{ item.rpm }} RPM</small>
</span>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</v-simple-table>
</div>
Expand Down Expand Up @@ -268,6 +318,10 @@ export default class TemperatureTargets extends Mixins(StateMixin) {
return this.$store.getters['printer/getOutputs'](['temperature_fan'])
}

get nevermore () {
return this.$store.getters['printer/getOutputs'](['nevermore'])
}

get sensors () {
return this.$store.getters['printer/getSensors']
}
Expand Down Expand Up @@ -348,6 +402,67 @@ export default class TemperatureTargets extends Mixins(StateMixin) {
this.$emit('updateChartSelectedLegends', chartSelectedLegends)
}
getNevermoreSensors (item: Record<string, number | undefined>) {
const sensors = [
{
key: 'gas',
unit: '',
digits: 0,
small: false
},
{
key: 'temperature',
unit: ' °C',
digits: 1,
small: true
}
]
if (this.showRelativeHumidity) {
sensors.push({
key: 'humidity',
unit: ' %',
digits: 1,
small: true
})
}
if (this.showBarometricPressure) {
sensors.push({
key: 'pressure',
unit: ' hPa',
digits: 0,
small: true
})
}
return sensors
.map(sensor => {
const intake = item[`intake_${sensor.key}`]?.toFixed(sensor.digits)
const intake_min = item[`intake_${sensor.key}_min`]?.toFixed(sensor.digits)
const intake_max = item[`intake_${sensor.key}_max`]?.toFixed(sensor.digits)
const exhaust = item[`exhaust_${sensor.key}`]?.toFixed(sensor.digits)
const exhaust_min = item[`exhaust_${sensor.key}_min`]?.toFixed(sensor.digits)
const exhaust_max = item[`exhaust_${sensor.key}_max`]?.toFixed(sensor.digits)
return {
...sensor,
intake,
intake_min,
intake_max,
exhaust,
exhaust_min,
exhaust_max,
disableTooltip: (
intake_min == null &&
intake_max == null &&
exhaust_min == null &&
exhaust_max == null
)
}
})
}
}
</script>
Expand Down Expand Up @@ -379,6 +494,7 @@ export default class TemperatureTargets extends Mixins(StateMixin) {
font-weight: 300;
font-size: 1.125rem;
white-space: nowrap;
text-align: right;
}
> thead > tr > th {
Expand Down
4 changes: 2 additions & 2 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ export const getters: GetterTree<PrinterState, RootState> = {
'neopixel',
'dotstar',
'pca9533',
'pca9632'
'pca9632',
'nevermore'
]

const supportedTypes = (filter && filter.length)
Expand Down Expand Up @@ -760,7 +761,6 @@ export const getters: GetterTree<PrinterState, RootState> = {
'aht10',
'bme280',
'htu21d',
'nevermoresensor',
'sht3x'
]

Expand Down

0 comments on commit edb3bc0

Please sign in to comment.