Skip to content

Commit

Permalink
Merge branch 'develop' into feat/collapsed-status-progress
Browse files Browse the repository at this point in the history
  • Loading branch information
matmen committed Jun 2, 2024
2 parents c32cb65 + ea0ea9e commit eabb15e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
13 changes: 9 additions & 4 deletions docs/customize/hide_outputs.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
layout: default
title: Hide macros, output pins and fans
title: Hide macros, output pins, fans and sensors
parent: Customize
nav_order: 3
permalink: /customize/hide
---

# Hide macros, output pins and fans
# Hide macros, output pins, fans and sensors
{: .no_toc }

---

Fluidd allows you to hide macros, output pins and fans by prefixing them
with an underscore (`_`).
Fluidd allows you to hide macros, output pins, fans and sensors by prefixing
them with an underscore (`_`).

By doing this - you're removing them from Fluidd. This can be handy in
situations where you have a large quantiy of macros, or whereby you have an
Expand All @@ -31,6 +31,11 @@ gcode:
pin: z:P1.30
```
```yaml
[temperature_sensor _MCU]
sensor_type: MCU
```
Macros can also be hidden directly from the Fluidd settings by toggling their
visibility, in order to not change their name:
![screenshot](/assets/images/macro_visibility.png)
14 changes: 3 additions & 11 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ export const getters: GetterTree<PrinterState, RootState> = {
const sensors = Object.keys(state.printer)
.reduce((groups, item) => {
const [type, nameFromSplit] = item.split(' ', 2)
const name = nameFromSplit ?? item

if (supportedSensors.includes(type)) {
const name = nameFromSplit ?? item
if (supportedSensors.includes(type) && !name.startsWith('_')) {
const prettyName = supportedDrivers.includes(type)
? i18n.t('app.general.label.stepper_driver',
{
Expand Down Expand Up @@ -775,19 +775,11 @@ export const getters: GetterTree<PrinterState, RootState> = {
]
]

const filterByPrefix = [
'temperature_fan'
]

const printerKeys = Object.keys(state.printer)

const sensors = keyGroups.flatMap(keyGroup => {
const keyGroupRegExpArray = keyGroup
.map(x => new RegExp(
filterByPrefix.includes(x)
? `^${x}(?! _)`
: `^${x}`)
)
.map(x => new RegExp(`^${x}(?! _)`))

return printerKeys
.filter(key => keyGroupRegExpArray.some(x => x.test(key)))
Expand Down

0 comments on commit eabb15e

Please sign in to comment.