mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update Settings.cpp
This commit is contained in:
@@ -172,13 +172,18 @@ bool nextSettingValue(const enum SettingsOptions option) {
|
|||||||
// Return true if we are at the end (min)
|
// Return true if we are at the end (min)
|
||||||
bool prevSettingValue(const enum SettingsOptions option) {
|
bool prevSettingValue(const enum SettingsOptions option) {
|
||||||
const auto constants = settingsConstants[(int)option];
|
const auto constants = settingsConstants[(int)option];
|
||||||
int value = systemSettings.settingsValues[(int)option];
|
if (systemSettings.settingsValues[(int)option] == (constants.min)) {
|
||||||
if (value <= constants.min) {
|
// Already at min, wrap to the max
|
||||||
value = constants.max;
|
systemSettings.settingsValues[(int)option] = constants.max;
|
||||||
|
} else if (systemSettings.settingsValues[(int)option] <= (constants.min + constants.increment)) {
|
||||||
|
// If within one increment of the start, constrain to the start
|
||||||
|
systemSettings.settingsValues[(int)option] = constants.min;
|
||||||
|
} else {
|
||||||
|
// Otherwise decrement
|
||||||
|
systemSettings.settingsValues[(int)option] -= constants.increment;
|
||||||
}
|
}
|
||||||
value -= constants.increment;
|
// Return if we are at the min
|
||||||
systemSettings.settingsValues[(int)option] = value;
|
return constants.min == systemSettings.settingsValues[(int)option];
|
||||||
return systemSettings.settingsValues[(int)option] == constants.min;
|
|
||||||
}
|
}
|
||||||
uint16_t lookupHallEffectThreshold() {
|
uint16_t lookupHallEffectThreshold() {
|
||||||
// Return the threshold above which the hall effect sensor is "activated"
|
// Return the threshold above which the hall effect sensor is "activated"
|
||||||
|
|||||||
Reference in New Issue
Block a user