Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds toggle for gas resistance #1057

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/widgets/thermals/TemperatureCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
hide-details
class="mx-2 my-2"
/>
<v-checkbox
v-model="showGasResistance"
:label="$t('app.setting.label.show_gas_resistance')"
color="primary"
hide-details
class="mx-2 my-2"
/>
</app-btn-collapse-group>
</template>

Expand Down Expand Up @@ -183,6 +190,18 @@ export default class TemperatureCard extends Mixins(StateMixin, BrowserMixin) {
})
}

get showGasResistance () {
return this.$store.state.config.uiSettings.general.showGasResistance
}

set showGasResistance (value: boolean) {
this.$store.dispatch('config/saveByPath', {
path: 'uiSettings.general.showGasResistance',
value,
server: true
})
}

handleApplyPreset (preset: TemperaturePreset) {
if (preset) {
if (preset.values) {
Expand Down
5 changes: 5 additions & 0 deletions src/components/widgets/thermals/TemperatureTargets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
{{ item.temperature.toFixed(1) }}<small>°C</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>
<small v-if="item.gas && showGasResistance"><br>{{ item.gas.toFixed(1) }}&nbsp;&ohm;</small>
<small v-if="item.current_z_adjust !== undefined"><br>{{ $filters.getReadableLengthString(item.current_z_adjust, true) }}</small>
</div>
</template>
Expand Down Expand Up @@ -278,6 +279,10 @@ export default class TemperatureTargets extends Mixins(StateMixin) {
return this.$store.state.config.uiSettings.general.showBarometricPressure
}

get showGasResistance () {
return this.$store.state.config.uiSettings.general.showGasResistance
}

setHeaterTargetTemp (heater: string, target: number) {
this.sendGcode(`SET_HEATER_TEMPERATURE HEATER=${heater} TARGET=${target}`)
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ app:
show_animations: Show animations
show_barometric_pressure: Show barometric pressure
show_code_lens: Show CodeLens
show_gas_resistance: Show gas resistance
show_legend: Show legend
show_rate_of_change: Show temperature rate of change
show_relative_humidity: Show relative humidity
Expand Down
1 change: 1 addition & 0 deletions src/store/config/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const defaultState = (): ConfigState => {
showRateOfChange: false,
showRelativeHumidity: true,
showBarometricPressure: true,
showGasResistance: true,
showSaveConfigAndRestart: true,
showUploadAndPrint: true,
flipConsoleLayout: false,
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export interface GeneralConfig {
showRateOfChange: boolean;
showRelativeHumidity: boolean;
showBarometricPressure: boolean;
showGasResistance: boolean;
showSaveConfigAndRestart: boolean;
showUploadAndPrint: boolean;
flipConsoleLayout: boolean;
Expand Down
7 changes: 4 additions & 3 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export const getters: GetterTree<PrinterState, RootState> = {
const type = split[0]
const name = (split.length > 1) ? split[1] : item

if (supportedSensors.includes(split[0])) {
if (supportedSensors.includes(type)) {
const prettyName = Vue.$filters.startCase(name)
const color = Vue.$colorset.next(getKlipperType(item), item)
const config = getters.getPrinterSettings(item)
Expand All @@ -611,12 +611,13 @@ export const getters: GetterTree<PrinterState, RootState> = {
color,
type
}
} else if (extraSupportedSensors.includes(split[0])) {
const { pressure, humidity } = state.printer[item]
} else if (extraSupportedSensors.includes(type)) {
const { pressure, humidity, gas } = state.printer[item]

groups[name] = {
pressure,
humidity,
gas,
...groups[name]
}
}
Expand Down
1 change: 1 addition & 0 deletions src/store/printer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export interface Sensor {
temperature: number;
pressure?: number;
humidity?: number;
gas?: number;
target?: number;
measured_min_temp?: number;
measured_max_temp?: number;
Expand Down