summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-05-16 16:44:01 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-05-22 12:20:44 +0000
commit5cbeb88541ebbfe388b3d60a1c7564b556b9748b (patch)
tree9ef43acdc857fa3b9be01bf35a45ab2b2ac19b3f
parenta2bac25a6355d1ac59df34717a28c3c03728c885 (diff)
downloadrockbox-5cbeb88541ebbfe388b3d60a1c7564b556b9748b.tar.gz
rockbox-5cbeb88541ebbfe388b3d60a1c7564b556b9748b.zip
FiiO M3K: keymap improvements & fixes
- Add support for skip and seek while the player is locked. (Thanks to @bahus for the suggestion) - Fix touch zones because the down button zone ended up being a lot smaller than expected due to the touchpad's wonkiness. Also added a visual display of the touchpad to its debug menu. - Fixes the pictureflow keymap because it was mostly unusable. Change-Id: Ic0da4f8df3613ff7828ce1cb940ed9e77ada3281
-rw-r--r--apps/keymaps/keymap-fiiom3k.c19
-rw-r--r--apps/plugins/pictureflow/pictureflow.c9
-rw-r--r--firmware/export/config/fiiom3k.h1
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c61
4 files changed, 85 insertions, 5 deletions
diff --git a/apps/keymaps/keymap-fiiom3k.c b/apps/keymaps/keymap-fiiom3k.c
index 440f851650..94d2dbc172 100644
--- a/apps/keymaps/keymap-fiiom3k.c
+++ b/apps/keymaps/keymap-fiiom3k.c
@@ -76,6 +76,16 @@ static const struct button_mapping button_context_wps[] = {
76 LAST_ITEM_IN_LIST 76 LAST_ITEM_IN_LIST
77}; /* button_context_wps */ 77}; /* button_context_wps */
78 78
79static const struct button_mapping button_context_wps_locked[] = {
80 {ACTION_WPS_SKIPNEXT, BUTTON_VOL_UP|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_UP},
81 {ACTION_WPS_SEEKFWD, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
82 {ACTION_WPS_STOPSEEK, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REPEAT},
83 {ACTION_WPS_SKIPPREV, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_DOWN},
84 {ACTION_WPS_SEEKBACK, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
85 {ACTION_WPS_STOPSEEK, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REPEAT},
86 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_WPS)
87}; /* button_context_wps_locked */
88
79static const struct button_mapping button_context_tree[] = { 89static const struct button_mapping button_context_tree[] = {
80 {ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY}, 90 {ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
81 {ACTION_TREE_WPS, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK}, 91 {ACTION_TREE_WPS, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK},
@@ -244,6 +254,15 @@ const struct button_mapping* get_context_mapping(int context)
244{ 254{
245 switch (context) 255 switch (context)
246 { 256 {
257 case CONTEXT_WPS|CONTEXT_LOCKED:
258 return button_context_wps_locked;
259 default:
260 context &= ~CONTEXT_LOCKED;
261 break;
262 }
263
264 switch (context)
265 {
247 default: 266 default:
248 case CONTEXT_STD: 267 case CONTEXT_STD:
249 return button_context_standard; 268 return button_context_standard;
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 9faf53661e..9731d92d35 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -148,6 +148,15 @@ const struct button_mapping pf_context_buttons[] =
148 {PF_CONTEXT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_FFWD}, 148 {PF_CONTEXT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_FFWD},
149 {PF_TRACKLIST, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD}, 149 {PF_TRACKLIST, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD},
150 {PF_WPS, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY}, 150 {PF_WPS, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
151#elif CONFIG_KEYPAD == FIIO_M3K_PAD
152 {PF_PREV, BUTTON_LEFT, BUTTON_NONE},
153 {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
154 {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE},
155 {PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
156 {PF_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
157 {PF_QUIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER},
158 {PF_CONTEXT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
159 {PF_TRACKLIST, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
151#endif 160#endif
152#if CONFIG_KEYPAD == IAUDIO_M3_PAD 161#if CONFIG_KEYPAD == IAUDIO_M3_PAD
153 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE) 162 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE)
diff --git a/firmware/export/config/fiiom3k.h b/firmware/export/config/fiiom3k.h
index 86f41fca46..2c212b031d 100644
--- a/firmware/export/config/fiiom3k.h
+++ b/firmware/export/config/fiiom3k.h
@@ -124,4 +124,5 @@
124#define HAVE_VOLUME_IN_LIST 124#define HAVE_VOLUME_IN_LIST
125#define HAVE_QUICKSCREEN 125#define HAVE_QUICKSCREEN
126#define HAVE_HOTKEY 126#define HAVE_HOTKEY
127#define HAVE_LOCKED_ACTIONS
127#define AB_REPEAT_ENABLE 128#define AB_REPEAT_ENABLE
diff --git a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
index e27e0be464..b5193152a2 100644
--- a/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
+++ b/firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
@@ -110,6 +110,19 @@ static struct ft_state_machine {
110 int cur_x, cur_y; 110 int cur_x, cur_y;
111} fsm; 111} fsm;
112 112
113/* coordinates below this are the left hand buttons,
114 * coordinates above this are part of the scrollbar */
115#define SCROLLSTRIP_LEFT_X 80
116
117/* top and bottom cutoffs for the center of the strip,
118 * divides it into top/middle/bottom zones */
119#define SCROLLSTRIP_TOP_Y 105
120#define SCROLLSTRIP_BOT_Y 185
121
122/* cutoffs for the menu/left button zones */
123#define MENUBUTTON_Y 80
124#define LEFTBUTTON_Y 190
125
113static int touch_to_button(int x, int y) 126static int touch_to_button(int x, int y)
114{ 127{
115 if(x == 900) { 128 if(x == 900) {
@@ -120,19 +133,19 @@ static int touch_to_button(int x, int y)
120 return BUTTON_RIGHT; 133 return BUTTON_RIGHT;
121 else 134 else
122 return 0; 135 return 0;
123 } else if(x < 80) { 136 } else if(x < SCROLLSTRIP_LEFT_X) {
124 /* Left strip */ 137 /* Left strip */
125 if(y < 80) 138 if(y < MENUBUTTON_Y)
126 return BUTTON_MENU; 139 return BUTTON_MENU;
127 else if(y > 190) 140 else if(y > LEFTBUTTON_Y)
128 return BUTTON_LEFT; 141 return BUTTON_LEFT;
129 else 142 else
130 return 0; 143 return 0;
131 } else { 144 } else {
132 /* Middle strip */ 145 /* Middle strip */
133 if(y < 100) 146 if(y < SCROLLSTRIP_TOP_Y)
134 return BUTTON_UP; 147 return BUTTON_UP;
135 else if(y > 220) 148 else if(y > SCROLLSTRIP_BOT_Y)
136 return BUTTON_DOWN; 149 return BUTTON_DOWN;
137 else 150 else
138 return BUTTON_SELECT; 151 return BUTTON_SELECT;
@@ -489,6 +502,24 @@ bool dbg_fiiom3k_touchpad(void)
489 "IDLE", "PRESS", "REPORT", "SCROLL_PRESS", "SCROLLING" 502 "IDLE", "PRESS", "REPORT", "SCROLL_PRESS", "SCROLLING"
490 }; 503 };
491 504
505 /* definition of box used to represent the touchpad */
506 const int pad_w = LCD_WIDTH;
507 const int pad_h = LCD_HEIGHT;
508 const int box_h = pad_h - SYSFONT_HEIGHT*5;
509 const int box_w = pad_w * box_h / pad_h;
510 const int box_x = (LCD_WIDTH - box_w) / 2;
511 const int box_y = SYSFONT_HEIGHT * 9 / 2;
512
513 /* cutoffs converted to box coordinates */
514 const int ss_left_x = box_x + SCROLLSTRIP_LEFT_X * box_w / pad_w;
515 const int ss_top_y = box_y + SCROLLSTRIP_TOP_Y * box_h / pad_h;
516 const int ss_bot_y = box_y + SCROLLSTRIP_BOT_Y * box_h / pad_h;
517 const int menubtn_y = box_y + MENUBUTTON_Y * box_h / pad_h;
518 const int leftbtn_y = box_y + LEFTBUTTON_Y * box_h / pad_h;
519
520 bool draw_areas = true;
521 bool draw_border = true;
522
492 do { 523 do {
493 int line = 0; 524 int line = 0;
494 lcd_clear_display(); 525 lcd_clear_display();
@@ -496,6 +527,26 @@ bool dbg_fiiom3k_touchpad(void)
496 lcd_putsf(0, line++, "button: %08x", fsm.buttons); 527 lcd_putsf(0, line++, "button: %08x", fsm.buttons);
497 lcd_putsf(0, line++, "pos x: %4d orig x: %4d", fsm.cur_x, fsm.orig_x); 528 lcd_putsf(0, line++, "pos x: %4d orig x: %4d", fsm.cur_x, fsm.orig_x);
498 lcd_putsf(0, line++, "pos y: %4d orig y: %4d", fsm.cur_y, fsm.orig_y); 529 lcd_putsf(0, line++, "pos y: %4d orig y: %4d", fsm.cur_y, fsm.orig_y);
530
531 /* draw touchpad box borders */
532 if(draw_border)
533 lcd_drawrect(box_x, box_y, box_w, box_h);
534
535 /* draw crosshair */
536 int tx = box_x + fsm.cur_x * box_w / pad_w;
537 int ty = box_y + fsm.cur_y * box_h / pad_h;
538 lcd_hline(tx-2, tx+2, ty);
539 lcd_vline(tx, ty-2, ty+2);
540
541 /* draw the button areas */
542 if(draw_areas) {
543 lcd_vline(ss_left_x, box_y, box_y+box_h);
544 lcd_hline(ss_left_x, box_x+box_w, ss_top_y);
545 lcd_hline(ss_left_x, box_x+box_w, ss_bot_y);
546 lcd_hline(box_x, ss_left_x, menubtn_y);
547 lcd_hline(box_x, ss_left_x, leftbtn_y);
548 }
549
499 lcd_update(); 550 lcd_update();
500 } while(getbtn() != BUTTON_POWER); 551 } while(getbtn() != BUTTON_POWER);
501 return false; 552 return false;