/C-OSD/trunk/CHANGE.LOG |
---|
18,6 → 18,11 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
20100218-2330 |
*hopefully fixed the laggy osd data problem |
-send_data_mk has been striked out to save space |
@nc-mode should be small enough for bootloader again ( Program: 14986 bytes (91.5% Full) ) |
20100216-1430 |
*some menu stuff |
*stats in nc_default do not disturb the bigvario anymore |
/C-OSD/trunk/README.TXT |
---|
39,6 → 39,10 |
You can connect a spare RC-Channel to the PPM connector and enable/disable the HUD remotely with it, hopefully. |
Known Problems: |
When using the EPi-OSD, NaviCtrl and another Pc-Connection (direct or via wireless connections like bluetooth, WI232, WiFi and such) on the same wire there might be data collisions causing laggy screen updates, and in some hypothetical cases that are not scientifically proven, harm to the Atmega and other attached Hardware. So it is not recommended to use the stuff like that, altough some people are and not experiencing any problems at all. |
Software may fry your cat when flashing the micro-oven with it, or even when using the software near a micro-oven. |
How To Flash the software (the MK-user way): |
Requirements: |
- Windows PC with a real SerialPort |
/C-OSD/trunk/config.c |
---|
124,13 → 124,17 |
// request version from board |
rxd_buffer_locked = 0; |
usart1_EnableTXD(); |
#if FCONLY |
usart1_request_mk_data(0, 'v', 0); |
write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........")); |
//usart1_request_mk_data(0, 'v', 0); |
write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........")); |
usart1_puts_pgm(PSTR(REQUEST_FC_VERSION)); |
#else |
usart1_request_mk_data(1, 'v', 0); |
write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........")); |
//usart1_request_mk_data(1, 'v', 0); |
usart1_puts_pgm(PSTR(REQUEST_NC_VERSION)); |
write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........")); |
#endif |
usart1_DisableTXD(); |
// wait for response |
while (rxd_buffer_locked == 0) { |
asm("nop"); |
151,7 → 155,7 |
mode += COSD_DISPLAYMODE; |
osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
// re-request data ever 100ms from FC; |
usart1_request_mk_data(0, 'd', 100); |
//usart1_request_mk_data(0, 'd', 100); |
#else |
COSD_DISPLAYMODE %= (sizeof(ncdisplaymodes) / sizeof(displaymode_t)); |
mode = ncdisplaymodes; |
158,7 → 162,7 |
mode += COSD_DISPLAYMODE; |
osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
// re-request OSD Data from NC every 100ms |
usart1_request_mk_data(1, 'o', 100); |
//usart1_request_mk_data(1, 'o', 100); |
#endif |
_delay_ms(3000); |
/C-OSD/trunk/default/Makefile |
---|
13,6 → 13,7 |
## Compile options common for all C compilation units. |
CFLAGS += $(COMMON) |
##CFLAGS += -fno-common |
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d |
/C-OSD/trunk/default/dist.bat |
---|
19,7 → 19,7 |
:: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
:: ****************************************************************************/ |
set DATE=20100214-1700 |
set DATE=20100218-2330 |
:: date /T |
:: clean up first |
/C-OSD/trunk/main.c |
---|
223,7 → 223,6 |
#endif |
// set up Atmega162 Ports |
DDRA |= (1 << PA1); // PA1 output (/CS) |
MAX_CS_HIGH |
296,6 → 295,9 |
// init usart |
usart1_init(); |
// keep serial port clean |
usart1_DisableTXD(); |
// set up timer |
// CTC, Prescaler /64 |
TCCR0 = (1 << WGM01) | (0 << WGM00) | (0 << CS02) | (1 << CS01) | (1 << CS00); |
338,17 → 340,6 |
//usart1_puts("\x1B[2J\x1B[H"); |
//usart1_puts("hello world!123\r\n"); |
#if FCONLY |
// request data ever 100ms from FC; |
usart1_request_mk_data(0, 'd', 100); |
#else |
// request OSD Data from NC every 100ms |
usart1_request_mk_data(1, 'o', 100); |
// and disable debug... |
usart1_request_mk_data(0, 'd', 0); |
#endif |
while (1) { |
// in case SPI is ready and there is nothing to send right now |
if (!icnt && spi_ready) { |
388,6 → 379,7 |
} else { |
osd_fcmode(); |
} |
seconds_since_last_data = 0; |
} |
#else |
if (rxd_buffer[2] == 'O') { // NC OSD Data |
405,6 → 397,7 |
} else { |
osd_ncmode(); |
} |
//seconds_since_last_data = 0; |
} |
#endif |
rxd_buffer_locked = 0; |
413,20 → 406,24 |
if (s1_pressed()) { |
config_menu(); |
} |
if (seconds_since_last_data > 2) { |
if (seconds_since_last_data > 0) { |
usart1_EnableTXD(); |
//usart1_puts_pgm(PSTR("zu alt\r\n")); |
#if FCONLY |
// request data ever 100ms from FC; |
usart1_request_mk_data(0, 'd', 100); |
//usart1_request_mk_data(0, 'd', 100); |
usart1_puts_pgm(PSTR(REQUEST_DBG_DATA)); |
#else |
// request OSD Data from NC every 100ms |
usart1_request_mk_data(1, 'o', 100); |
//usart1_request_mk_data(1, 'o', 100); |
usart1_puts_pgm(PSTR(REQUEST_OSD_DATA)); |
// and disable debug... |
usart1_request_mk_data(0, 'd', 0); |
//usart1_request_mk_data(0, 'd', 0); |
#endif |
// reset last time counter |
seconds_since_last_data = 0; |
#endif |
usart1_DisableTXD(); |
} |
} |
#endif |
/C-OSD/trunk/usart1.c |
---|
83,12 → 83,21 |
/** |
* send a <string> throught usart1 |
*/ |
void usart1_puts(char *s) { |
/*void usart1_puts(char *s) { |
while (*s) { |
usart1_putc(*s); |
s++; |
} |
} |
}*/ |
/** |
* send a PGM<string> throught usart1 |
*/ |
void usart1_puts_pgm(const char* string) { |
while (pgm_read_byte(string) != 0x00) |
usart1_putc(pgm_read_byte(string++)); |
} |
/** |
* transmit interrupt handler |
114,8 → 123,14 |
static uint8_t usart_rx_ok = 0; |
uint8_t crc1, crc2; |
// the rxd buffer is unlocked |
if (usart_rx_ok == 0) { |
if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
if (usart_rx_ok == 0) { |
// if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && |
#if FCONLY |
(c == 'V' || c == 'D')) { // version and debug |
#else |
(c == 'V' || c == 'O')) { // version and OSD |
#endif |
usart_rx_ok = 1; |
rxd_buffer[ptr_rxd_buffer++] = c2; |
crc = c2; |
204,7 → 219,7 |
* portions taken and adapted from |
* http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
*/ |
void sendMKData(unsigned char cmd, unsigned char addr, unsigned char *snd, unsigned char len) { |
/*void sendMKData(unsigned char cmd, unsigned char addr, unsigned char *snd, unsigned char len) { |
unsigned int pt = 0; |
unsigned char a, b, c; |
unsigned char ptr = 0; |
242,7 → 257,7 |
txd_buffer[i++] = '\r'; |
usart1_puts((char*) txd_buffer); |
} |
}*/ |
/** |
* short script to directly send a request thorugh usart including en- and disabling it |
249,7 → 264,7 |
* where <address> is the address of the receipient, <label> is which data set to request |
* and <ms> represents the milliseconds delay between data |
*/ |
void usart1_request_mk_data(uint8_t address, char label, uint8_t ms) { |
/*void usart1_request_mk_data(uint8_t address, char label, uint8_t ms) { |
// re-enable TXD pin |
usart1_EnableTXD(); |
259,6 → 274,6 |
while (!(UCSR1A & (1 << UDRE1))); |
// disable TXD pin again |
usart1_DisableTXD(); |
} |
}*/ |
#endif |
/C-OSD/trunk/usart1.h |
---|
21,8 → 21,14 |
#define baud 57600 |
#define RXD_BUFFER_LEN 150 |
#define TXD_BUFFER_LEN 10 // not needed |
#define TXD_BUFFER_LEN 20 // not so much needed |
//#define REQUEST_OSD_DATA "#aoAm==EX\r" |
#define REQUEST_OSD_DATA "#bo?]==EG\r" |
#define REQUEST_DBG_DATA "#ad?]==D{\r" |
#define REQUEST_FC_VERSION "#av====Dk\r" |
#define REQUEST_NC_VERSION "#bv====Dl\r" |
extern volatile uint8_t rxd_buffer_locked; |
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
extern volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
46,9 → 52,9 |
void usart1_EnableTXD(void); |
/** |
* send a <string> throught usart1 |
* send a PGM<string> throught usart1 |
*/ |
void usart1_puts(char*); |
void usart1_puts_pgm(const char*); |
/** |
* transmit interrupt handler |
76,7 → 82,7 |
* portions taken and adapted from |
* http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.c |
*/ |
void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
//void sendMKData(unsigned char, unsigned char, unsigned char*, unsigned char); |
/** |
* short script to directly send a request thorugh usart including en- and disabling it |
83,4 → 89,4 |
* where <address> is the address of the receipient, <label> is which data set to request |
* and <ms> represents the milliseconds delay between data |
*/ |
void usart1_request_mk_data(uint8_t, char, uint8_t); |
//void usart1_request_mk_data(uint8_t, char, uint8_t); |