August 4, 200520 yr Okay, I'm relatively new to gauge coding, but I've been working pretty steadily on the things I'm doing for a couple of weeks. I've come across a problem with the autobrake value.I'm working on an electronic checklist. It's supposed to be that if the switch is set to RTO or OFF, the function is not completed. I've been messing with this all sorts of different ways, and I've been stumped for two days on this problem.FLOAT64 FSAPI autobrake_set_cb(PELEMENT_STRING pelement){ lookup_var(&autobrake); FLOAT64 val=pelement->source_var[0].var_value.n; val=!val; wsprintf(pelement->string, "AUTOBRAKE SET"); FLOAT64 val_autobrake = autobrake.var_value.n; //14 { if(val_autobrake == 0 && val_autobrake == 1) { pelement->fg_color = RGB(255,255,255); wsprintf(pelement->string, "AUTOBRAKE SET"); } else { pelement->fg_color = RGB(0,255,0); wsprintf(pelement->string, "AUTOBRAKE SET "); } } return 0;}I've tried various ways of making that work, up to and including separate commands for each setting of the AB switch. I'm ready to shotgun my computer!Any suggestions would be appreciated. (Be kind, I'm new to this! :) )
August 4, 200520 yr Moderator if(val_autobrake == 0 && val_autobrake == 1)What's wrong with the above? How will val_autobrake ever be both on and off at the same time... ;) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
August 4, 200520 yr Bill:It also doesn't work if it's:if(val_autobrake != 0 && val_autobrake != 1) orif(val_autobrake != 0 && val_autobrake != 1) orif(val_autobrake > 1) orif(val_autobrake == 2 || val_autobrake == 3 || val_autobrake == 4, val_autobrake == 5) orJust about any combination. I know this is simple (I have some VB experience, so I'm familiar with program flow conrol...) ARGH is a common expression here lately, usually followed by a stream of vintage Marine Corps profanity. I've been working on this for about 2 days straight now.
Create an account or sign in to comment