Merge pull request #1967 from thinkyhead/g4_dwell_message

Use millis_t for progress_bar_ms and expire_status_ms
This commit is contained in:
Scott Lahteine 2015-04-24 22:17:28 -07:00
commit a640cad139
2 changed files with 9 additions and 8 deletions

View File

@ -267,8 +267,8 @@ static void lcd_status_screen() {
#ifdef LCD_PROGRESS_BAR
millis_t ms = millis();
#ifndef PROGRESS_MSG_ONCE
if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progressBarTick = ms;
if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progress_bar_ms = ms;
}
#endif
#if PROGRESS_MSG_EXPIRE > 0
@ -1392,9 +1392,9 @@ void lcd_ignore_click(bool b) {
void lcd_finishstatus(bool persist=false) {
#ifdef LCD_PROGRESS_BAR
progressBarTick = millis();
progress_bar_ms = millis();
#if PROGRESS_MSG_EXPIRE > 0
expire_status_ms = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
#endif
#endif
lcdDrawUpdate = 2;

View File

@ -194,9 +194,9 @@
#include "utf_mapper.h"
#ifdef LCD_PROGRESS_BAR
static uint16_t progressBarTick = 0;
static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0
static uint16_t expire_status_ms = 0;
static millis_t expire_status_ms = 0;
#endif
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
@ -588,8 +588,9 @@ static void lcd_implementation_status_screen() {
#ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) {
if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
// draw the progress bar
// Draw the progress bar if the message has shown long enough
// or if there is no message set.
if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH+1], b = ' ';