Skip to content

Commit

Permalink
fix: can adjust Hall Sensor setting. closes #33
Browse files Browse the repository at this point in the history
  • Loading branch information
builder555 committed Oct 18, 2023
1 parent 844a80c commit ddbeac2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ui/src/components/TheSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ for (const group of groups.value) {
</template>
<style scoped>
.is-disabled {
opacity: 0.5;
pointer-events: none;
}
.navbar-link {
align-items: center;
display: flex;
Expand Down
6 changes: 6 additions & 0 deletions ui/src/setting-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ const settingToComponentMap = {
offable: true,
display: (value) => (value == 0 ? 'Off' : value),
},
HallEffectSensitivity: {
name: 'range',
min: 0,
max: 9,
step: 1,
},
SettingsReset: {
name: 'confirm',
message: 'Are you sure you want to reset all settings to default?',
Expand Down
4 changes: 2 additions & 2 deletions ui/src/setting-descriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ const settingDescriptions = {
displayText: 'Shutdown timeout',
description: 'Interval before the iron shuts down (m=minutes)',
},
HallEffSensitivity: {
HallEffectSensitivity: {
displayText: 'Hall sensor sensitivity',
description: 'Sensitivity to magnets (0=off | 1=least sensitive | ... | 9=most sensitive)',
description: 'Sensitivity to magnets (0=off | 1=least sensitive | ... | 9=most sensitive). Only available if there is a Hall Effect Sensor installed.',
},
TemperatureUnit: {
displayText: 'Temperature unit',
Expand Down
3 changes: 1 addition & 2 deletions ui/src/setting-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const settingGroups = [
{
name: 'Sleep mode',
isVisible: true,
items: ['MotionSensitivity', 'SleepTemperature', 'SleepTimeout', 'ShutdownTimeout'],
items: ['MotionSensitivity', 'SleepTemperature', 'SleepTimeout', 'ShutdownTimeout', 'HallEffectSensitivity'],
},
{
name: 'Power settings',
Expand Down Expand Up @@ -51,7 +51,6 @@ const settingGroups = [
'AccelMissingWarningCounter',
'AnimLoop',
'CalibrationOffset',
'HallEffectSensitivity',
'PDMissingWarningCounter',
'UILanguage',
// "VoltageCalibration",
Expand Down
7 changes: 7 additions & 0 deletions ui/src/stores/appstore.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export const useAppStore = defineStore('appStore', () => {
setTemperatureRanges();
toggleVoltageSettings(settings.value.DCInCutoff.value);
};
const toggleHallSensorSettings = (isEnabled) => {
const classDisabled = isEnabled ? '' : 'is-disabled';
if (settings?.value?.HallEffectSensitivity?.component?.class != classDisabled){
settings.value.HallEffectSensitivity.component.class = classDisabled;
}
}

const setTemperature = async (temperature) => {
settings.value.SetTemperature.value = Number(temperature);
Expand Down Expand Up @@ -177,6 +183,7 @@ export const useAppStore = defineStore('appStore', () => {
if (watts > peakWatts.value) {
peakWatts.value = Math.max(watts, peakWatts.value);
}
toggleHallSensorSettings(!!rawLiveData.value?.HallSensor);
});
socket.on('ERROR', (data) => {
error.value = data;
Expand Down

0 comments on commit ddbeac2

Please sign in to comment.