[Horus] Keymap is now consistent with labels on keys

This commit is contained in:
Bertrand Songis
2016-03-15 23:21:32 +01:00
parent 9a66da21d5
commit 7e45537402
15 changed files with 99 additions and 152 deletions
+4 -3
View File
@@ -205,9 +205,10 @@ bool menuModelCurveOne(evt_t event)
popupMenuHandler = onCurveOneMenu;
}
break;
case EVT_KEY_LONG(KEY_MENU):
pushMenu(menuChannelsView);
killEvents(event);
// TODO?
// case EVT_KEY_LONG(KEY_MENU):
// pushMenu(menuChannelsView);
// killEvents(event);
}
drawCurve(CURVE_CENTER_X, CURVE_CENTER_Y, CURVE_SIDE_WIDTH);
@@ -19,7 +19,7 @@
*/
#include <stdio.h>
#include "../../opentx.h"
#include "opentx.h"
void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t attr)
{
+8 -22
View File
@@ -19,7 +19,7 @@
*/
#include <stdio.h>
#include "../../opentx.h"
#include "opentx.h"
#define EXPO_ONE_2ND_COLUMN 110
@@ -450,41 +450,27 @@ bool menuModelExposAll(evt_t event)
}
}
break;
case EVT_KEY_LONG(KEY_LEFT):
case EVT_KEY_LONG(KEY_RIGHT):
if (s_copyMode && !s_copyTgtOfs) {
if (reachExposLimit()) break;
s_currCh = chn;
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; menuVerticalPosition++; }
insertExpo(s_currIdx);
pushMenu(menuModelExpoOne);
s_copyMode = 0;
killEvents(event);
}
break;
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP):
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_REPT(KEY_DOWN):
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
if (s_copyMode) {
uint8_t key = (event & 0x1f);
uint8_t next_ofs = ((event==EVT_ROTARY_LEFT || key==KEY_UP) ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
uint8_t next_ofs = ((event==EVT_ROTARY_LEFT) ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
if (s_copyTgtOfs==0 && s_copyMode==COPY_MODE) {
// insert a mix on the same channel (just above / just below)
if (reachExposLimit()) break;
copyExpo(s_currIdx);
if (event==EVT_ROTARY_RIGHT || key==KEY_DOWN) s_currIdx++;
if (event==EVT_ROTARY_RIGHT) s_currIdx++;
else if (sub-menuVerticalOffset >= 6) menuVerticalOffset++;
}
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
// delete the mix
deleteExpo(s_currIdx);
if (event==EVT_ROTARY_LEFT || key==KEY_UP) s_currIdx--;
if (event==EVT_ROTARY_LEFT) s_currIdx--;
}
else {
// only swap the mix with its neighbor
if (!swapExpos(s_currIdx, event==EVT_ROTARY_LEFT || key==KEY_UP)) break;
if (!swapExpos(s_currIdx, event==EVT_ROTARY_LEFT)) break;
storageDirty(EE_MODEL);
}
+7 -5
View File
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
bool isThrottleOutput(uint8_t ch)
{
@@ -176,10 +176,12 @@ bool menuModelLimits(evt_t event)
if (active) {
ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL, NULL, stops1000);
}
else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
copySticksToOffset(k);
s_editMode = 0;
}
// TODO with the contextual menu I think
// else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
// copySticksToOffset(k);
// s_editMode = 0;
// }
break;
case ITEM_LIMITS_MIN:
+8 -22
View File
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
#include <stdio.h>
int getMixesLinesCount()
@@ -421,41 +421,27 @@ bool menuModelMixAll(evt_t event)
}
}
break;
case EVT_KEY_LONG(KEY_LEFT):
case EVT_KEY_LONG(KEY_RIGHT):
if (s_copyMode && !s_copyTgtOfs) {
if (reachMixesLimit()) break;
s_currCh = chn;
if (event == EVT_KEY_LONG(KEY_RIGHT)) { s_currIdx++; menuVerticalPosition++; }
insertMix(s_currIdx);
pushMenu(menuModelMixOne);
s_copyMode = 0;
killEvents(event);
}
break;
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP):
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_REPT(KEY_DOWN):
case EVT_ROTARY_RIGHT:
case EVT_ROTARY_LEFT:
if (s_copyMode) {
uint8_t key = (event & 0x1f);
uint8_t next_ofs = ((event==EVT_ROTARY_LEFT || key==KEY_UP) ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
uint8_t next_ofs = (event==EVT_ROTARY_LEFT ? s_copyTgtOfs - 1 : s_copyTgtOfs + 1);
if (s_copyTgtOfs==0 && s_copyMode==COPY_MODE) {
// insert a mix on the same channel (just above / just below)
if (reachMixesLimit()) break;
copyMix(s_currIdx);
if (event==EVT_ROTARY_RIGHT || key==KEY_DOWN) s_currIdx++;
if (event==EVT_ROTARY_RIGHT) s_currIdx++;
else if (sub-menuVerticalOffset >= 6) menuVerticalOffset++;
}
else if (next_ofs==0 && s_copyMode==COPY_MODE) {
// delete the mix
deleteMix(s_currIdx);
if (event==EVT_ROTARY_LEFT || key==KEY_UP) s_currIdx--;
if (event==EVT_ROTARY_LEFT) s_currIdx--;
}
else {
// only swap the mix with its neighbor
if (!swapMixes(s_currIdx, event==EVT_ROTARY_LEFT || key==KEY_UP)) break;
if (!swapMixes(s_currIdx, event==EVT_ROTARY_LEFT)) break;
storageDirty(EE_MODEL);
}
+11 -48
View File
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*/
#include "../../opentx.h"
#include "opentx.h"
int menuVerticalOffset;
int menuVerticalPosition;
@@ -411,32 +411,33 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
{
uint8_t maxcol = MAXCOL(menuVerticalPosition);
if (menuTab && !calibrationState && menuVerticalPosition<0) {
if (menuTab && !calibrationState) {
int cc = curr;
switch (event) {
case EVT_KEY_BREAK(KEY_RIGHT):
case EVT_ROTARY_RIGHT:
if (menuVerticalPosition >= 0)
break;
// no break
case EVT_KEY_BREAK(KEY_PGDN):
if (++cc == menuTabSize)
cc = 0;
break;
case EVT_KEY_BREAK(KEY_LEFT):
case EVT_ROTARY_LEFT:
if (menuVerticalPosition >= 0)
break;
// no break
case EVT_KEY_BREAK(KEY_PGUP):
if (cc-- == 0)
cc = menuTabSize-1;
break;
case EVT_KEY_BREAK(KEY_ENTER):
if (rowcount > 0) {
if (menuVerticalPosition < 0 && rowcount > 0) {
menuVerticalPosition = MENU_FIRST_LINE_EDIT;
event = 0;
}
break;
case EVT_KEY_BREAK(KEY_DOWN):
case EVT_KEY_BREAK(KEY_UP):
menuHorizontalPosition = -1;
break;
}
if (cc != curr) {
@@ -537,24 +538,6 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
break;
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_REPT(KEY_DOWN):
{
do {
INC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
s_editMode = 0; // if we go down, we must be in this mode
uint8_t newmaxcol = MAXCOL(menuVerticalPosition);
if (COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE) {
menuHorizontalPosition = -1;
}
else if (menuHorizontalPosition < 0 || menuHorizontalPosition > newmaxcol) {
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
}
break;
}
case EVT_ROTARY_LEFT:
if (s_editMode != 0) break;
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
@@ -575,26 +558,6 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
else
menuHorizontalPosition = MAXCOL(menuVerticalPosition);
break;
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP):
{
do {
DEC(menuVerticalPosition, MENU_FIRST_LINE_EDIT, rowcount-1);
} while (CURSOR_NOT_ALLOWED_IN_ROW(menuVerticalPosition));
s_editMode = 0; // if we go up, we must be in this mode
uint8_t newmaxcol = MAXCOL(menuVerticalPosition);
if ((COLATTR(menuVerticalPosition) & NAVIGATION_LINE_BY_LINE)) {
menuHorizontalPosition = -1;
}
else if (menuHorizontalPosition < 0) {
menuHorizontalPosition = POS_HORZ_INIT(menuVerticalPosition);
}
else if (menuHorizontalPosition > newmaxcol) {
menuHorizontalPosition = min((uint8_t)menuHorizontalPosition, newmaxcol);
}
break;
}
}
linesCount = rowcount;
-4
View File
@@ -107,8 +107,6 @@ const char * displayPopupMenu(evt_t event)
switch (event) {
case EVT_ROTARY_LEFT:
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_REPT(KEY_UP):
if (s_menu_item > 0) {
s_menu_item--;
}
@@ -126,8 +124,6 @@ const char * displayPopupMenu(evt_t event)
break;
case EVT_ROTARY_RIGHT:
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_REPT(KEY_DOWN):
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
s_menu_item++;
}
+2 -2
View File
@@ -49,11 +49,11 @@ bool menuAboutView(evt_t event)
screenIndex = 0;
greyIndex = 0;
break;
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_FIRST(KEY_RIGHT):
screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX;
greyIndex = 0;
break;
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_FIRST(KEY_LEFT):
screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS;
greyIndex = 0;
break;
+4 -4
View File
@@ -154,21 +154,21 @@ bool menuMainView(evt_t event)
popupMenuHandler = onMainViewMenu;
break;
case EVT_KEY_BREAK(KEY_MENU):
case EVT_KEY_BREAK(KEY_MODEL):
pushMenu(menuTabModel[0]);
break;
case EVT_KEY_LONG(KEY_MENU):
case EVT_KEY_BREAK(KEY_RADIO):
killEvents(event);
pushMenu(menuTabGeneral[0]);
break;
case EVT_KEY_BREAK(KEY_DOWN):
case EVT_KEY_BREAK(KEY_PGDN):
storageDirty(EE_GENERAL);
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, +1, 0, getMainViewsCount()-1);
break;
case EVT_KEY_BREAK(KEY_UP):
case EVT_KEY_BREAK(KEY_PGUP):
killEvents(event);
storageDirty(EE_GENERAL);
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, -1, 0, getMainViewsCount()-1);