1
0
forked from me/IronOS
* Clean translation

* Create enum for off/slow/med/fast

* Update configuration.h

* Default loop on

* Create Medium speed symbol slot

* True/False are no longer defined, move to off string + slightly smoother lerp animations
This commit is contained in:
Ben V. Brown
2021-03-15 21:43:01 +11:00
committed by GitHub
parent 7fbfde7b33
commit 337c932b23
33 changed files with 95 additions and 58 deletions

View File

@@ -914,37 +914,25 @@ static void settings_displayAnimationLoop(void) {
}
static bool settings_setAnimationSpeed(void) {
switch (systemSettings.animationSpeed) {
case 0:
systemSettings.animationSpeed = TICKS_100MS * 5;
break;
case TICKS_100MS * 5:
systemSettings.animationSpeed = TICKS_100MS * 4;
break;
case TICKS_100MS * 4:
systemSettings.animationSpeed = TICKS_100MS * 3;
break;
default:
systemSettings.animationSpeed = 0;
break;
}
return systemSettings.animationSpeed == TICKS_100MS * 3;
systemSettings.animationSpeed++;
systemSettings.animationSpeed %= settingOffSpeed_t::MAX_VALUE;
return systemSettings.animationSpeed == (uint8_t)settingOffSpeed_t::FAST;
}
static void settings_displayAnimationSpeed(void) {
printShortDescription(30, 7);
printShortDescription(30, 5);
switch (systemSettings.animationSpeed) {
case TICKS_100MS * 5:
OLED::print(SettingSensitivityLow);
case settingOffSpeed_t::SLOW:
OLED::print(SettingSlowChar);
break;
case TICKS_100MS * 4:
OLED::print(SettingSensitivityMedium);
case settingOffSpeed_t::MEDIUM:
OLED::print(SettingMediumChar);
break;
case TICKS_100MS * 3:
OLED::print(SettingSensitivityHigh);
case settingOffSpeed_t::FAST:
OLED::print(SettingFastChar);
break;
default:
OLED::print(SettingSensitivityOff);
OLED::print(OffString);
break;
}
}
@@ -997,14 +985,26 @@ static void displayMenu(size_t index) {
static TickType_t menuSwitchLoopTick = 0;
static size_t menuCurrentIndex = sizeof(rootSettingsMenu) + 1;
static size_t currentFrame = 0;
TickType_t step = TICKS_100MS * 5;
switch (systemSettings.animationSpeed) {
case settingOffSpeed_t::FAST:
step = TICKS_100MS * 3;
break;
case settingOffSpeed_t::MEDIUM:
step = TICKS_100MS * 4;
break;
default: // SLOW or off - defaulted above
break;
}
if (!animOpenState) {
if (menuCurrentIndex != index) {
menuCurrentIndex = index;
currentFrame = systemSettings.animationSpeed ? 0 : 2;
currentFrame = systemSettings.animationSpeed == settingOffSpeed_t::OFF ? 2 : 0;
menuSwitchLoopTick = xTaskGetTickCount();
}
if (systemSettings.animationSpeed && (systemSettings.animationLoop || currentFrame != 2))
currentFrame = ((xTaskGetTickCount() - menuSwitchLoopTick) / systemSettings.animationSpeed) % 3;
if (systemSettings.animationSpeed && (systemSettings.animationLoop || currentFrame != 2)) {
currentFrame = ((xTaskGetTickCount() - menuSwitchLoopTick) / step) % 3;
}
OLED::drawArea(OLED_WIDTH - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[index][(16 * 2) * currentFrame]));
}
}