* 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

@@ -195,7 +195,7 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
memmove(&secondStripPtr[newStart], &secondBackStripPtr[newEnd], progress);
refresh();
osDelay(40);
osDelay(TICKS_100MS/5);
}
}

View File

@@ -30,7 +30,7 @@ typedef struct {
uint8_t OrientationMode : 2; // Selects between Auto,Right and left handed layouts
uint8_t sensitivity : 4; // Sensitivity of accelerometer (5 bits)
uint8_t animationLoop : 1; // Animation loop switch
uint16_t animationSpeed; // Animation speed (in miliseconds)
uint8_t animationSpeed : 2; // Animation speed (in miliseconds)
uint8_t autoStartMode : 2; // Should the unit automatically jump straight
// into soldering mode when power is applied
uint8_t ShutdownTime; // Time until unit shuts down if left alone
@@ -63,7 +63,13 @@ typedef struct {
// MUST BE LAST
} systemSettingsType;
typedef enum {
OFF = 0, // Off (disabled)
SLOW = 1, //
MEDIUM = 2, //
FAST = 3, //
MAX_VALUE = 4 //
} settingOffSpeed_t;
extern volatile systemSettingsType systemSettings;
void saveSettings();

View File

@@ -44,8 +44,6 @@ extern const char *LockingKeysString;
extern const char *UnlockingKeysString;
extern const char *WarningKeysLockedString;
extern const char *SettingTrueChar;
extern const char *SettingFalseChar;
extern const char *SettingRightChar;
extern const char *SettingLeftChar;
extern const char *SettingAutoChar;
@@ -63,6 +61,7 @@ extern const char *SettingLockFullChar;
extern const char *SettingNAChar;
extern const char *SettingFastChar;
extern const char *SettingMediumChar;
extern const char *SettingSlowChar;
extern const char *TipModelStrings[];
extern const char *DebugMenu[];

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]));
}
}

View File

@@ -1,5 +1,6 @@
#pragma once
#include "Model_Config.h"
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -92,8 +93,8 @@
#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33))
#define TEMPERATURE_INF 0 // default to 0
#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow
#define ANIMATION_LOOP 0 // 0: off 1: on
#define ANIMATION_SPEED 400 // 0: off, 300: High, 400: Medium, 500: Low
#define ANIMATION_LOOP 1 // 0: off 1: on
#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM
#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1
#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2