Subversion Repositories FlightCtrl

Rev

Rev 1644 | Rev 1650 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1644 Rev 1648
Line 2... Line 2...
2
############################################################################*/
2
############################################################################*/
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
#include "main.h"
4
#include "main.h"
5
 
5
 
6
volatile unsigned char twi_state = 0;
6
volatile unsigned char twi_state = 0;
7
unsigned char motor = 0,TransmitBlConfig = 1;
7
unsigned char motor = 0;
Line 8... Line 8...
8
unsigned char motorread = 0,MissingMotor = 0;
8
unsigned char motorread = 0,MissingMotor = 0;
-
 
9
unsigned char BLFlags = 0;
-
 
10
 
-
 
11
MotorData_t Motor[MAX_MOTORS];
Line 9... Line 12...
9
unsigned char ReadTemperature = 0;
12
BLConfig_t BLConfig[MAX_MOTORS];
Line -... Line 13...
-
 
13
 
-
 
14
unsigned char *pTxBuff = (uint8_t*)&BLConfig[0];
10
 
15
 
11
MotorData_t Motor[MAX_MOTORS];
16
unsigned int I2CError = 0;
12
 
17
 
13
unsigned int I2CError = 0;
18
#define BL_CONF_SYNC_BYTE '#'
14
 
19
 
-
 
20
//############################################################################
-
 
21
//Initzialisieren der I2C (TWI) Schnittstelle
15
//############################################################################
22
void i2c_init(void)
16
//Initzialisieren der I2C (TWI) Schnittstelle
23
//############################################################################
-
 
24
{
-
 
25
        unsigned char i;
-
 
26
 
-
 
27
        TWSR = 0;
-
 
28
        TWBR = ((SYSCLK/SCL_CLOCK)-16)/2;
-
 
29
 
-
 
30
        for(i=0; i < MAX_MOTORS; i++)
-
 
31
        {
-
 
32
                Motor[i].Version        = 0;
-
 
33
                Motor[i].SetPoint       = 0;
-
 
34
                Motor[i].SetPointLowerBits      = 0;
-
 
35
                Motor[i].State          = 0;
-
 
36
                Motor[i].Current        = 0;
-
 
37
                Motor[i].MaxPWM         = 0;
-
 
38
                BLConfig[i].SetMask =   MASK_SET_PWM_SCALING|MASK_SET_CURRENT_LIMIT|MASK_SET_TEMP_LIMIT|MASK_SET_CURRENT_SCALING|MASK_SET_BITCONFIG;
-
 
39
                BLConfig[i].PwmScaling = 255;           // MaxPWM
17
void i2c_init(void)
40
                BLConfig[i].CurrentLimit = 30;          // Current Limit in A
Line 18... Line 41...
18
//############################################################################
41
                BLConfig[i].TempLimit = 99;                     // Temperature Limit in °C
19
{
42
                BLConfig[i].CurrentScaling = 64;        // Current Scaling
20
  TWSR = 0;
43
                BLConfig[i].BitConfig = 0;                      // BitConfig
Line 37... Line 60...
37
                 i2c_init();
60
        i2c_init();
38
                 I2C_Start();
61
        I2C_Start();
39
                 i2c_write_byte(0);
62
        i2c_write_byte(0);
40
}
63
}
Line 41... Line 64...
41
 
64
 
42
/*
65
 
43
//############################################################################
66
//############################################################################
44
SIGNAL (TWI_vect)
67
SIGNAL (TWI_vect)
45
//############################################################################
68
//############################################################################
46
{
69
{
-
 
70
         static unsigned char missing_motor = 0, byte_counter = 0, crc = 0, read_more = 0, motorread_temperature = 0;
47
 static unsigned char missing_motor;
71
J4High;
48
     switch(twi_state++)
72
        switch(twi_state++)
49
        {
73
        {
50
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51
// Writing the Data
75
// Writing the Data
52
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53
        case 0:
77
                case 0:
54
                        while(Mixer.Motor[motor][0] <= 0 && motor < MAX_MOTORS) motor++;  // skip if not used
78
                        while(Mixer.Motor[motor][MIX_GAS] <= 0 && motor < MAX_MOTORS) motor++;  // skip if not used
55
                                if(motor == MAX_MOTORS)  // writing finished -> now read
79
                        if(motor == MAX_MOTORS)  // writing finished -> now read
56
                                {
80
                        {
57
                                 motor = 0;
81
                                motor = 0;
58
                                 twi_state = 3;
82
                                twi_state = 5;
59
                                 i2c_write_byte(0x53+(motorread*2));
83
                                i2c_write_byte(0x53+(motorread*2));
60
                                 }
84
                        }
61
                                else i2c_write_byte(0x52+(motor*2));
85
                                else i2c_write_byte(0x52+(motor*2));
62
                break;
86
                        break;
63
        case 1:
87
                case 1:
64
                i2c_write_byte(Motor[motor++].SetPoint);
-
 
65
                break;
-
 
66
        case 2:
-
 
67
                if(TWSR == 0x30)
-
 
68
                                 {
88
                        i2c_write_byte(Motor[motor].SetPoint);
69
                                  if(!missing_motor) missing_motor = motor;
-
 
70
                                  if((Motor[motor-1].State & MOTOR_STATE_ERROR_MASK) < MOTOR_STATE_ERROR_MASK) Motor[motor-1].State++; // increment error counter and handle overflow
-
 
71
                                 }
-
 
72
                I2C_Stop();
-
 
73
                I2CTimeout = 10;
-
 
74
                twi_state = 0;
-
 
75
                I2C_Start();
-
 
76
                break;
-
 
77
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
78
// Reading Data
-
 
79
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
80
        case 3:
-
 
81
               //Transmit 1st byte for reading
-
 
82
                if(TWSR != 0x40)  // Error?
89
                        if(!(Motor[motor].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) )
83
                 {
-
 
84
                  Motor[motorread].State &= ~MOTOR_STATE_PRESENT_MASK; // clear present bit
-
 
85
                  motorread++;
90
                        {
86
                  if(motorread >= MAX_MOTORS) motorread = 0;
-
 
87
                  I2C_Stop();
-
 
88
                  twi_state = 0;
91
                                twi_state = 4; //jump over sending more data
89
                 }
92
                        }
90
                 else
93
                        else if(!(Motor[motor].SetPointLowerBits || (BLFlags & BLFLAG_SEND_CONFIG)))
91
                 {
-
 
92
                  Motor[motorread].State |= MOTOR_STATE_PRESENT_MASK; // set present bit
94
                        {
93
                  I2C_ReceiveByte();
95
                                twi_state = 4; // skip state
94
                 }
-
 
95
                MissingMotor = missing_motor;
-
 
96
                missing_motor = 0;
-
 
97
                break;
-
 
98
        case 4: //Read 1st byte and transmit 2nd Byte
-
 
99
                Motor[motorread].Current = TWDR;
-
 
100
                I2C_ReceiveLastByte(); //nack
-
 
101
                break;
-
 
102
        case 5:
-
 
103
                //Read 2nd byte
-
 
104
                Motor[motorread].MaxPWM = TWDR;
-
 
105
                                motorread++; // next motor
-
 
106
                if(motorread >= MAX_MOTORS) motorread = 0;
-
 
107
                I2C_Stop();
-
 
108
                twi_state = 0;
-
 
109
                break;
-
 
110
 
-
 
111
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
112
// writing Gyro-Offset
-
 
113
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
114
        case 8:
-
 
115
                i2c_write_byte(0x98); // Address of the DAC
-
 
116
                break;
-
 
117
        case 9:
-
 
118
                i2c_write_byte(0x10); // Update Channel A
-
 
119
                break;
-
 
120
        case 10:
-
 
121
                i2c_write_byte(AnalogOffsetNick); // Value
-
 
122
                break;
-
 
123
        case 11:
-
 
124
                i2c_write_byte(0x80); // Value
-
 
125
                break;
-
 
126
        case 12:
-
 
127
                I2C_Stop();
-
 
128
                I2CTimeout = 10;
-
 
129
                I2C_Start();
-
 
130
                break;
-
 
131
        case 13:
-
 
132
                i2c_write_byte(0x98); // Address of the DAC
-
 
133
                break;
-
 
134
        case 14:
-
 
135
                i2c_write_byte(0x12); // Update Channel B
-
 
136
                break;
-
 
137
        case 15:
-
 
138
                i2c_write_byte(AnalogOffsetRoll); // Value
-
 
139
                break;
-
 
140
        case 16:
-
 
141
                i2c_write_byte(0x80); // Value
-
 
142
                break;
-
 
143
        case 17:
-
 
144
                I2C_Stop();
-
 
145
                I2CTimeout = 10;
-
 
146
                I2C_Start();
-
 
147
                break;
-
 
148
        case 18:
-
 
149
                i2c_write_byte(0x98); // Address of the DAC
-
 
150
                break;
-
 
151
        case 19:
-
 
152
                i2c_write_byte(0x14); // Update Channel C
-
 
153
                break;
-
 
154
        case 20:
-
 
155
                i2c_write_byte(AnalogOffsetGier); // Value
-
 
156
                break;
-
 
157
        case 21:
-
 
158
                i2c_write_byte(0x80); // Value
-
 
159
                break;
-
 
160
        case 22:
-
 
161
                I2C_Stop();
-
 
162
                I2CTimeout = 10;
-
 
163
                twi_state = 0;
-
 
164
                break;
-
 
165
        default: twi_state = 0;
96
                        }
-
 
97
                        break;
-
 
98
                case 2: // lower bits of setpoint (higher resolution)
-
 
99
                        i2c_write_byte((Motor[motor].SetPointLowerBits << 1) & 0x07); // send the lower bits of setpoint
-
 
100
                        // transmit config only on demand and the motors are not running and only for one motor per round trip
-
 
101
                        if( (BLFlags & BLFLAG_SEND_CONFIG) && !MotorenEin && (motor == motorread))
-
 
102
                        {       // prepare sending of configuration
-
 
103
                                byte_counter = 0;       // reset send byte counter
166
                break;
104
                                crc = 0xAA; // init checksum
167
                }
-
 
168
 TWCR |= 0x80;
-
 
169
}
-
 
170
*/
-
 
171
 
-
 
172
/*
-
 
173
                if(DataArray[3] & 0x01) Parameter.PwmScaling            = DataArray[4];
-
 
174
                if(DataArray[3] & 0x02) Parameter.MaxStrom                      = DataArray[5];
-
 
175
                if(DataArray[3] & 0x04) Parameter.TemperaturLimiter = DataArray[6];
-
 
176
                if(DataArray[3] & 0x08) Parameter.SkaliereStrom         = DataArray[7];
-
 
177
                if(DataArray[3] & 0x10) Parameter.Bitconfig                     = DataArray[8];
-
 
178
*/
-
 
179
 
-
 
180
//############################################################################
-
 
181
SIGNAL (TWI_vect)
-
 
182
//############################################################################
-
 
183
{                           // 2    3   4   5   6   7   8  9
-
 
184
 unsigned char test[] = {0,0,'#',0x1F,255,30,99,64,0x00,7,8,9,10};
-
 
185
 static unsigned char missing_motor,send = 0,crc = 0,read_more = 0;
105
                        }
186
J4High;
-
 
187
     switch(twi_state++)
-
 
188
        {
-
 
189
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
190
// Writing the Data
-
 
191
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
192
        case 0:
-
 
193
                        while(Mixer.Motor[motor][0] <= 0 && motor < MAX_MOTORS) motor++;  // skip if not used
106
                        else
194
                                if(motor == MAX_MOTORS)  // writing finished -> now read
-
 
195
                                {
-
 
196
                                 motor = 0;
107
                        {       // jump to state for end of transmission for that motor
197
                                 twi_state = 4;
-
 
198
                                 i2c_write_byte(0x53+(motorread*2));
108
                                twi_state = 4;
199
                                 }
-
 
200
                                else i2c_write_byte(0x52+(motor*2));
-
 
201
                                send = 0;
109
                        }
202
                break;
110
                        break;
203
        case 1:
-
 
204
                i2c_write_byte(Motor[motor].SetPoint);
-
 
205
//              if(!(Motor[motor].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) /*|| !Motor[motor].SetPointLowerBits*/)
-
 
206
                if((!(Motor[motor].Version & MOTOR_STATE_NEW_PROTOCOL_MASK) || !Motor[motor].SetPointLowerBits) && !TransmitBlConfig)
111
                case 3:
207
                                  twi_state++; // skip
-
 
208
                break;
-
 
209
        case 2:
-
 
210
                if(!send++)
112
                        if(!byte_counter) // first byte?
211
                                 {
113
                        {
212
                                  i2c_write_byte((Motor[motor].SetPointLowerBits << 1) & 0x07);
114
                                i2c_write_byte(BL_CONF_SYNC_BYTE);
-
 
115
                                crc += BL_CONF_SYNC_BYTE; // update crc
213
                                  crc = 0xAA;
116
                                pTxBuff = (uint8_t*)&BLConfig[motor]; // select configuration for motor
214
                                 }
-
 
215
                                else
117
                        }
216
                if(send == 9) i2c_write_byte(crc)
-
 
217
                                else
-
 
218
                                 {
118
                        else if(byte_counter >= sizeof(BLConfig_t)+1) // last byte?
219
                                  crc += test[send];
119
                        {       // send crc byte at the end
220
                                  i2c_write_byte(test[send]);
120
                                i2c_write_byte(crc);
221
                                }
121
                        }
222
                if(TransmitBlConfig && !MotorenEin && motor == motorread && (Motor[motorread].Version & MOTOR_STATE_NEW_PROTOCOL_MASK))
122
            else // transmit configuration to BLs
-
 
123
                        {
-
 
124
                                i2c_write_byte(pTxBuff[byte_counter-1]);                // submit next byte
223
                                 {
125
                                crc += pTxBuff[byte_counter-1];                         // update crc
224
                                  if(send <= 10) twi_state--;
126
                                twi_state = 3;                                                          // stay in this state
-
 
127
                        }
225
                                 }
128
                        byte_counter++; // next byte
226
                break;
129
                        break;
227
        case 3:
-
 
-
 
130
        case 4:
228
                        motor++;
131
 
229
                if(TWSR == 0x30)
132
                        if(TWSR == 0x30)
230
                                 {
133
                        {
231
                                  if(!missing_motor) missing_motor = motor;
134
                                if(!missing_motor) missing_motor = motor + 1;
232
                                  if((Motor[motor-1].State & MOTOR_STATE_ERROR_MASK) < MOTOR_STATE_ERROR_MASK) Motor[motor-1].State++; // increment error counter and handle overflow
135
                                if((Motor[motor].State & MOTOR_STATE_ERROR_MASK) < MOTOR_STATE_ERROR_MASK) Motor[motor].State++; // increment error counter and handle overflow
233
                                 }
136
                        }
234
                I2C_Stop();
137
                        I2C_Stop();
-
 
138
                        I2CTimeout = 10;
235
                I2CTimeout = 10;
139
                        motor++;
236
                twi_state = 0;
140
                        twi_state = 0;
237
                I2C_Start();
141
                        I2C_Start();
238
                break;
142
                        break;
239
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
143
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
240
// Reading Data
144
// Reading Data
241
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
242
        case 4:
146
        case 5:
243
               //Transmit 1st byte for reading
147
                        //Transmit 1st byte for reading
244
                if(TWSR != 0x40)  // Error?
148
                        if(TWSR != 0x40)  // Error?
245
                 {
149
                        {
-
 
150
                                Motor[motorread].State &= ~MOTOR_STATE_PRESENT_MASK; // clear present bit
-
 
151
                                if(++motorread >= MAX_MOTORS)
-
 
152
                                {
246
                  Motor[motorread].State &= ~MOTOR_STATE_PRESENT_MASK; // clear present bit
153
                                        BLFlags &= ~BLFLAG_SEND_CONFIG;
247
                  motorread++;
154
                                        motorread = 0;
-
 
155
                                        if(++motorread_temperature >= MAX_MOTORS)
-
 
156
                                        {
-
 
157
                                                motorread_temperature = 0;
-
 
158
                                                BLFlags &= ~BLFLAG_READ_VERSION;
-
 
159
                                        }
248
                  if(motorread >= MAX_MOTORS) { TransmitBlConfig = 0; motorread = 0; ReadTemperature = ++ReadTemperature & 0x0f;}
160
                                }
249
                  I2C_Stop();
161
                                I2C_Stop();
-
 
162
                                twi_state = 0;
250
                  twi_state = 0;
163
                                BLFlags |= BLFLAG_TX_COMPLETE;
251
                 }
164
                        }
252
                 else
165
                        else
253
                 {
166
                        {
254
                  Motor[motorread].State |= MOTOR_STATE_PRESENT_MASK; // set present bit
167
                                Motor[motorread].State |= MOTOR_STATE_PRESENT_MASK; // set present bit
255
                  if(motorread == ReadTemperature || TransmitBlConfig)                         
168
                                if(motorread == motorread_temperature)
256
                                  {
169
                                {
257
                   read_more = 1;
170
                                        read_more = 1;
258
                   I2C_ReceiveByte();
171
                                        I2C_ReceiveByte();
259
                                  }
172
                                }
260
                                  else
173
                                else
261
                                   {
-
 
262
                                    I2C_ReceiveLastByte();                               
174
                                {
-
 
175
                                        read_more = 0;
263
                                        read_more = 0;
176
                                        I2C_ReceiveLastByte();
264
                                   }   
177
                                }
265
                 }
178
                        }
266
                MissingMotor = missing_motor;
179
                        MissingMotor = missing_motor;
267
                missing_motor = 0;
180
                        missing_motor = 0;
268
                break;
181
                        break;
269
        case 5: //Read 1st byte and transmit 2nd Byte
182
        case 6: //Read 1st byte and transmit 2nd Byte
270
                Motor[motorread].Current = TWDR;
183
                Motor[motorread].Current = TWDR;
-
 
184
                if(read_more)
-
 
185
                {
-
 
186
                                        I2C_ReceiveByte() //ack
-
 
187
 
271
                if(read_more) I2C_ReceiveByte() //nack
188
                                }
272
                                else
189
                                else
273
                                 {
190
                                {
-
 
191
                                        if(++motorread >= MAX_MOTORS)
-
 
192
                                        {
-
 
193
                                                motorread = 0;          // restart from beginning
274
                                        motorread++; // next motor
194
                                                BLFlags &= ~BLFLAG_SEND_CONFIG;
-
 
195
                                                if(++motorread_temperature >= MAX_MOTORS)
-
 
196
                                                {
-
 
197
                                                        motorread_temperature = 0;
-
 
198
                                                        BLFlags &= ~BLFLAG_READ_VERSION;
-
 
199
                                                }
275
                                        if(motorread >= MAX_MOTORS) { TransmitBlConfig = 0; motorread = 0; ReadTemperature = ++ReadTemperature & 0x0f;}
200
                                        }
276
                                        I2C_Stop();
201
                                        I2C_Stop();
-
 
202
                                        twi_state = 0;
277
                                        twi_state = 0;
203
                                        BLFlags |= BLFLAG_TX_COMPLETE;
278
                                 }
204
                                }
279
                break;
205
                break;
280
        case 6:
206
        case 7:
281
                       //Read 2nd byte and transmit 3rd Byte
207
                       //Read 2nd byte and transmit 3rd Byte
-
 
208
                Motor[motorread].MaxPWM = TWDR;
-
 
209
                if(BLFlags & BLFLAG_READ_VERSION)
282
                Motor[motorread].MaxPWM = TWDR;
210
                                {
283
                                if(TWDR == 250)
211
                                        if(TWDR == 250)
284
                                 {
212
                                        {
285
                                  if(!MotorenEin) Motor[motorread].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK;
213
                                                if(!MotorenEin) Motor[motorread].Version |= MOTOR_STATE_NEW_PROTOCOL_MASK;
-
 
214
                                        }
-
 
215
                                        else
286
                                 }
216
                                        {
-
 
217
                                                Motor[motorread].Version = 0;
-
 
218
                                        }
287
                                 else if(TransmitBlConfig) Motor[motorread].Version = 0;
219
                                }
288
                                I2C_ReceiveLastByte(); //nack
220
                                I2C_ReceiveLastByte(); //nack
289
                break;
221
                break;
290
        case 7: // read next
222
        case 8: // read next
291
                                Motor[motorread].Temperature = TWDR;
223
                                Motor[motorread].Temperature = TWDR;
-
 
224
                                if(++motorread >= MAX_MOTORS)
292
                                motorread++; // next motor
225
                                {
-
 
226
                                        motorread = 0; // restart reading of first motor
-
 
227
                                        BLFlags &= ~BLFLAG_SEND_CONFIG;
-
 
228
                                        if(++motorread_temperature >= MAX_MOTORS)
-
 
229
                                        {
-
 
230
                                                motorread_temperature = 0;
-
 
231
                                                BLFlags &= ~BLFLAG_READ_VERSION;
-
 
232
                                        }
293
                if(motorread >= MAX_MOTORS) { TransmitBlConfig = 0; motorread = 0; }
233
                                }
-
 
234
                I2C_Stop();
294
                I2C_Stop();
235
                BLFlags |= BLFLAG_TX_COMPLETE;
295
                twi_state = 0;
236
                twi_state = 0;
296
                                break;
237
                                break;
297
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
238
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
298
// writing Gyro-Offset
239
// writing Gyro-Offset
Line 353... Line 294...
353
                }
294
        }
354
 TWCR |= 0x80;
295
        TWCR |= 0x80;
355
J4Low;
296
        J4Low;
356
}
297
}
Line -... Line 298...
-
 
298
 
-
 
299
void I2C_SendBLConfig(void)
-
 
300
{
-
 
301
        unsigned char i;
-
 
302
        while(!(BLFlags & BLFLAG_TX_COMPLETE)); //wait for complete transfer
-
 
303
        BLFlags |= BLFLAG_SEND_CONFIG; // enable sending of BL config
-
 
304
        for(i = 0; i < MAX_MOTORS; i++)
-
 
305
        {
-
 
306
                Motor[i].SetPoint = 0;
-
 
307
                Motor[i].SetPointLowerBits = 0;
-
 
308
        }
-
 
309
        motorread = 0;
-
 
310
        // needs at least MAX_MOTORS loops of 2 ms (12*2ms = 24ms)
-
 
311
        do
-
 
312
        {
-
 
313
                twi_state = 0;
-
 
314
                I2C_Start(); // start an i2c transmission
-
 
315
                while(!(BLFlags & BLFLAG_TX_COMPLETE)); //wait for complete transfer
-
 
316
        }while(BLFlags & BLFLAG_SEND_CONFIG); // repeat until the BL config has been send to all motors
-
 
317
}
-
 
318
 
-
 
319