Subversion Repositories FlightCtrl

Rev

Rev 1682 | Rev 1690 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1682 Rev 1683
Line 165... Line 165...
165
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
165
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
166
        // Check connected BL-Ctrls
166
        // Check connected BL-Ctrls
167
        BLFlags |= BLFLAG_READ_VERSION;
167
        BLFlags |= BLFLAG_READ_VERSION;
168
        motor_read = 0;  // read the first I2C-Data
168
        motor_read = 0;  // read the first I2C-Data
169
        SendMotorData();
169
        SendMotorData();
-
 
170
        timer = SetDelay(500);
170
        while(!(BLFlags & BLFLAG_TX_COMPLETE)); //wait for complete transfer
171
        while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer
Line 171... Line 172...
171
 
172
 
172
    printf("\n\rFound BL-Ctrl: ");
173
    printf("\n\rFound BL-Ctrl: ");
173
    timer = SetDelay(4000);
174
    timer = SetDelay(4000);
174
        for(i=0; i < MAX_MOTORS; i++)
175
        for(i=0; i < MAX_MOTORS; i++)
175
        {
176
        {
176
                SendMotorData();
177
                SendMotorData();
177
                while(!(BLFlags & BLFLAG_TX_COMPLETE)); //wait for complete transfer
178
                while(!(BLFlags & BLFLAG_TX_COMPLETE)  && !CheckDelay(timer)); //wait for complete transfer
178
                if(Mixer.Motor[i][0] > 0) // wait max 4 sec for the BL-Ctrls to wake up
179
                if(Mixer.Motor[i][0] > 0) // wait max 4 sec for the BL-Ctrls to wake up
179
                {
180
                {
180
                        while(!CheckDelay(timer) && !(Motor[i].State & MOTOR_STATE_PRESENT_MASK) )
181
                        while(!CheckDelay(timer) && !(Motor[i].State & MOTOR_STATE_PRESENT_MASK) )
181
                        {
182
                        {
182
                                SendMotorData();
183
                                SendMotorData();
183
                                while(!(BLFlags & BLFLAG_TX_COMPLETE)); //wait for complete transfer
184
                                while(!(BLFlags & BLFLAG_TX_COMPLETE) && !CheckDelay(timer)); //wait for complete transfer
184
                        }
185
                        }
185
                }
186
                }
186
                if(Motor[i].State & MOTOR_STATE_PRESENT_MASK)
187
                if(Motor[i].State & MOTOR_STATE_PRESENT_MASK)
187
                {
188
                {
Line 324... Line 325...
324
                                                beeptime = 15000;
325
                                                beeptime = 15000;
325
                                                BeepMuster = 0xA000;
326
                                                BeepMuster = 0xA000;
326
                                        }
327
                                        }
327
                                        GPS_Nick = 0;
328
                                        GPS_Nick = 0;
328
                                        GPS_Roll = 0;
329
                                        GPS_Roll = 0;
329
                                        //if(!beeptime) 
330
                                        //if(!beeptime)
330
                                        FCFlags |= FCFLAG_SPI_RX_ERR;
331
                                        FCFlags |= FCFLAG_SPI_RX_ERR;
331
                                }
332
                                }
332
                           if(UBat < BattLowVoltageWarning)
333
                           if(UBat < BattLowVoltageWarning)
333
                                {
334
                                {
334
                                        FCFlags |= FCFLAG_LOWBAT;
335
                                        FCFlags |= FCFLAG_LOWBAT;