diff --git a/docs/customize/hide_outputs.md b/docs/customize/hide_outputs.md index 809d78436c..bed5e69d58 100644 --- a/docs/customize/hide_outputs.md +++ b/docs/customize/hide_outputs.md @@ -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 @@ -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) diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index bce8dcd7b7..59f2850938 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -696,9 +696,9 @@ export const getters: GetterTree = { 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', { @@ -775,19 +775,11 @@ export const getters: GetterTree = { ] ] - 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)))