FIX: Ticker bug where filename wouldn't start at first character

This commit is contained in:
sweetlilmre
2014-08-23 16:32:23 +02:00
parent 3b4b88b47f
commit a59d3caa75
4 changed files with 16 additions and 13 deletions
+10 -7
View File
@@ -16,6 +16,7 @@ char g_char_buffer[MAX_LCD_LINE_LEN + 1] = {0};
static uint8_t g_ticker_enabled = 0;
static uint8_t g_ticker_index = 0;
static uint32_t g_last_tick = 0;
static uint32_t g_last_hold = 0;
uint8_t backslashChar[8] = {
0b00000,
@@ -30,7 +31,7 @@ uint8_t backslashChar[8] = {
void filename_ticker(FILINFO* pfile_info, uint32_t cur_tick) {
static uint32_t last_hold = 0;
char* ticker_string;
if (g_ticker_enabled) {
@@ -42,24 +43,24 @@ void filename_ticker(FILINFO* pfile_info, uint32_t cur_tick) {
}
g_last_tick = cur_tick;
if (!last_hold) last_hold = cur_tick;
if (!g_last_hold) g_last_hold = cur_tick;
// how long do we hold?
if (cur_tick - last_hold < (uint32_t) g_ticker_hold) {
if (cur_tick - g_last_hold < (uint32_t) g_ticker_hold_rate) {
return;
}
ticker_string = pfile_info->lfname[0] ? pfile_info->lfname : pfile_info->fname;
// is the filename within screen bounds?
if ((strlen(ticker_string) - g_ticker_index) <= MAX_LCD_LINE_LEN) {
if ((strlen(ticker_string) - g_ticker_index) < MAX_LCD_LINE_LEN) {
// how long do we hold at the end?
if (cur_tick - last_hold < (uint32_t) (g_ticker_hold << 1)) {
if (cur_tick - g_last_hold < (uint32_t) (g_ticker_hold_rate << 1)) {
return;
}
g_ticker_index = 0;
g_last_tick = last_hold = 0;
g_last_tick = g_last_hold = 0;
} else {
//reset to avoid overflow
last_hold = cur_tick - g_ticker_hold - 1;
g_last_hold = cur_tick - g_ticker_hold_rate - 1;
g_ticker_index++;
}
@@ -80,6 +81,8 @@ void display_filename(FILINFO* pfile_info) {
}
g_ticker_enabled = strlen(ticker_string) > (MAX_LCD_LINE_LEN - 1);
g_ticker_index = 0;
g_last_tick = 0;
g_last_hold = 0;
}
void lcd_spinner_internal(uint32_t cur_tick, int8_t perc, uint16_t rate) {
+2 -2
View File
@@ -355,9 +355,9 @@ void handle_mode_options() {
}
break;
case OPTION_TICKER_HOLD:
value = g_ticker_hold * 10;
value = g_ticker_hold_rate * 10;
if (handle_option_value(S_MODE_OPTIONS, S_OPTION_TICKER_HOLD, &value, 250, 2500, 250)) {
g_ticker_hold = value / 10;
g_ticker_hold_rate = value / 10;
save = 1;
}
break;
+3 -3
View File
@@ -54,7 +54,7 @@ static volatile uint32_t g_timer_tick = 0; // timer tick at 100Hz (10 ms in
volatile uint8_t g_invert_signal = 0; // invert the signal for transmission/reception to/from a real Datasette
volatile uint16_t g_ticker_rate = TICKER_RATE / 10;
volatile uint16_t g_ticker_hold = TICKER_HOLD / 10;
volatile uint16_t g_ticker_hold_rate = TICKER_HOLD / 10;
volatile uint16_t g_key_repeat_start = KEY_REPEAT_START / 10;
volatile uint16_t g_key_repeat_next = KEY_REPEAT_NEXT / 10;
volatile uint16_t g_rec_finalize_time = REC_FINALIZE_TIME / 10;
@@ -453,7 +453,7 @@ void load_eeprom_data() {
if (eeprom_read_byte((uint8_t *) 0) == 0xE7) {
// g_invert_signal = eeprom_read_byte((uint8_t *) 1);
g_ticker_rate = eeprom_read_byte((uint8_t *) 2);
g_ticker_hold = eeprom_read_byte((uint8_t *) 3);
g_ticker_hold_rate = eeprom_read_byte((uint8_t *) 3);
g_key_repeat_start = eeprom_read_byte((uint8_t *) 4);
g_key_repeat_next = eeprom_read_byte((uint8_t *) 5);
g_rec_finalize_time = eeprom_read_byte((uint8_t *) 6);
@@ -464,7 +464,7 @@ void save_eeprom_data() {
eeprom_write_byte((uint8_t *) 0, 0xE7);
// eeprom_write_byte((uint8_t *) 1, g_invert_signal);
eeprom_write_byte((uint8_t *) 2, g_ticker_rate);
eeprom_write_byte((uint8_t *) 3, g_ticker_hold);
eeprom_write_byte((uint8_t *) 3, g_ticker_hold_rate);
eeprom_write_byte((uint8_t *) 4, g_key_repeat_start);
eeprom_write_byte((uint8_t *) 5, g_key_repeat_next);
eeprom_write_byte((uint8_t *) 6, g_rec_finalize_time);
+1 -1
View File
@@ -11,7 +11,7 @@ void save_eeprom_data();
extern volatile uint8_t g_invert_signal;
extern volatile uint8_t g_ticker_rate;
extern volatile uint8_t g_ticker_hold;
extern volatile uint8_t g_ticker_hold_rate;
extern volatile uint8_t g_key_repeat_next;
extern volatile uint8_t g_rec_finalize_time;