bool ledseqTest(void) { bool status; status = isInit & ledTest(); ledseqEnable(true); return status; }
void offFlightRcUI(void) { enginesOff(); engineStatus = ENGINE_OFF; if((PWM_channel[PWM_THROTTLE] >= FULL_UP) && PWM_channel[PWM_G] <= FULL_RIGHT) { if (PWM_channel[PWM_R] <= FULL_RIGHT) { calib_MM3(); } } if (PWM_channel[PWM_THROTTLE] >= FULL_UP && PWM_channel[PWM_G] >= FULL_LEFT) { //nick 0 roll full left select setting 1 if (PWM_channel[PWM_N] >= -10 && PWM_channel[PWM_N] <= 10 && PWM_channel[PWM_R] >= FULL_LEFT){ setupCache = (INCOMINGSETTINGS)setupCacheT0; printLoadSetting(0); } //nick full up roll full left select setting 2 if (PWM_channel[PWM_N] >= FULL_UP && PWM_channel[PWM_R] >= FULL_LEFT){ setupCache = (INCOMINGSETTINGS)setupCacheT1; printLoadSetting(1); } //nick full up roll 0 select setting 3 if (PWM_channel[PWM_N] >= FULL_UP && PWM_channel[PWM_R] >= -10 && PWM_channel[PWM_R]< 10){ setupCache = (INCOMINGSETTINGS)setupCacheT2; printLoadSetting(2); } //nick full up roll full right select setting 4 if (PWM_channel[PWM_N] >= FULL_UP && PWM_channel[PWM_R] <= FULL_RIGHT){ setupCache = (INCOMINGSETTINGS)setupCacheT3; printLoadSetting(3); } //nick 0 roll full right select setting 5 if (PWM_channel[PWM_N] >= -10 && PWM_channel[PWM_N] <= 10 && PWM_channel[PWM_R] <= FULL_RIGHT){ setupCache = (INCOMINGSETTINGS)setupCacheT4; printLoadSetting(4); } //nick full down roll full right select setting 6 if (PWM_channel[PWM_N] <= FULL_DOWN && PWM_channel[PWM_R] <= FULL_RIGHT){ setupCache = (INCOMINGSETTINGS)setupCacheT5; printLoadSetting(5); } setToInSettings(); ADCStandstillValues(); ledTest(); } //start Engines if right signal is received Gas down and Pitch full right if((PWM_channel[PWM_THROTTLE] <= FULL_DOWN) && PWM_channel[PWM_G] <= FULL_RIGHT ) //start Engine signal { //initFCRuntime(); //resetADCmuxer(); engineStatus = ENGINE_ON; LED1_ON; } }
void serialUI(void) { if (commandRetrived == 1) { if (commandType == 0) { checkCmd(); commandRetrived = 0; } if (commandType == 1) { if (setCmd == 0) { //this is to send in data. the data is not yet flashed led_switch(2); //data can be send in at any time also at flight time //it will be used with the next cycle print_uart0("FCm0;storing setting %d;00#",setupCache.settingNum); setToInSettings(); //fill the runtime struct with the settings setTempToInSetting(setupCache.settingNum); //save settings to ram cache commandRetrived = 0; } if (setCmd == 1) { print_uart0("FCm0;flashing settings;00#"); //here we write all the settings from ram to flash enginesOff(); //this is to save some of the flashing cycles. led_switch(3); //we could flash with any retrieved setting but that engineStatus = 0; //just helps abusing the flash cycles so its a manual //step to really save to flash writeSetup(); ADCStandstillValues(); //also we reset the ADCOffset commandRetrived = 0; initFCRuntime(); ledTest(); } } if (commandType == 2) { updateAcdRate(); commandRetrived = 0; } if (commandType == 3) { retriveSetting(); printSettings(); commandRetrived = 0; } if (commandType == 4) { if (I2CcmdType == I2CMODE_WRITEADDRESS){ if (updateYGE == 0) { I2C0Mode = I2CMODE_WRITEADDRESS; I2C0State = 0; updateYGE = 1; I2C0Start(); } } if (I2CcmdType == I2CMODE_STARTUP_TARGET){ if (updateYGE == 0) { I2C0Stop(); I2C0Mode = I2CMODE_WRITEADDRESS; I2C0State = 0; updateYGE = 1; I2C0Start(); } } commandRetrived = 0; } } }
bool ledseqTest(void) { return isInit & ledTest(); }