1
0
forked from me/IronOS

making hall effect 0-9 scale

This commit is contained in:
Ben V. Brown
2022-02-09 21:18:15 +11:00
parent 02d065778c
commit 7fcac3aaf1
2 changed files with 21 additions and 22 deletions

View File

@@ -77,7 +77,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
{0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
{5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
{1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
{0, 3, 1, 1}, // HallEffectSensitivity
{0, 9, 1, 1}, // HallEffectSensitivity
{0, 9, 1, 0}, // AccelMissingWarningCounter
{0, 9, 1, 0}, // PDMissingWarningCounter
{0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage
@@ -187,15 +187,28 @@ bool prevSettingValue(const enum SettingsOptions option) {
}
uint16_t lookupHallEffectThreshold() {
// Return the threshold above which the hall effect sensor is "activated"
// We want this to be roughly exponentially mapped from 0-1000
switch (getSettingValue(SettingsOptions::HallEffectSensitivity)) {
case 0:
return 0;
case 1: // Low
return 300;
case 2: // Medium
return 70;
case 3: // High
return 40;
case 1:
return 1000;
case 2:
return 750;
case 3:
return 500;
case 4:
return 250;
case 5:
return 150;
case 6:
return 100;
case 7:
return 75;
case 8:
return 50;
case 9:
return 25;
default:
return 0; // Off
}

View File

@@ -775,21 +775,7 @@ static void settings_displayInvertColor(void) {
#ifdef HALL_SENSOR
static void settings_displayHallEffect(void) {
printShortDescription(SettingsItemIndex::HallEffSensitivity, 7);
switch (getSettingValue(SettingsOptions::HallEffectSensitivity)) {
case 1:
OLED::print(translatedString(Tr->SettingSensitivityLow), FontStyle::LARGE);
break;
case 2:
OLED::print(translatedString(Tr->SettingSensitivityMedium), FontStyle::LARGE);
break;
case 3:
OLED::print(translatedString(Tr->SettingSensitivityHigh), FontStyle::LARGE);
break;
case 0:
default:
OLED::print(translatedString(Tr->SettingSensitivityOff), FontStyle::LARGE);
break;
}
OLED::printNumber(getSettingValue(SettingsOptions::HallEffectSensitivity), 1, FontStyle::LARGE, false);
}
static bool settings_showHallEffect(void) { return getHallSensorFitted(); }
#endif