1
0
forked from me/IronOS

Description scroll speed parametrized + smooth scroll in userConfirmation (#221)

* Enabled DOUBLE line for Croatian + translation fix

Enabled DOUBLE line Menu for Croatian.
A minor translation fix.

* Added Double line menus for Croatian

Added Double line menus for Croatian. For some reason they were not included in the previous pull request, even though I made them (most probably it was by my mistake).

* Added "Power: " translation for Croatian

* Menu desciption scroll sped up 3x

* Slow scroll

* Additional HR translation fix

* EOL fixed

* Fixed flickering - update only when required

* Parametrized description scrolling speed

* Synchronized Translation.c with original Ralim master

* Removed unnecessary check

* lcd.refresh() in description scroll called only when required

* Smooth scrolling also implemented in userConfirmation() method

* Variable messageSpeedFactor renamed to messageSpeedFactor

* Variable renamed
This commit is contained in:
jonnieZG
2018-03-11 03:12:49 +01:00
committed by Ben V. Brown
parent fbd730760b
commit 33edf6ba76
5 changed files with 51 additions and 21 deletions

View File

@@ -21,7 +21,6 @@ uint8_t PCBVersion = 0;
uint16_t currentlyActiveTemperatureTarget = 0;
uint32_t lastMovementTime = 0;
uint32_t lastButtonTime = 0;
int16_t lastOffset = 0;
// FreeRTOS variables
osThreadId GUITaskHandle;
@@ -332,6 +331,12 @@ static void gui_settingsMenu() {
uint32_t autoRepeatTimer = 0;
bool earlyExit = false;
uint32_t descriptionStart = 0;
int16_t lastOffset = -1;
bool lcdRefresh = true;
// TODO Scrolling speed factor can be moved to User Interface settings
uint16_t scrollingSpeedFactor = 4; // lower the value - higher the speed
while ((settingsMenu[currentScreen].incrementHandler.func != NULL)
&& earlyExit == false) {
lcd.setFont(0);
@@ -341,25 +346,29 @@ static void gui_settingsMenu() {
lcd.clearScreen();
settingsMenu[currentScreen].draw.func();
lastOffset = 0;
lastOffset = -1;
lcdRefresh = true;
} else {
// Draw description
// draw string starting from descriptionOffset
int16_t maxOffset = strlen(settingsMenu[currentScreen].description)
+ 7;
int16_t descriptionWidth = FONT_12_WIDTH
* (strlen(settingsMenu[currentScreen].description) + 7);
if (descriptionStart == 0)
descriptionStart = HAL_GetTick();
int16_t descriptionOffset = ((((HAL_GetTick() - descriptionStart)
/ 20) % (maxOffset * 2))) * 6;
int16_t descriptionOffset =
(int) ((HAL_GetTick() - descriptionStart)
/ (float) scrollingSpeedFactor + 0.5)
% descriptionWidth;
if (lastOffset == 0 || lastOffset!=descriptionOffset) {
if (lastOffset != descriptionOffset) {
lcd.clearScreen();
//^ Rolling offset based on time
lcd.setCursor(((7 * 12) - descriptionOffset), 0);
lcd.setCursor((OLED_WIDTH - descriptionOffset), 0);
lcd.print(settingsMenu[currentScreen].description);
lastOffset = descriptionOffset;
lcdRefresh = true;
}
}
@@ -403,8 +412,11 @@ static void gui_settingsMenu() {
break;
}
lcd.refresh(); // update the LCD
osDelay(20);
if (lcdRefresh) {
lcd.refresh(); // update the LCD
osDelay(20);
lcdRefresh = false;
}
}
saveSettings();