Browse Source

display_loop.c, uart_commands.c: more reliable "prev" command

feature/2015
Christian Kroll 10 years ago
parent
commit
09ce8f22b3
  1. 12
      src/display_loop.c
  2. 11
      src/uart/uart_commands.c

12
src/display_loop.c

@ -1,5 +1,6 @@
#include <setjmp.h>
#include <stdbool.h>
#include <stdio.h>
#include "config.h"
@ -49,7 +50,7 @@
# include "joystick/joystick.h"
#endif
volatile unsigned char oldMode, oldOldmode, mode;
volatile unsigned char oldMode, oldOldmode, reverseMode, mode;
jmp_buf newmode_jmpbuf;
@ -77,6 +78,7 @@ void display_loop(){
clear_screen(0);
#endif
oldMode = mode;
switch(mode++) {
#ifdef ANIMATION_SCROLLTEXT
@ -365,6 +367,14 @@ void display_loop(){
off();
break;
#endif
default:
if (reverseMode) {
if (reverseMode-- == (mode - 1)) {
mode -= 2;
} else {
reverseMode = 0;
}
}
}
}
}

11
src/uart/uart_commands.c

@ -22,7 +22,8 @@ char g_rx_buffer[UART_BUFFER_SIZE];
uint8_t g_rx_index;
extern jmp_buf newmode_jmpbuf;
volatile unsigned char mode;
extern volatile unsigned char mode;
extern volatile unsigned char reverseMode;
#if !(defined(eeprom_update_block) && \
((E2PAGESIZE == 2) || (E2PAGESIZE == 4) || (E2PAGESIZE == 8)))
@ -138,12 +139,14 @@ static void uartcmd_next_anim(void) {
static void uartcmd_prev_anim(void) {
uart_puts_p(UART_STR_PROMPT);
uartcmd_clear_buffer();
if (mode > 1) {
#ifdef JOYSTICK_SUPPORT
if (waitForFire)
if (waitForFire) {
reverseMode = mode - 2;
#endif
longjmp(newmode_jmpbuf, mode - 2);
longjmp(newmode_jmpbuf, mode - 2);
#ifdef JOYSTICK_SUPPORT
}
#endif
}

Loading…
Cancel
Save