/C-OSD/trunk/CHANGE.LOG |
---|
18,6 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
20110825-1000 |
*initial testing stuff for -45° rotated flights (X instead of +) |
*some minor code changes |
20110605-1045 |
*possible fix of the previous ugly RSSI hack |
/C-OSD/trunk/README.TXT |
---|
33,7 → 33,7 |
Instructions: |
Connect the "To FC" port from EPi-OSD to the Debug port of the NaviCtrl. |
You will need at least NaviCtrl 0.18c soft to fully enjoy the software. |
You will need at least NaviCtrl 0.24b soft to fully enjoy the software. |
S1 enters a menu where you can cycle through using S2 and toggle/accept choice with S1 |
49,7 → 49,7 |
FAQ: |
http://www.mylifesucks.de/oss/c-osd/#FAQ |
How To Flash the software (the MK-user way): |
How to flash the software (the MK-user way): |
Requirements: |
- Windows PC with a real SerialPort |
- PonyProg (http://www.LancOS.com) |
66,4 → 66,18 |
- Open the .hex file and Writa All (Ctrl+W) |
- Hopefully done :) |
How to flash the software with avrdude: |
Requirements: |
- ISP-Programmer which is supported by avrdude (SerCon, usbasp, AVRISP-MKII and so on...) |
- avrdude |
HowTo: |
- assuming your ISP programmer is a usbasp compatible connected via usb |
- fuses: |
avrdude -c usbasp -P usb -p m162 -u -v -U lfuse:w:0xff:m -U hfuse:w:0xD7:m -U efuse:w:0xFB:m |
- firmware: |
avrdude -c usbasp -P usb -p m162 -u -U flash:w:C-OSD-######.hex |
- for serial port programming using the SerCon |
avrdude -p m162 -c siprog -P COM1 *****************look above***************** |
#EOF |
/C-OSD/trunk/config.c |
---|
32,6 → 32,7 |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
// EEPROM bytes |
uint8_t EEMEM ee_checkbyte1 = CHECKBYTE1; |
uint8_t EEMEM ee_checkbyte2 = CHECKBYTE2; |
uint8_t EEMEM ee_COSD_FLAGS_MODES = 0; |
50,9 → 51,6 |
const displaymode_t * mode; |
const char ee_message0[] PROGMEM = "Loading from EEPROM"; |
const char ee_message1[] PROGMEM = "No Data in EEPROM"; |
const char* ee_msg[] PROGMEM = {ee_message0, ee_message1}; |
/** |
* read data saved in eeprom, print out message if <verbose> is set |
59,7 → 57,7 |
*/ |
void get_eeprom(uint8_t verbose) { |
if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) { |
if (verbose) write_ascii_string_pgm(2, 2, ee_msg[0]); // Loading data |
if (verbose) write_ascii_string_pgm(2, 2, PSTR("Loading from EEPROM")); // Loading data |
COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES); |
COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG); |
COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE); |
68,7 → 66,7 |
scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]); |
} |
} else { |
if (verbose) write_ascii_string_pgm(2, 2, ee_msg[1]); // Loading data |
if (verbose) write_ascii_string_pgm(2, 2, PSTR("No Data in EEPROM")); // Loading data |
} |
} |
/C-OSD/trunk/default/Makefile |
---|
24,7 → 24,11 |
MCU = atmega162 |
TARGET = C-OSD.elf |
CC = avr-gcc |
AVRDUDE = avrdude |
ISPTYPE = usbasp |
ISPPORT = usb |
## Options common to compile, link and assembly rules |
COMMON = -mmcu=$(MCU) |
59,7 → 63,7 |
LINKONLYOBJECTS = |
## Build |
all: $(TARGET) C-OSD.hex C-OSD.eep C-OSD.lss size |
all: $(TARGET) C-OSD.hex C-OSD.eep C-OSD.lss size #flash |
## Compile |
main.o: ../main.c |
121,6 → 125,11 |
@echo |
@avr-size -C --mcu=${MCU} ${TARGET} |
flash: ${TARGET} |
@echo |
avrdude -c ${ISPTYPE} -P ${ISPPORT} -p ${MCU} -u -U flash:w:C-OSD.hex |
## Clean target |
.PHONY: clean |
clean: |
/C-OSD/trunk/main.c |
---|
60,8 → 60,11 |
* ##########################################################################*/ |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
#if FCONLY |
volatile str_DebugOut debugData; |
#else |
volatile NaviData_t naviData; |
volatile str_DebugOut debugData; |
#endif |
// cache old vars for blinking attribute, checkup is faster than full |
// attribute write each time |
106,39 → 109,10 |
// flags from last round to check for changes |
uint8_t old_MKFlags = 0; |
// store stats description in progmem to save space |
const char stats_item_0[] PROGMEM = "max Altitude:"; |
const char stats_item_1[] PROGMEM = "max Speed :"; |
const char stats_item_2[] PROGMEM = "max Distance:"; |
const char stats_item_3[] PROGMEM = "min Voltage :"; |
const char stats_item_4[] PROGMEM = "max Time:"; |
const char stats_item_5[] PROGMEM = "longitude :"; |
const char stats_item_6[] PROGMEM = "latitude:"; |
const char stats_item_7[] PROGMEM = "max current :"; |
const char *stats_item_pointers[8] PROGMEM = {stats_item_0, stats_item_1, stats_item_2, |
stats_item_3, stats_item_4, stats_item_5, stats_item_6, stats_item_7}; |
//char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "}; |
char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "}; |
//char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219}; |
const char str_NE[] PROGMEM = "NE"; |
const char str_E[] PROGMEM = "E "; |
const char str_SE[] PROGMEM = "SE"; |
const char str_S[] PROGMEM = "S "; |
const char str_SW[] PROGMEM = "SW"; |
const char str_W[] PROGMEM = "W "; |
const char str_NW[] PROGMEM = "NW"; |
const char str_N[] PROGMEM = "N "; |
const char *directions[8] PROGMEM = { |
str_NE, |
str_E, |
str_SE, |
str_S, |
str_SW, |
str_W, |
str_NW, |
str_N |
}; |
/* ########################################################################## |
* Different display mode function pointers |
* ##########################################################################*/ |
403,6 → 377,12 |
Decode64(); |
naviData = *((NaviData_t*)pRxData); |
#ifdef SHIFTBYminus45 |
naviData.AngleNick = (int8_t)(((int16_t)naviData.AngleRoll + (int16_t)naviData.AngleNick) / 2); |
naviData.AngleRoll = (int8_t)(((int16_t)naviData.AngleRoll - (int16_t)naviData.AngleNick) / 2); |
naviData.CompassHeading = (naviData.CompassHeading + (360 - 45)) % 360; |
#endif |
// init on first data retrival, distinguished by last battery :) |
if (last_UBat == 255) { |
if (naviData.UBat > 40) { |
/C-OSD/trunk/main.h |
---|
169,8 → 169,11 |
* ##########################################################################*/ |
volatile uint16_t setsReceived; |
#if FCONLY |
volatile str_DebugOut debugData; |
#else |
volatile NaviData_t naviData; |
volatile str_DebugOut debugData; |
#endif |
// cache old vars for blinking attribute, checkup is faster than full |
// attribute write each time |
212,7 → 215,6 |
uint8_t old_MKFlags; |
uint8_t old_NCFlags; |
const char *directions[8]; |
const char *stats_item_pointers[8]; |
char *directions[8]; |
#endif |
/C-OSD/trunk/osd_fcmode_jopl.c |
---|
72,7 → 72,7 |
// jopl ... compass |
write_ndigit_number_u(13, top_line, debugData.Analog[8], 3, 0); |
write_ascii_string_pgm(17, top_line, (const char *)(pgm_read_word(&(directions[heading_conv(debugData.Analog[8])])))); |
write_ascii_string_pgm(17, top_line, directions[heading_conv(debugData.Analog[8])]); |
// end jopl |
// jopl Altimeter modification |
/C-OSD/trunk/osd_helpers.c |
---|
73,7 → 73,7 |
*/ |
void draw_compass(uint8_t x, uint8_t y, uint16_t heading) { |
//char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W"; |
static char rose[48] PROGMEM = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
static char rose[] PROGMEM = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213, |
216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211, |
216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214}; |
109,46 → 109,16 |
* draw variometer arrows at <x>/<y> according to <variometer> |
*/ |
void draw_variometer(uint8_t x, uint8_t y, int16_t variometer) { |
if (variometer == 0) { |
write_char_xy(x, y, 0xbb); // plain line |
} else if (variometer > 0) { // gain height |
switch (variometer / 5) { |
case 0: |
//write_char_xy(x, y, 0xba); // smallest arrow up |
write_char_xy(x, y, 0x70); // one arrow up |
break; |
case 1: |
//write_char_xy(x, y, 0xb9); // small arrow up |
write_char_xy(x, y, 0x71); // two arrows up |
break; |
case 2: |
//write_char_xy(x, y, 0xb8); // large arrow up |
write_char_xy(x, y, 0x72); // three arrows up |
break; |
default: |
//write_char_xy(x, y, 0xb7); // largest arrow up |
write_char_xy(x, y, 0x73); // three black arrows up |
} |
uint8_t chr = 0xbb; |
if (variometer > 0) { // gain height |
chr = 0x70 + (variometer / 5); |
if (chr > 0x73) chr = 0x73; |
} else { // sink |
switch (variometer / -5) { |
case 0: |
//write_char_xy(x, y, 0xbc); // smallest arrow down |
write_char_xy(x, y, 0x77); // one arrow down |
break; |
case 1: |
//write_char_xy(x, y, 0xbd); // small arrow down |
write_char_xy(x, y, 0x76); // two arrows down |
break; |
case 2: |
//write_char_xy(x, y, 0xbe); // large arrow down |
write_char_xy(x, y, 0x75); // three arrows down |
break; |
default: |
//write_char_xy(x, y, 0xbf); // largest arrow down |
write_char_xy(x, y, 0x74); // three black arrows down |
chr = 0x77 - (variometer / -5); |
if (chr < 0x74) chr = 0x74; |
} |
write_char_xy(x, y, chr); |
} |
} |
// big vario arrays |
const char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff}; |
342,9 → 312,9 |
#if FCONLY |
#else |
uint8_t line = 3; |
write_ascii_string_pgm(1, line, (const char *)(pgm_read_word(&(stats_item_pointers[0])))); // max Altitude |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[1])))); // max Speed |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance |
write_ascii_string_pgm(1, line, PSTR("max Altitude:")); // max Altitude |
write_ascii_string_pgm(1, ++line, PSTR("max Speed :")); // max Speed |
write_ascii_string_pgm(1, ++line, PSTR("max Distance:")); // max Distance |
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) { |
write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0); |
362,11 → 332,11 |
write_char_xy(20, line - 0, 204); // small meters m |
} |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[3])))); // min voltage |
write_ascii_string_pgm(1, ++line, PSTR("min Voltage :")); // min voltage |
write_ndigit_number_u_10th(16, line, min_UBat, 3, 0); |
write_char_xy(20, line, 0x9E); // small V |
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[7])))); // ampere |
write_ascii_string_pgm(1, ++line, PSTR("max current :")); // ampere |
write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0); |
write_char_xy(20, line, 0x9F); // small A |
380,12 → 350,12 |
write_char_xy(26, line, 0xB5); // mah |
} |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[4])))); // max time |
write_ascii_string_pgm(1, ++line, PSTR("max Time:")); // max time |
write_time(14, line, max_FlyingTime); |
write_char_xy(20, line, 210); // fly clock |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[5])))); // longitude |
write_ascii_string_pgm(1, ++line, PSTR("longitude :")); // longitude |
write_gps_pos(14, line, naviData.CurrentPosition.Longitude); |
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[6])))); // latitude |
write_ascii_string_pgm(1, ++line, PSTR("latitude:")); // latitude |
write_gps_pos(14, line, naviData.CurrentPosition.Latitude); |
#endif |
} |
/C-OSD/trunk/osd_ncmode_default.c |
---|
99,7 → 99,7 |
write_ndigit_number_u(13, top_line, naviData.CompassHeading, 3, 0); |
write_ascii_string_pgm(17, top_line, (const char *)(pgm_read_word(&(directions[heading_conv(naviData.CompassHeading)])))); |
write_ascii_string(17, top_line, directions[heading_conv(naviData.CompassHeading)]); |
draw_variometer(21, top_line, naviData.Variometer); |