Fix trims and keys for NV14

This commit is contained in:
3djc
2019-12-14 10:48:43 +01:00
parent 63f819ebeb
commit e7e85a2aa5
2 changed files with 22 additions and 11 deletions
+21 -11
View File
@@ -54,16 +54,22 @@ class RadioKeyDiagsWindow : public Window
void paint(BitmapBuffer * dc) override
{
#if !defined(PCBNV14)
constexpr coord_t KEY_COLUMN = 6;
constexpr coord_t SWITCHES_COLUMN = LCD_W / 2 - 20;
constexpr coord_t TRIM_COLUMN = LCD_W - 120;
#else
constexpr coord_t SWITCHES_COLUMN = LCD_W / 6;
constexpr coord_t TRIM_COLUMN = LCD_W / 2;
#endif
constexpr coord_t TRIM_MINUS_COLUMN = TRIM_COLUMN + 60;
constexpr coord_t TRIM_PLUS_COLUMN = TRIM_MINUS_COLUMN + 20;
constexpr coord_t SWITCHES_COLUMN = LCD_W / 2 - 20;
dc->drawText(TRIM_COLUMN, 1, "Trims");
dc->drawText(TRIM_MINUS_COLUMN, 1, "-");
dc->drawText(TRIM_PLUS_COLUMN, 1, "+");
#if !defined(PCBNV14)
//KEYS
for (uint8_t i = KEY_START; i <= 6; i++) {
coord_t y = 1 + FH * (i - KEY_START);
@@ -75,7 +81,7 @@ class RadioKeyDiagsWindow : public Window
dc->drawText(KEY_COLUMN, y, STR_ROTARY_ENCODER);
dc->drawNumber(70, y, rotencValue, 0);
#endif
#endif
// SWITCHES
for (uint8_t i = 0; i < NUM_SWITCHES; i++) {
if (SWITCH_EXISTS(i)) {
@@ -87,15 +93,19 @@ class RadioKeyDiagsWindow : public Window
}
// TRIMS
// for (uint8_t i = 0; i < NUM_TRIMS_KEYS; i++) {
// const uint8_t trimMap[NUM_TRIMS_KEYS] = {6, 7, 4, 5, 2, 3, 0, 1, 8, 9, 10, 11};
// coord_t y = 1 + FH + FH * (i / 2);
// if (i & 1) {
// dc->drawText(TRIM_COLUMN, y, "T", 0);
// dc->drawNumber(TRIM_COLUMN + 10, y, i / 2 + 1, 0);
// }
// displayKeyState(dc, i & 1 ? TRIM_PLUS_COLUMN : TRIM_MINUS_COLUMN, y, TRM_BASE + trimMap[i]);
// }
for (uint8_t i = 0; i < NUM_TRIMS_KEYS; i++) {
#if NUM_TRIMS_KEYS == 12
const uint8_t trimMap[NUM_TRIMS_KEYS] = {6, 7, 4, 5, 2, 3, 0, 1, 8, 9, 10, 11};
#else
const uint8_t trimMap[NUM_TRIMS_KEYS] = {6, 7, 4, 5, 2, 3, 0, 1};
#endif
coord_t y = 1 + FH + FH * (i / 2);
if (i & 1) {
dc->drawText(TRIM_COLUMN, y, "T", 0);
dc->drawNumber(TRIM_COLUMN + 10, y, i / 2 + 1, 0);
}
displayKeyState(dc, i & 1 ? TRIM_PLUS_COLUMN : TRIM_MINUS_COLUMN, y, TRM_BASE + trimMap[i]);
}
};
protected:
+1
View File
@@ -236,6 +236,7 @@ uint32_t switchState(uint8_t index);
uint32_t readKeys();
uint32_t readTrims();
#define NUM_TRIMS NUM_STICKS
#define NUM_TRIMS_KEYS (NUM_TRIMS * 2)
#define TRIMS_PRESSED() (readTrims())
#define KEYS_PRESSED() (readKeys())
#define DBLKEYS_PRESSED_RGT_LFT(in) (false)