Skip to content

Commit

Permalink
feat: add toggles for relative humidity / barometric pressure (#687)
Browse files Browse the repository at this point in the history
Signed-off-by: Mathis Mensing <matmen@dreadful.tech>
  • Loading branch information
matmen committed May 20, 2022
1 parent efba69b commit 665c743
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 2 deletions.
38 changes: 38 additions & 0 deletions src/components/widgets/thermals/TemperatureCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
hide-details
class="mx-2 mt-2 mb-2"
/>
<v-checkbox
v-model="showRelativeHumidity"
:label="$t('app.setting.label.show_relative_humidity')"
color="primary"
hide-details
class="mx-2 mt-2 mb-2"
/>
<v-checkbox
v-model="showBarometricPressure"
:label="$t('app.setting.label.show_barometric_pressure')"
color="primary"
hide-details
class="mx-2 mt-2 mb-2"
/>
</app-btn-collapse-group>
</app-btn-collapse-group>
</template>
Expand Down Expand Up @@ -141,6 +155,30 @@ export default class TemperatureCard extends Mixins(StateMixin) {
})
}
get showRelativeHumidity () {
return this.$store.state.config.uiSettings.general.showRelativeHumidity
}
set showRelativeHumidity (value: boolean) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.general.showRelativeHumidity',
value,
server: true
})
}
get showBarometricPressure () {
return this.$store.state.config.uiSettings.general.showBarometricPressure
}
set showBarometricPressure (value: boolean) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.general.showBarometricPressure',
value,
server: true
})
}
get inLayout (): boolean {
return (this.$store.state.config.layoutMode)
}
Expand Down
12 changes: 10 additions & 2 deletions src/components/widgets/thermals/TemperatureTargets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@
v-bind="attrs"
v-on="on"
>{{ item.temperature.toFixed(1) }}<small>°C</small>
<small v-if="item.humidity"><br>{{ item.humidity.toFixed(1) }}&nbsp;%</small>
<small v-if="item.pressure"><br>{{ item.pressure.toFixed(1) }}&nbsp;hpa</small>
<small v-if="item.humidity && showRelativeHumidity"><br>{{ item.humidity.toFixed(1) }}&nbsp;%</small>
<small v-if="item.pressure && showBarometricPressure"><br>{{ item.pressure.toFixed(1) }}&nbsp;hpa</small>
</span>
</template>
<span v-if="item.measured_max_temp && item.measured_min_temp">
Expand Down Expand Up @@ -257,6 +257,14 @@ export default class TemperatureTargets extends Mixins(StateMixin) {
return this.$store.state.config.uiSettings.general.showRateOfChange
}
get showRelativeHumidity () {
return this.$store.state.config.uiSettings.general.showRelativeHumidity
}
get showBarometricPressure () {
return this.$store.state.config.uiSettings.general.showBarometricPressure
}
setHeaterTargetTemp (heater: string, target: number) {
this.sendGcode(`SET_HEATER_TEMPERATURE HEATER=${heater} TARGET=${target}`)
}
Expand Down
2 changes: 2 additions & 0 deletions src/locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ app:
reset: Einstellungen zurücksetzen
retraction_icon_size: Retraction-Symbolgröße
show_animations: Animationen anzeigen
show_barometric_pressure: Luftdruck anzeigen
show_rate_of_change: Temperatur-Änderungsrate anzeigen
show_relative_humidity: Relative Luftfeuchtigkeit anzeigen
starts_with: Beginnt mit
theme_preset: Community-Voreinstellung
thermal_preset_gcode: GCode
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ app:
reset: Reset settings
retraction_icon_size: Retraction Icon Size
show_animations: Show animations
show_barometric_pressure: Show barometric pressure
show_rate_of_change: Show temperature rate of change
show_relative_humidity: Show relative humidity
starts_with: Starts with
theme_preset: Community preset
thermal_preset_gcode: GCode
Expand Down
2 changes: 2 additions & 0 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export const defaultState = (): ConfigState => {
dateformat: 'MMM. DD,',
timeformat: 'hh:mm a',
showRateOfChange: false,
showRelativeHumidity: true,
showBarometricPressure: true,
flipConsoleLayout: false
},
theme: {
Expand Down
2 changes: 2 additions & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export interface GeneralConfig {
dateformat: string;
timeformat: string;
showRateOfChange: boolean;
showRelativeHumidity: boolean;
showBarometricPressure: boolean;
flipConsoleLayout: boolean;
}

Expand Down

0 comments on commit 665c743

Please sign in to comment.