From 0394ebe44df99f8fc725dc4a66ab37209ef4d55b Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sat, 22 Nov 2008 10:31:33 +0000 Subject: [PATCH] FS#9557 - fix the %mv and %t timeout so its intrepreted correctly git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19177 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 12 ++++++++++-- apps/gui/gwps.h | 3 --- apps/gui/wps_parser.c | 3 +-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index a81b8555f7..a0e09b8117 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -65,6 +65,14 @@ /* 3% of 30min file == 54s step size */ #define MIN_FF_REWIND_STEP 500 +/* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds + (possibly with a decimal fraction) but stored as integer values. + E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. +*/ +#define TIMEOUT_UNIT (HZ/10) /* I.e. 0.1 sec */ +#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */ + + /* draws the statusbar on the given wps-screen */ #ifdef HAVE_LCD_BITMAP static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force) @@ -1391,7 +1399,7 @@ static const char *get_token_value(struct gui_wps *gwps, case WPS_TOKEN_BUTTON_VOLUME: if (data->button_time_volume && TIME_BEFORE(current_tick, data->button_time_volume + - token->value.i)) + token->value.i * TIMEOUT_UNIT)) return "v"; return NULL; default: @@ -1728,7 +1736,7 @@ static bool update_curr_subline(struct gui_wps *gwps, int line) new_subline_refresh = true; data->lines[line].subline_expire_time = (reset_subline ? current_tick : data->lines[line].subline_expire_time) + - BASE_SUBLINE_TIME*data->sublines[subline_idx].time_mult; + TIMEOUT_UNIT*data->sublines[subline_idx].time_mult; break; } } diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 6a4849c347..ff402a73a9 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -121,9 +121,6 @@ struct align_pos { #endif -#define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* (10ths of sec) */ -#define BASE_SUBLINE_TIME 10 /* base time that multiplier is applied to - (1/HZ sec, or 100ths of sec) */ #define SUBLINE_RESET -1 enum wps_parse_error { diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index d43680cae7..ca15348eae 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -26,7 +26,6 @@ #include "file.h" #include "misc.h" #include "plugin.h" -#include "kernel.h" #ifdef __PCTOOL__ #ifdef WPSEDITOR @@ -811,7 +810,7 @@ static int parse_timeout(const char *wps_bufptr, case WPS_TOKEN_SUBLINE_TIMEOUT: return -1; case WPS_TOKEN_BUTTON_VOLUME: - val = HZ; + val = 10; break; } }