set menu_channels_mixed immediately after each change

This commit is contained in:
Pavel Semerad
2012-05-24 11:28:34 +02:00
parent 0f35425725
commit cdadddd348
3 changed files with 17 additions and 8 deletions

1
menu.h
View File

@@ -105,6 +105,7 @@ extern s16 menu_change_val(s16 val, s16 min, s16 max, u8 amount_fast, u8 rotate
extern void apply_global_config(void);
extern void menu_load_model(void);
extern void apply_model_config(void);
extern void set_menu_channels_mixed(void);
extern u8 menu_electronic_trims(void);
extern u8 menu_buttons(void);
extern u8 *menu_et_function_name(u8 n);

View File

@@ -50,14 +50,8 @@ u16 battery_low_raw;
// apply model settings to variables
void apply_model_config(void) {
u8 i, autorepeat = 0;
// set number of channels for this model
ppm_set_channels((u8)(cm.channels + 1));
// set mixed channels to ignore them from menu_channel3_8
// set menu_channels_mixed to ignore them from menu_channel3_8
void set_menu_channels_mixed(void) {
menu_channels_mixed = 0;
if (cm.channel_4WS)
menu_channels_mixed |= (u8)(1 << (u8)(cm.channel_4WS - 1));
@@ -65,6 +59,17 @@ void apply_model_config(void) {
menu_channels_mixed |= (u8)(1 << (u8)(cm.channel_DIG - 1));
if (cm.channel_brake)
menu_channels_mixed |= (u8)(1 << (u8)(cm.channel_brake - 1));
}
// apply model settings to variables
void apply_model_config(void) {
u8 i, autorepeat = 0;
// set number of channels for this model
ppm_set_channels((u8)(cm.channels + 1));
set_menu_channels_mixed();
// set autorepeat
for (i = 0; i < 4; i++) {

View File

@@ -46,6 +46,7 @@ static void mix_4WS(u8 action) {
val = (u8)menu_change_val(val, 2, channels, 1, 1);
if (val == 2) cm.channel_4WS = 0;
else cm.channel_4WS = val;
set_menu_channels_mixed();
break;
case 1:
// mix value
@@ -99,6 +100,7 @@ static void mix_DIG(u8 action) {
val = (u8)menu_change_val(val, 1, channels, 1, 1);
if (val == 2) cm.channel_DIG = 0;
else cm.channel_DIG = val;
set_menu_channels_mixed();
break;
case 1:
// mix value
@@ -249,6 +251,7 @@ static void mix_brake_channel(u8 action) {
val = (u8)menu_change_val(val, 2, channels, 1, 1);
if (val == 2) val = 0;
cm.channel_brake = val;
set_menu_channels_mixed();
}
// show value