Rev 736 | Rev 761 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 736 | Rev 738 | ||
---|---|---|---|
Line 221... | Line 221... | ||
221 | #if FCONLY |
221 | #if FCONLY |
222 | COSD_FLAGS_CONFIG |= COSD_FLAG_FCMODE; |
222 | COSD_FLAGS_CONFIG |= COSD_FLAG_FCMODE; |
223 | #endif |
223 | #endif |
Line 224... | Line -... | ||
224 | - | ||
225 | 224 | ||
226 | 225 | ||
227 | // set up Atmega162 Ports |
226 | // set up Atmega162 Ports |
228 | DDRA |= (1 << PA1); // PA1 output (/CS) |
227 | DDRA |= (1 << PA1); // PA1 output (/CS) |
229 | MAX_CS_HIGH |
228 | MAX_CS_HIGH |
Line 294... | Line 293... | ||
294 | 293 | ||
295 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
294 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
296 | // init usart |
295 | // init usart |
Line -... | Line 296... | ||
- | 296 | usart1_init(); |
|
- | 297 | ||
- | 298 | // keep serial port clean |
|
297 | usart1_init(); |
299 | usart1_DisableTXD(); |
298 | 300 | ||
299 | // set up timer |
301 | // set up timer |
Line 300... | Line 302... | ||
300 | // CTC, Prescaler /64 |
302 | // CTC, Prescaler /64 |
Line 336... | Line 338... | ||
336 | 338 | ||
337 | // clear serial screen |
339 | // clear serial screen |
338 | //usart1_puts("\x1B[2J\x1B[H"); |
340 | //usart1_puts("\x1B[2J\x1B[H"); |
Line 339... | Line -... | ||
339 | //usart1_puts("hello world!123\r\n"); |
- | |
340 | - | ||
341 | #if FCONLY |
- | |
342 | // request data ever 100ms from FC; |
- | |
343 | usart1_request_mk_data(0, 'd', 100); |
- | |
344 | #else |
- | |
345 | // request OSD Data from NC every 100ms |
- | |
346 | usart1_request_mk_data(1, 'o', 100); |
- | |
347 | - | ||
348 | // and disable debug... |
- | |
349 | usart1_request_mk_data(0, 'd', 0); |
- | |
350 | #endif |
341 | //usart1_puts("hello world!123\r\n"); |
351 | 342 | ||
352 | while (1) { |
343 | while (1) { |
353 | // in case SPI is ready and there is nothing to send right now |
344 | // in case SPI is ready and there is nothing to send right now |
354 | if (!icnt && spi_ready) { |
345 | if (!icnt && spi_ready) { |
Line 386... | Line 377... | ||
386 | init_cosd(last_UBat); |
377 | init_cosd(last_UBat); |
387 | } |
378 | } |
388 | } else { |
379 | } else { |
389 | osd_fcmode(); |
380 | osd_fcmode(); |
390 | } |
381 | } |
- | 382 | seconds_since_last_data = 0; |
|
391 | } |
383 | } |
392 | #else |
384 | #else |
393 | if (rxd_buffer[2] == 'O') { // NC OSD Data |
385 | if (rxd_buffer[2] == 'O') { // NC OSD Data |
394 | Decode64(); |
386 | Decode64(); |
395 | naviData = *((NaviData_t*) pRxData); |
387 | naviData = *((NaviData_t*) pRxData); |
Line 403... | Line 395... | ||
403 | init_cosd(last_UBat); |
395 | init_cosd(last_UBat); |
404 | } |
396 | } |
405 | } else { |
397 | } else { |
406 | osd_ncmode(); |
398 | osd_ncmode(); |
407 | } |
399 | } |
- | 400 | //seconds_since_last_data = 0; |
|
408 | } |
401 | } |
409 | #endif |
402 | #endif |
410 | rxd_buffer_locked = 0; |
403 | rxd_buffer_locked = 0; |
411 | } |
404 | } |
412 | // handle keypress |
405 | // handle keypress |
413 | if (s1_pressed()) { |
406 | if (s1_pressed()) { |
414 | config_menu(); |
407 | config_menu(); |
415 | } |
408 | } |
416 | if (seconds_since_last_data > 2) { |
409 | if (seconds_since_last_data > 0) { |
- | 410 | usart1_EnableTXD(); |
|
- | 411 | //usart1_puts_pgm(PSTR("zu alt\r\n")); |
|
417 | #if FCONLY |
412 | #if FCONLY |
418 | // request data ever 100ms from FC; |
413 | // request data ever 100ms from FC; |
419 | usart1_request_mk_data(0, 'd', 100); |
414 | //usart1_request_mk_data(0, 'd', 100); |
- | 415 | usart1_puts_pgm(PSTR(REQUEST_DBG_DATA)); |
|
420 | #else |
416 | #else |
421 | // request OSD Data from NC every 100ms |
417 | // request OSD Data from NC every 100ms |
422 | usart1_request_mk_data(1, 'o', 100); |
418 | //usart1_request_mk_data(1, 'o', 100); |
- | 419 | usart1_puts_pgm(PSTR(REQUEST_OSD_DATA)); |
|
Line 423... | Line 420... | ||
423 | 420 | ||
424 | // and disable debug... |
421 | // and disable debug... |
425 | usart1_request_mk_data(0, 'd', 0); |
422 | //usart1_request_mk_data(0, 'd', 0); |
426 | 423 | #endif |
|
427 | // reset last time counter |
424 | // reset last time counter |
428 | seconds_since_last_data = 0; |
425 | seconds_since_last_data = 0; |
429 | #endif |
426 | usart1_DisableTXD(); |
430 | } |
427 | } |
431 | } |
428 | } |
432 | #endif |
429 | #endif |
433 | return 0; |
430 | return 0; |