Rev 1880 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1880 | Rev 1897 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | unsigned int FlugSekunden = 0; |
59 | unsigned int FlugSekunden = 0; |
60 | pVoidFnct_pVoidFnctChar_const_fmt _printf_P; |
60 | pVoidFnct_pVoidFnctChar_const_fmt _printf_P; |
61 | unsigned char FoundMotors = 0; |
61 | unsigned char FoundMotors = 0; |
62 | unsigned char JetiBeep = 0; // to allow any Morse-Beeping of the Jeti-Box |
62 | unsigned char JetiBeep = 0; // to allow any Morse-Beeping of the Jeti-Box |
Line -... | Line 63... | ||
- | 63 | ||
- | 64 | unsigned char delayjetibeep = 0;/// |
|
- | 65 | unsigned char delayjetibeepset =0;/// |
|
- | 66 | static char panodelay = 0; ///martinw |
|
- | 67 | static char panoleddelay = 0; ///martinw |
|
63 | 68 | ||
64 | void CalMk3Mag(void) |
69 | void CalMk3Mag(void) |
65 | { |
70 | { |
66 | static unsigned char stick = 1; |
71 | static unsigned char stick = 1; |
67 | if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -20) stick = 0; |
72 | if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -20) stick = 0; |
Line 101... | Line 106... | ||
101 | Piep(cells, 200); |
106 | Piep(cells, 200); |
102 | printf(" %d Cells ", cells); |
107 | printf(" %d Cells ", cells); |
103 | } |
108 | } |
104 | } |
109 | } |
105 | else BattLowVoltageWarning = EE_Parameter.UnterspannungsWarnung; |
110 | else BattLowVoltageWarning = EE_Parameter.UnterspannungsWarnung; |
106 | if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); |
111 | //if(print) printf(" Low warning level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); |
- | 112 | if(print) printf("Low Batt level: %d.%d",BattLowVoltageWarning/10,BattLowVoltageWarning%10); /// Martinw; removed memorysaving |
|
- | 113 | ||
107 | } |
114 | } |
Line 108... | Line 115... | ||
108 | 115 | ||
109 | //############################################################################ |
116 | //############################################################################ |
110 | //Hauptprogramm |
117 | //Hauptprogramm |
Line 194... | Line 201... | ||
194 | } |
201 | } |
195 | for(i=0; i < MAX_MOTORS; i++) |
202 | for(i=0; i < MAX_MOTORS; i++) |
196 | { |
203 | { |
197 | if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK) && Mixer.Motor[i][0] > 0) |
204 | if(!(Motor[i].State & MOTOR_STATE_PRESENT_MASK) && Mixer.Motor[i][0] > 0) |
198 | { |
205 | { |
199 | printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1); |
206 | //printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1); |
- | 207 | printf("\n\r\n\r!!MISSING BL-CTRL: %d!!",i+1);/// Martinw; removed memorysaving |
|
200 | ServoActive = 2; // just in case the FC would be used as camera-stabilizer |
208 | ServoActive = 2; // just in case the FC would be used as camera-stabilizer |
201 | } |
209 | } |
202 | Motor[i].State &= ~MOTOR_STATE_ERROR_MASK; // clear error counter |
210 | Motor[i].State &= ~MOTOR_STATE_ERROR_MASK; // clear error counter |
203 | } |
211 | } |
204 | printf("\n\r==================================="); |
212 | //printf("\n\r===================================");/// Martinw; removed memorysaving |
- | 213 | printf("\n\r=");/// Martinw; removed memorysaving |
|
- | 214 | ||
Line 205... | Line 215... | ||
205 | 215 | ||
Line 206... | Line 216... | ||
206 | if(RequiredMotors < FoundMotors) VersionInfo.HardwareError[1] |= FC_ERROR1_MIXER; |
216 | if(RequiredMotors < FoundMotors) VersionInfo.HardwareError[1] |= FC_ERROR1_MIXER; |
207 | 217 | ||
208 | //if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
218 | //if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
- | 219 | { |
|
209 | { |
220 | //printf("\n\rCalibrating pressure sensor.."); |
210 | printf("\n\rCalibrating pressure sensor.."); |
221 | printf("\n\rCal. pressure sensor");/// Martinw; removed memorysaving |
211 | timer = SetDelay(1000); |
222 | timer = SetDelay(1000); |
212 | SucheLuftruckOffset(); |
223 | SucheLuftruckOffset(); |
213 | while (!CheckDelay(timer)); |
224 | while (!CheckDelay(timer)); |
Line 233... | Line 244... | ||
233 | printf("\n\rFlight-time %u min Total:%u min", FlugMinuten, FlugMinutenGesamt); |
244 | printf("\n\rFlight-time %u min Total:%u min", FlugMinuten, FlugMinutenGesamt); |
Line 234... | Line 245... | ||
234 | 245 | ||
235 | printf("\n\rControl: "); |
246 | printf("\n\rControl: "); |
236 | if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
247 | if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
237 | else printf("Normal (ACC-Mode)"); |
248 | else printf("Normal (ACC-Mode)"); |
- | 249 | ||
- | 250 | #ifdef WITH_MKTOOL_Display // MartinW; for no MKT Display main.h |
|
238 | 251 | #warning : "### with MKTool Display ###" |
|
- | 252 | LcdClear(); |
|
- | 253 | #endif |
|
239 | LcdClear(); |
254 | |
240 | I2CTimeout = 5000; |
255 | I2CTimeout = 5000; |
241 | WinkelOut.Orientation = 1; |
256 | WinkelOut.Orientation = 1; |
Line 242... | Line 257... | ||
242 | LipoDetection(1); |
257 | LipoDetection(1); |
Line 243... | Line 258... | ||
243 | 258 | ||
- | 259 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
|
244 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
260 | |
245 | 261 | //printf("\n\r===================================\n\r"); |
|
246 | printf("\n\r===================================\n\r"); |
262 | printf("\n\r=\n\r"); /// Martinw; removed memorysaving |
Line 247... | Line 263... | ||
247 | //SpektrumBinding(); |
263 | //SpektrumBinding(); |
248 | timer = SetDelay(2000); |
264 | timer = SetDelay(2000); |
- | 265 | timerPolling = SetDelay(250); |
|
- | 266 | ||
- | 267 | Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active |
|
- | 268 | DebugOut.Status[0] = 0x01 | 0x02; |
|
- | 269 | ||
- | 270 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) ///MartinW; only for 1284er |
|
- | 271 | //#warning : "### with Sponsored Message ###" |
|
- | 272 | printf("\n\rJETI+ Version sponsored by Flyinghigh.ch, progammed by MartinW\n\r"); |
|
249 | timerPolling = SetDelay(250); |
273 | #else |
250 | 274 | #endif |
|
251 | Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active |
275 | |
Line 252... | Line 276... | ||
252 | DebugOut.Status[0] = 0x01 | 0x02; |
276 | |
Line 253... | Line 277... | ||
253 | JetiBeep = 0; |
277 | JetiBeep = 0; |
254 | while (1) |
278 | while (1) |
255 | { |
279 | { |
256 | 280 | ||
- | 281 | if (JetiUpdateModeActive) while (1); |
|
- | 282 | ||
- | 283 | if(CheckDelay(timerPolling)) |
|
- | 284 | { |
|
- | 285 | timerPolling = SetDelay(100); |
|
- | 286 | LIBFC_Polling(); |
|
- | 287 | ||
- | 288 | #ifdef WITH_JETI_BEEP /// MartinW main.h |
|
- | 289 | #warning : "### with JetiBeep Delay ###" |
|
- | 290 | ||
- | 291 | if(!(JetiBeep == 0)) |
|
- | 292 | { |
|
- | 293 | delayjetibeep++; |
|
- | 294 | } |
|
- | 295 | if(delayjetibeep == delayjetibeepset ) |
|
- | 296 | { |
|
- | 297 | delayjetibeep = 0; |
|
- | 298 | JetiBeep = 0; |
|
- | 299 | } |
|
- | 300 | ||
257 | if (JetiUpdateModeActive) while (1); |
301 | #else |
258 | 302 | #warning : "### without JetiBeep Delay ###" |
|
259 | if(CheckDelay(timerPolling)) |
303 | JetiBeep = 0; |
260 | { |
304 | #endif |
261 | timerPolling = SetDelay(100); |
305 | |
Line 390... | Line 434... | ||
390 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL,FlugMinutenGesamt / 256); |
434 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL,FlugMinutenGesamt / 256); |
391 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL+1,FlugMinutenGesamt % 256); |
435 | SetParamByte(PID_FLIGHT_MINUTES_TOTAL+1,FlugMinutenGesamt % 256); |
392 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
436 | timer = SetDelay(20); // falls "timer += 20;" mal nicht geht |
393 | } |
437 | } |
394 | } |
438 | } |
- | 439 | ||
- | 440 | #ifdef WITH_PANOTRIGGER /// MartinW main.h means no memsave |
|
- | 441 | #warning : "### with Panorama Trigger Function ###" |
|
- | 442 | //// Pano Trigger |
|
- | 443 | if(Parameter_UserParam8 >= 200) //enable/disable Pano Trigger Function |
|
- | 444 | { |
|
- | 445 | if(Parameter_UserParam4 <=9) { Parameter_UserParam4 = 10; } |
|
- | 446 | degreedivold = degreediv; |
|
- | 447 | degreediv = (ErsatzKompass / GIER_GRAD_FAKTOR) / Parameter_UserParam4;//Division |
|
- | 448 | ||
- | 449 | if((degreediv-degreedivold)==2||(degreediv-degreedivold)==1||(degreediv-degreedivold)== -2||(degreediv-degreedivold)== -1) |
|
- | 450 | { |
|
- | 451 | ||
- | 452 | if(panodelay == 0) |
|
- | 453 | { |
|
- | 454 | panotrigger= 1; // muss wieder geleert werden |
|
- | 455 | ROT_ON; |
|
- | 456 | J16_ON; |
|
- | 457 | panodelay = Parameter_UserParam5; |
|
- | 458 | } |
|
- | 459 | } |
|
- | 460 | ||
- | 461 | else |
|
- | 462 | { |
|
- | 463 | if(panodelay <= Parameter_UserParam6) //ms Intervall |
|
- | 464 | { |
|
- | 465 | //panoleddelay = Parameter_UserParam6; |
|
- | 466 | J16_OFF; |
|
- | 467 | ROT_OFF; |
|
- | 468 | } |
|
- | 469 | if(panodelay > 0) |
|
- | 470 | { |
|
- | 471 | panodelay--; |
|
- | 472 | } |
|
- | 473 | ||
- | 474 | } |
|
- | 475 | }// END if(Parameter_UserParam4 >= 1) |
|
- | 476 | //// Pano Trigger |
|
- | 477 | ||
- | 478 | #else |
|
- | 479 | #warning : "### without Panorama Trigger Function ###" |
|
- | 480 | ||
- | 481 | #endif |
|
- | 482 | ||
- | 483 | ||
- | 484 | ||
395 | LED_Update(); |
485 | LED_Update(); |
396 | Capacity_Update(); |
486 | Capacity_Update(); |
397 | } //else DebugOut.Analog[26]++; |
487 | } //else DebugOut.Analog[26]++; |
398 | } |
488 | } |
399 | if(!SendSPI) { SPI_TransmitByte(); } |
489 | if(!SendSPI) { SPI_TransmitByte(); } |