Rev 139 | Rev 143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 139 | Rev 141 | ||
---|---|---|---|
Line 285... | Line 285... | ||
285 | if (c == 0x00) |
285 | if (c == 0x00) |
286 | { |
286 | { |
287 | if(DebugUART == UART0) |
287 | if(DebugUART == UART0) |
288 | { |
288 | { |
289 | UART0_Connect_to_MKGPS(); |
289 | UART0_Connect_to_MKGPS(); |
290 | TIMER2_Init(); |
290 | TIMER2_Init(); // enbable servo outputs |
291 | Analog_Init(); |
- | |
292 | } |
291 | } |
293 | DebugUART = UART1; |
292 | DebugUART = UART1; |
294 | } |
293 | } |
295 | abortState = 0; |
294 | abortState = 0; |
296 | break; |
295 | break; |
Line 298... | Line 297... | ||
298 | // if the Debug uart is not UART1, redirect input to the Debug UART |
297 | // if the Debug uart is not UART1, redirect input to the Debug UART |
299 | if (DebugUART != UART1) |
298 | if (DebugUART != UART1) |
300 | { |
299 | { |
301 | // wait for space in the tx buffer of the DebugUART |
300 | // wait for space in the tx buffer of the DebugUART |
302 | while(UART_GetFlagStatus(DebugUART, UART_FLAG_TxFIFOFull) == SET) {}; |
301 | while(UART_GetFlagStatus(DebugUART, UART_FLAG_TxFIFOFull) == SET) {}; |
303 | // move byte to the tx fifi of the debug uart |
302 | // move byte to the tx fifo of the debug uart |
304 | UART_SendData(DebugUART, c); |
303 | UART_SendData(DebugUART, c); |
305 | } |
304 | } |
306 | } |
305 | } |
307 | } |
306 | } |
308 | else // DebugUART == UART1 (normal operation) |
307 | else // DebugUART == UART1 (normal operation) |
Line 357... | Line 356... | ||
357 | case 'u': // redirect debug uart |
356 | case 'u': // redirect debug uart |
358 | switch(SerialMsg.pData[0]) |
357 | switch(SerialMsg.pData[0]) |
359 | { |
358 | { |
360 | case UART_FLIGHTCTRL: |
359 | case UART_FLIGHTCTRL: |
361 | UART2_Init(); // initialize UART2 to FC pins |
360 | UART2_Init(); // initialize UART2 to FC pins |
- | 361 | TIMER2_Deinit(); // stop servo output |
|
362 | DebugUART = UART2; |
362 | DebugUART = UART2; |
363 | break; |
363 | break; |
364 | case UART_MK3MAG: |
364 | case UART_MK3MAG: |
365 | if(FC.MKFlags & MKFLAG_MOTOR_RUN) break; // not if the motors are running |
365 | if(FC.MKFlags & MKFLAG_MOTOR_RUN) break; // not if the motors are running |
366 | UART0_Connect_to_MK3MAG(); // mux UART0 to MK3MAG pins |
366 | UART0_Connect_to_MK3MAG(); // mux UART0 to MK3MAG pins |
- | 367 | TIMER2_Deinit(); // stop servo output |
|
367 | GPSData.Status = INVALID; |
368 | GPSData.Status = INVALID; |
368 | DebugUART = UART0; |
369 | DebugUART = UART0; |
369 | break; |
370 | break; |
370 | case UART_MKGPS: |
371 | case UART_MKGPS: |
371 | if(FC.MKFlags & MKFLAG_MOTOR_RUN) break; // not if the motors are running |
372 | if(FC.MKFlags & MKFLAG_MOTOR_RUN) break; // not if the motors are running |
372 | TIMER2_Deinit(); |
373 | TIMER2_Deinit(); |
373 | Analog_Deinit(); |
- | |
374 | UART0_Connect_to_MKGPS(); // connect UART0 to MKGPS pins |
374 | UART0_Connect_to_MKGPS(); // connect UART0 to MKGPS pins |
375 | GPSData.Status = INVALID; |
375 | GPSData.Status = INVALID; |
376 | DebugUART = UART0; |
376 | DebugUART = UART0; |
377 | break; |
377 | break; |
378 | } |
378 | } |