Rev 1400 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1400 | Rev 1452 | ||
---|---|---|---|
Line 127... | Line 127... | ||
127 | timer = SetDelay(500); |
127 | timer = SetDelay(500); |
128 | if(print) while (!CheckDelay(timer)); |
128 | if(print) while (!CheckDelay(timer)); |
129 | if(UBat < 130) |
129 | if(UBat < 130) |
130 | { |
130 | { |
131 | BattLowVoltageWarning = 3 * EE_Parameter.UnterspannungsWarnung; |
131 | BattLowVoltageWarning = 3 * EE_Parameter.UnterspannungsWarnung; |
132 | if(print) |
132 | if(print) |
133 | { |
133 | { |
134 | Piep(3,200); |
134 | Piep(3,200); |
135 | printf(" 3 Cells "); |
135 | printf(" 3 Cells "); |
136 | } |
136 | } |
137 | } |
137 | } |
138 | else |
138 | else |
139 | { |
139 | { |
140 | BattLowVoltageWarning = 4 * EE_Parameter.UnterspannungsWarnung; |
140 | BattLowVoltageWarning = 4 * EE_Parameter.UnterspannungsWarnung; |
141 | if(print) |
141 | if(print) |
142 | { |
142 | { |
143 | Piep(4,200); |
143 | Piep(4,200); |
144 | printf(" 4 Cells "); |
144 | printf(" 4 Cells "); |
145 | } |
145 | } |
146 | } |
146 | } |
147 | } |
147 | } |
148 | else BattLowVoltageWarning = EE_Parameter.UnterspannungsWarnung; |
148 | else BattLowVoltageWarning = EE_Parameter.UnterspannungsWarnung; |
149 | // if(BattLowVoltageWarning < 93) BattLowVoltageWarning = 93; |
149 | // if(BattLowVoltageWarning < 93) BattLowVoltageWarning = 93; |
150 | if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); |
150 | if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); |
Line 231... | Line 231... | ||
231 | Mixer.Revision = MIXER_REVISION; |
231 | Mixer.Revision = MIXER_REVISION; |
232 | memcpy(Mixer.Name, "Quadro\0", 11); |
232 | memcpy(Mixer.Name, "Quadro\0", 11); |
233 | eeprom_write_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer)); |
233 | eeprom_write_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer)); |
234 | } |
234 | } |
235 | printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name,RequiredMotors); |
235 | printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name,RequiredMotors); |
236 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
- | |
237 | // + Check connected BL-Ctrls |
- | |
238 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
- | |
239 | printf("\n\rFound BL-Ctrl: "); |
- | |
240 | motorread = 0; UpdateMotor = 0; SendMotorData(); while(!UpdateMotor); motorread = 0; // read the first I2C-Data |
- | |
241 | timer = SetDelay(2000); |
- | |
242 | for(i=0; i < MAX_MOTORS; i++) |
- | |
243 | { |
- | |
244 | UpdateMotor = 0; |
- | |
245 | SendMotorData(); |
- | |
246 | while(!UpdateMotor); |
- | |
247 | if(Mixer.Motor[i][0] > 0) // wait max 2 sec for the BL-Ctrls to wake up |
- | |
248 | { |
- | |
249 | while(!CheckDelay(timer) && !MotorPresent[i]) {UpdateMotor = 0; SendMotorData(); while(!UpdateMotor);}; |
- | |
250 | } |
- | |
251 | if(MotorPresent[i]) printf("%d ",i+1); |
- | |
252 | } |
- | |
253 | for(i=0; i < MAX_MOTORS; i++) |
- | |
254 | { |
- | |
255 | if(!MotorPresent[i] && Mixer.Motor[i][0] > 0) |
- | |
256 | { |
- | |
257 | printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1); |
- | |
258 | ServoActive = 1; // just in case the FC would be used as camera-stabilizer |
- | |
259 | } |
- | |
260 | MotorError[i] = 0; |
- | |
261 | } |
- | |
262 | printf("\n\r==================================="); |
- | |
263 | SendMotorData(); |
- | |
Line 264... | Line 236... | ||
264 | 236 | ||
265 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
237 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
266 | // + Check Settings |
238 | // + Check Settings |
267 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
239 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 356... | Line 328... | ||
356 | else MotorRegler(); |
328 | else MotorRegler(); |
357 | SendMotorData(); |
329 | SendMotorData(); |
358 | ROT_OFF; |
330 | ROT_OFF; |
359 | if(SenderOkay) SenderOkay--; |
331 | if(SenderOkay) SenderOkay--; |
360 | else TIMSK1 |= _BV(ICIE1); // enable PPM-Input |
332 | else TIMSK1 |= _BV(ICIE1); // enable PPM-Input |
361 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
333 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
362 | //if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 160 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 220) SenderOkay = 160; |
334 | //if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 160 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 220) SenderOkay = 160; |
363 | //if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 101 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 1) SenderOkay = 101; |
335 | //if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 101 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 1) SenderOkay = 101; |
364 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
336 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
365 | if(NaviDataOkay) |
337 | if(NaviDataOkay) |
366 | { |
338 | { |
Line 368... | Line 340... | ||
368 | { |
340 | { |
369 | GPS_Nick = 0; |
341 | GPS_Nick = 0; |
370 | GPS_Roll = 0; |
342 | GPS_Roll = 0; |
371 | } |
343 | } |
372 | } |
344 | } |
373 | if(!--I2CTimeout || MissingMotor) |
345 | if(!--I2CTimeout) |
374 | { |
346 | { |
375 | if(!I2CTimeout) |
347 | if(!I2CTimeout) |
376 | { |
348 | { |
377 | i2c_reset(); |
349 | i2c_reset(); |
378 | I2CTimeout = 5; |
350 | I2CTimeout = 5; |
Line 426... | Line 398... | ||
426 | if(++timer2 == 2930) // eine Minute |
398 | if(++timer2 == 2930) // eine Minute |
427 | { |
399 | { |
428 | timer2 = 0; |
400 | timer2 = 0; |
429 | FlugMinuten++; |
401 | FlugMinuten++; |
430 | FlugMinutenGesamt++; |
402 | FlugMinutenGesamt++; |
431 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES2],FlugMinuten / 256); |
403 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES2],FlugMinuten / 256); |
432 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES2+1],FlugMinuten % 256); |
404 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES2+1],FlugMinuten % 256); |
433 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES],FlugMinutenGesamt / 256); |
405 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES],FlugMinutenGesamt / 256); |
434 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES+1],FlugMinutenGesamt % 256); |
406 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_MINUTES+1],FlugMinutenGesamt % 256); |
435 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
407 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
436 | } |
408 | } |
437 | } |
409 | } |
438 | LED_Update(); |
410 | LED_Update(); |
439 | } |
411 | } |