Rockbox

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System Another
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by hearson - 2010-05-07
Last edited by bluebrother - 2020-06-29

FS#11249 - Fixed Morse Code case switching (on Sansa Fuze / FuzeV2 only now).

Hi all,

Currently for all models, the Morse Code input method can only type lowercased letters. Here I provide a patch which enables people to switch between lower cased and upper cased letters, I implemented this for Fuze and Fuze v2, and further fixes will be provided soon (or someone else want to add some key mapping options into your keymaps?)

The patch (also attached):

Index: apps/action.h

— apps/action.h (revision 25886)
+++ apps/action.h (working copy)
@@ -239,6 +239,7 @@

   ACTION_KBD_DOWN,
   ACTION_KBD_MORSE_INPUT,
   ACTION_KBD_MORSE_SELECT,

+ ACTION_KBD_MORSE_CASE_SWITCH,

   

#ifdef HAVE_TOUCHSCREEN

   /* the following are helper actions for touchscreen targets,

Index: apps/recorder/keyboard.c

— apps/recorder/keyboard.c (revision 25886)
+++ apps/recorder/keyboard.c (working copy)
@@ -148,6 +148,7 @@

#ifdef HAVE_MORSE_INPUT
/* FIXME: We should put this to a configuration file. */
+static bool morse_uppercase = false;
static const char *morse_alphabets =

   "abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";

static const unsigned char morse_codes[] = {
@@ -573,6 +574,11 @@

                       state.morse_code |= 0x01;
               }
               break;

+ case ACTION_KBD_MORSE_CASE_SWITCH:
+ if (state.morse_mode) {
+ morse_uppercase = !morse_uppercase;
+ }
+ break;
#endif /* HAVE_MORSE_INPUT */

           case ACTION_KBD_SELECT:

@@ -626,7 +632,8 @@

                   /* turn off hangul input */
                   state.hangul = false;

- kbd_inschar(&state, morse_alphabets[j]);
+ kbd_inschar(&state,
+ morse_uppercase ? toupper(morse_alphabets[j]) : morse_alphabets[j]);

               }

#endif /* HAVE_MORSE_INPUT */

               break;

@@ -862,6 +869,10 @@

           int morse_code;
           outline[0] = morse_alphabets[i];

+
+ if (morse_uppercase)
+ outline[0] = toupper(outline[0]);
+

           sc->putsxy(x, y, outline);
           morse_code = morse_codes[i];

Index: apps/keymaps/keymap-fuze.c

— apps/keymaps/keymap-fuze.c (revision 25886)
+++ apps/keymaps/keymap-fuze.c (working copy)
@@ -269,6 +269,7 @@

   { ACTION_KBD_DONE,         BUTTON_UP,                        BUTTON_NONE },
   { ACTION_KBD_ABORT,        BUTTON_HOME|BUTTON_REPEAT,        BUTTON_NONE },
   { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL,         BUTTON_NONE },

+ { ACTION_KBD_MORSE_CASE_SWITCH, BUTTON_HOME, BUTTON_NONE },

   LAST_ITEM_IN_LIST

}; /* button_context_keyboard */

From a quick look at the diff it looks that case switching for morse code wasn't a feature before, so this doesn't fix anything but adds a new feature. In this case it should get extended to work on all supported players.

Sorry for not testing on a real Fuze: now added toupper() in keyboard.c. Since toupper is defined when testing with a simulator, and we must provide the implementation for a normal build.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing