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 #define TRAINER_COLUMN_WIDTH 60
24 #define TRAINER_COLUMN_1 MENUS_MARGIN_LEFT+100
25 #define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH
26 #define TRAINER_COLUMN_3 TRAINER_COLUMN_2+TRAINER_COLUMN_WIDTH
28 bool menuRadioTrainer(event_t event
)
31 bool slave
= SLAVE_MODE();
33 MENU(STR_MENUTRAINER
, RADIO_ICONS
, menuTabGeneral
, MENU_RADIO_TRAINER
, (slave
? 0 : 6), { NAVIGATION_LINE_BY_LINE
|2, NAVIGATION_LINE_BY_LINE
|2, NAVIGATION_LINE_BY_LINE
|2, NAVIGATION_LINE_BY_LINE
|2, 0, 0});
36 lcdDrawText(LCD_W
/2, 5*FH
, STR_SLAVE
, CENTERED
|TEXT_COLOR
);
41 LcdFlags blink
= ((s_editMode
>0) ? BLINK
|INVERS
: INVERS
);
43 /* lcdDrawText(TRAINER_COLUMN_1, MENU_HEADER_HEIGHT+1, "Mode", HEADER_COLOR);
44 lcdDrawText(TRAINER_COLUMN_2, MENU_HEADER_HEIGHT+1, "Weight", HEADER_COLOR);
45 lcdDrawText(TRAINER_COLUMN_3, MENU_HEADER_HEIGHT+1, "Source", HEADER_COLOR);
48 y
= MENU_CONTENT_TOP
+ FH
;
50 for (uint8_t i
=0; i
<NUM_STICKS
; i
++) {
51 uint8_t chan
= channel_order(i
+1);
52 TrainerMix
* td
= &g_eeGeneral
.trainer
.mix
[chan
-1];
54 drawSource(MENUS_MARGIN_LEFT
, y
, MIXSRC_Rud
-1+chan
, ((menuVerticalPosition
==i
&& CURSOR_ON_LINE()) ? INVERS
: 0));
56 for (int j
=0; j
<3; j
++) {
58 attr
= ((menuVerticalPosition
==i
&& menuHorizontalPosition
==j
) ? blink
: 0);
62 lcdDrawTextAtIndex(TRAINER_COLUMN_1
, y
, STR_TRNMODE
, td
->mode
, attr
);
63 if (attr
&BLINK
) CHECK_INCDEC_GENVAR(event
, td
->mode
, 0, 2);
67 lcdDrawNumber(TRAINER_COLUMN_2
, y
, td
->studWeight
, LEFT
|attr
, 0, NULL
, "%");
68 if (attr
&BLINK
) CHECK_INCDEC_GENVAR(event
, td
->studWeight
, -125, 125);
72 lcdDrawTextAtIndex(TRAINER_COLUMN_3
, y
, STR_TRNCHN
, td
->srcChn
, attr
);
73 if (attr
&BLINK
) CHECK_INCDEC_GENVAR(event
, td
->srcChn
, 0, 3);
80 attr
= (menuVerticalPosition
==4) ? blink
: 0;
81 lcdDrawText(MENUS_MARGIN_LEFT
, MENU_CONTENT_TOP
+ 5*FH
, STR_MULTIPLIER
);
82 lcdDrawNumber(TRAINER_COLUMN_1
, MENU_CONTENT_TOP
+ 5*FH
, g_eeGeneral
.PPM_Multiplier
+10, LEFT
|attr
|PREC1
);
83 if (attr
) CHECK_INCDEC_GENVAR(event
, g_eeGeneral
.PPM_Multiplier
, -10, 40);
85 attr
= (menuVerticalPosition
==5) ? INVERS
: 0;
86 if (attr
) s_editMode
= 0;
87 lcdDrawText(MENUS_MARGIN_LEFT
, MENU_CONTENT_TOP
+ 6*FH
, STR_CAL
, attr
);
88 for (int i
=0; i
<4; i
++) {
89 #if defined (PPM_UNIT_PERCENT_PREC1)
90 lcdDrawNumber(TRAINER_COLUMN_1
+i
*TRAINER_COLUMN_WIDTH
, MENU_CONTENT_TOP
+ 6*FH
, (ppmInput
[i
]-g_eeGeneral
.trainer
.calib
[i
])*2, LEFT
|PREC1
);
92 lcdDrawNumber(TRAINER_COLUMN_1
+i
*TRAINER_COLUMN_WIDTH
, MENU_CONTENT_TOP
+ 6*FH
, (ppmInput
[i
]-g_eeGeneral
.trainer
.calib
[i
])/5, LEFT
);
97 if (event
==EVT_KEY_LONG(KEY_ENTER
)){
98 memcpy(g_eeGeneral
.trainer
.calib
, ppmInput
, sizeof(g_eeGeneral
.trainer
.calib
));
99 storageDirty(EE_GENERAL
);