Browse Source

Use millis_t for progress_bar_ms and expire_status_ms

pull/1/head
Scott Lahteine 10 years ago
parent
commit
c92b59952a
  1. 8
      Marlin/ultralcd.cpp
  2. 9
      Marlin/ultralcd_implementation_hitachi_HD44780.h

8
Marlin/ultralcd.cpp

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

9
Marlin/ultralcd_implementation_hitachi_HD44780.h

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

Loading…
Cancel
Save