5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
23 void menuChannelsView(event_t event
)
25 static bool longNames
= false;
26 static bool secondPage
= false;
27 static bool mixersView
= false;
29 uint8_t wbar
= (longNames
? 54 : 64);
30 int16_t limits
= 512 * 2;
32 #if defined(PPM_UNIT_PERCENT_PREC1)
38 case EVT_KEY_BREAK(KEY_EXIT
):
41 case EVT_KEY_FIRST(KEY_RIGHT
):
42 case EVT_KEY_FIRST(KEY_LEFT
):
43 #if defined(ROTARY_ENCODER_NAVIGATION)
45 case EVT_ROTARY_RIGHT
:
47 secondPage
= !secondPage
;
49 case EVT_KEY_FIRST(KEY_ENTER
):
50 mixersView
= !mixersView
;
58 limits
*= 2; // this could be handled nicer, but slower, by checking actual range for this mixer
59 else if (g_model
.extendedLimits
)
60 limits
*= LIMIT_EXT_PERCENT
/ 100;
63 lcdDrawTextAlignedCenter(0, MIXERS_MONITOR
);
65 lcdDrawTextAlignedCenter(0, CHANNELS_MONITOR
);
70 lcdDrawSolidVerticalLine(LCD_W
/2, FH
, LCD_H
-FH
);
72 for (uint8_t col
=0; col
< 2; col
++) {
73 const uint8_t x
= col
* LCD_W
/ 2 + 1;
74 const uint8_t ofs
= (col
? 0 : 1);
77 for (uint8_t line
=0; line
< 8; line
++) {
78 const uint8_t y
= 9 + line
* 7;
79 const int32_t val
= mixersView
? ex_chans
[ch
] : channelOutputs
[ch
];
80 const uint8_t lenLabel
= ZLEN(g_model
.limitData
[ch
].name
);
82 // Channel name if present, number if not
86 lcdDrawSizedText(x
+1-ofs
, y
, g_model
.limitData
[ch
].name
, sizeof(g_model
.limitData
[ch
].name
), ZCHAR
| SMLSIZE
);
89 putsChn(x
+1-ofs
, y
, ch
+1, SMLSIZE
);
93 #if defined(PPM_UNIT_US)
94 lcdDrawNumber(x
+LCD_W
/2-3-wbar
-ofs
, y
+1, PPM_CH_CENTER(ch
)+val
/2, TINSIZE
|RIGHT
);
95 #elif defined(PPM_UNIT_PERCENT_PREC1)
96 lcdDrawNumber(x
+LCD_W
/2-3-wbar
-ofs
, y
+1, calcRESXto1000(val
), PREC1
|TINSIZE
|RIGHT
);
98 lcdDrawNumber(x
+LCD_W
/2-3-wbar
-ofs
, y
+1, calcRESXto1000(val
)/10, TINSIZE
|RIGHT
);
102 drawGauge(x
+LCD_W
/2-3-wbar
-ofs
, y
, wbar
, 6, val
, limits
);