summaryrefslogtreecommitdiff
path: root/apps/gui/splash.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/splash.c')
-rw-r--r--apps/gui/splash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 5bb8514d30..efb4b1cda2 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -32,6 +32,8 @@
32#include "strtok_r.h" 32#include "strtok_r.h"
33#include "scrollbar.h" 33#include "scrollbar.h"
34 34
35static long progress_next_tick = 0;
36
35#define MAXLINES (LCD_HEIGHT/6) 37#define MAXLINES (LCD_HEIGHT/6)
36#define MAXBUFFER 512 38#define MAXBUFFER 512
37#define RECT_SPACING 2 39#define RECT_SPACING 2
@@ -194,21 +196,26 @@ void splash(int ticks, const char *str)
194 splashf(ticks, "%s", P2STR((const unsigned char*)str)); 196 splashf(ticks, "%s", P2STR((const unsigned char*)str));
195} 197}
196 198
199/* set delay before progress meter is shown */
200void splash_progress_set_delay(long delay_ticks)
201{
202 progress_next_tick = current_tick + delay_ticks;
203}
204
197/* splash a progress meter */ 205/* splash a progress meter */
198void splash_progress(int current, int total, const char *fmt, ...) 206void splash_progress(int current, int total, const char *fmt, ...)
199{ 207{
200 va_list ap; 208 va_list ap;
201 int vp_flag = VP_FLAG_VP_DIRTY; 209 int vp_flag = VP_FLAG_VP_DIRTY;
202 /* progress update tick */ 210 /* progress update tick */
203 static long next_tick = 0;
204 long now = current_tick; 211 long now = current_tick;
205 212
206 if (current < total) 213 if (current < total)
207 { 214 {
208 if(TIME_BEFORE(now, next_tick)) 215 if(TIME_BEFORE(now, progress_next_tick))
209 return; 216 return;
210 /* limit to 20fps */ 217 /* limit to 20fps */
211 next_tick = now + HZ/20; 218 progress_next_tick = now + HZ/20;
212 vp_flag = 0; /* don't mark vp dirty to prevent flashing */ 219 vp_flag = 0; /* don't mark vp dirty to prevent flashing */
213 } 220 }
214 221