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

@@ -102,19 +102,30 @@ static void printShortDescription(uint32_t shortDescIndex,
}
static int userConfirmation(const char* message) {
uint8_t maxOffset = strlen(message) + 7;
uint32_t messageStart = xTaskGetTickCount();
uint16_t messageWidth = FONT_12_WIDTH * (strlen(message) + 7);
uint32_t messageStart = HAL_GetTick();
lcd.setFont(0);
lcd.setCursor(0, 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
for (;;) {
int16_t messageOffset = (((xTaskGetTickCount() - messageStart) / 15)
% maxOffset);
int16_t messageOffset = (int) ((HAL_GetTick() - messageStart)
/ (float) scrollingSpeedFactor + 0.5) % messageWidth;
lcd.clearScreen();
lcd.setCursor(12 * (7 - messageOffset), 0);
lcd.print(message);
if (lastOffset != messageOffset) {
lcd.clearScreen();
//^ Rolling offset based on time
lcd.setCursor((OLED_WIDTH - messageOffset), 0);
lcd.print(message);
lastOffset = messageOffset;
lcdRefresh = true;
}
ButtonState buttons = getButtonState();
switch (buttons) {
@@ -132,8 +143,11 @@ static int userConfirmation(const char* message) {
return 0;
}
lcd.refresh();
osDelay(50);
if (lcdRefresh) {
lcd.refresh();
osDelay(20);
lcdRefresh = false;
}
}
return 0;
}