/C-OSD/trunk/CHANGE.LOG |
---|
17,6 → 17,12 |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
20090601-2233 |
*(woggle) changed timer init an interupt to be more precise |
*(woggle) remove all warning during compile |
*(woggle) simplify draw_big_variometer |
*(woggle) put compass rose to PROGMEM |
*(woggle) put directions array to PROGMEM |
20090525-2305 |
+HUD on/off via RC (connect to PPM, according to manual) testing stuff |
/C-OSD/trunk/config.c |
---|
42,36 → 42,36 |
uint8_t EEMEM ee_COSD_FLAGS; |
// store init strings in progmem |
char init_0[] PROGMEM = "C-OSD Initialisation"; |
char init_1[] PROGMEM = "FC only Mode"; |
char init_2[] PROGMEM = "NaviCtrl Mode"; |
char init_3[] PROGMEM = "Guessing Number of Cells"; |
char init_4[] PROGMEM = "Number of Cells:"; |
char init_5[] PROGMEM = "Warn Voltage :"; |
char init_6[] PROGMEM = "Max Voltage :"; |
char* init_point[] PROGMEM = {init_0, init_1, init_2, init_3, init_4, init_5, init_6}; |
const char init_0[] PROGMEM = "C-OSD Initialisation"; |
const char init_1[] PROGMEM = "FC only Mode"; |
const char init_2[] PROGMEM = "NaviCtrl Mode"; |
const char init_3[] PROGMEM = "Guessing Number of Cells"; |
const char init_4[] PROGMEM = "Number of Cells:"; |
const char init_5[] PROGMEM = "Warn Voltage :"; |
const char init_6[] PROGMEM = "Max Voltage :"; |
const char* init_point[] PROGMEM = {init_0, init_1, init_2, init_3, init_4, init_5, init_6}; |
char ee_message0[] PROGMEM = "Loading Data from EEPROM"; |
char ee_message1[] PROGMEM = "No saved Data in EEPROM"; |
char* ee_msg[] PROGMEM = {ee_message0, ee_message1}; |
const char ee_message0[] PROGMEM = "Loading Data from EEPROM"; |
const char ee_message1[] PROGMEM = "No saved Data in EEPROM"; |
const char* ee_msg[] PROGMEM = {ee_message0, ee_message1}; |
// video modes |
char VM_PAL[] PROGMEM = "PAL "; |
char VM_NTSC[] PROGMEM = "NTSC"; |
const char VM_PAL[] PROGMEM = "PAL "; |
const char VM_NTSC[] PROGMEM = "NTSC"; |
// menu strings to progmem |
char menu_item0[] PROGMEM = "Video Mode"; |
char menu_item1[] PROGMEM = "Full HUD"; |
char menu_item2[] PROGMEM = "Art.Horizon in HUD"; |
char menu_item3[] PROGMEM = "Big Vario bar"; |
char menu_item4[] PROGMEM = "Statistics"; |
char menu_item5[] PROGMEM = "Warnings"; // TODO: do it! |
char menu_item6[] PROGMEM = "Reset uptime"; |
char menu_item7[] PROGMEM = "Request OSD-data"; |
char menu_item8[] PROGMEM = "Disable Debug-data"; |
char menu_item9[] PROGMEM = "Save config"; |
char menu_item10[] PROGMEM = "EXIT"; |
char* menu[] = {menu_item0, menu_item1, menu_item2, menu_item3, menu_item4, |
const char menu_item0[] PROGMEM = "Video Mode"; |
const char menu_item1[] PROGMEM = "Full HUD"; |
const char menu_item2[] PROGMEM = "Art.Horizon in HUD"; |
const char menu_item3[] PROGMEM = "Big Vario bar"; |
const char menu_item4[] PROGMEM = "Statistics"; |
const char menu_item5[] PROGMEM = "Warnings"; // TODO: do it! |
const char menu_item6[] PROGMEM = "Reset uptime"; |
const char menu_item7[] PROGMEM = "Request OSD-data"; |
const char menu_item8[] PROGMEM = "Disable Debug-data"; |
const char menu_item9[] PROGMEM = "Save config"; |
const char menu_item10[] PROGMEM = "EXIT"; |
const char* menu[] = {menu_item0, menu_item1, menu_item2, menu_item3, menu_item4, |
menu_item5, menu_item6, menu_item7, menu_item8, menu_item9, menu_item10}; |
/** |
197,7 → 197,7 |
/** |
* some sort of clicking response in the menu |
*/ |
void config_menu_doclick(uint8_t chosen, char** menu) { |
void config_menu_doclick(uint8_t chosen, const char* menu[]) { |
write_ascii_string(4, chosen + 2, "DONE "); |
_delay_ms(500); |
write_ascii_string_pgm(4, chosen + 2, menu[chosen]); |
/C-OSD/trunk/main.c |
---|
69,17 → 69,39 |
volatile uint8_t seconds_since_last_data = 0; |
// store stats description in progmem to save space |
char stats_item_0[] PROGMEM = "max Altitude:"; |
char stats_item_1[] PROGMEM = "max Speed :"; |
char stats_item_2[] PROGMEM = "max Distance:"; |
char stats_item_3[] PROGMEM = "min voltage :"; |
char stats_item_4[] PROGMEM = "max time :"; |
char stats_item_5[] PROGMEM = "longitude :"; |
char stats_item_6[] PROGMEM = "latitude :"; |
char stats_item_7[] PROGMEM = "max current :"; |
char* stats_item_pointers[] PROGMEM = {stats_item_0, stats_item_1, stats_item_2, |
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[] 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}; |
#if !(FCONLY) |
//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}; |
#endif |
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
// general PAL|NTSC distingiusch stuff |
113,8 → 135,7 |
/** |
* timer kicks in every 1000uS ^= 1ms |
*/ |
ISR(TIMER0_OVF_vect) { |
OCR0 = 15; // preload |
ISR(TIMER0_COMP_vect) { |
if (!timer--) { |
uptime++; |
timer = 999; |
213,10 → 234,16 |
usart1_init(); |
// set up timer |
TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64 |
OCR0 = 15; // preload |
TIMSK |= (1 << TOIE0); // enable overflow timer0 |
// CTC, Prescaler /64 |
TCCR0 = (1 << WGM01) | (0 << WGM00) | (0 << CS02) | (1 << CS01) | (1 << CS00); |
TCNT0 = 0; |
OCR0 = 250; |
// enable timer output compare interrupt |
TIMSK &= ~(1 << TOIE0); |
TIMSK |= (1 << OCIE0); |
// SPI setup |
DDRD |= (1 << PD2); // PD2 output (INT0) |
SpiMasterInit(); |
266,9 → 293,6 |
// flags from last round to check for changes |
uint8_t old_MKFlags = 0; |
char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "}; |
//char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219}; |
#endif |
while (1) { |
/C-OSD/trunk/max7456_software_spi.c |
---|
147,7 → 147,7 |
/** |
* write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory |
*/ |
void write_ascii_string_pgm(uint8_t x, uint8_t y, char *string) { |
void write_ascii_string_pgm(uint8_t x, uint8_t y, const char *string) { |
while (pgm_read_byte(string) != 0x00) |
write_ascii_char(((x++)+(y * 30)), pgm_read_byte(string++)); |
} |
155,7 → 155,7 |
/** |
* write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory |
*/ |
void write_string_pgm_down(uint8_t x, uint8_t y, char *string, uint8_t length) { |
void write_string_pgm_down(uint8_t x, uint8_t y, const char *string, uint8_t length) { |
while (length--) |
write_char((x+(y++ * 30)), pgm_read_byte(string++)); |
} |
/C-OSD/trunk/max7456_software_spi.h |
---|
82,12 → 82,12 |
/** |
* write an ascii <string> from progmen at <x>/<y> to MAX7456 display memory |
*/ |
void write_ascii_string_pgm(uint8_t, uint8_t, char*); |
void write_ascii_string_pgm(uint8_t, uint8_t, const char*); |
/** |
* write an <string> from progmen at <x>/<y> downwards to MAX7456 display memory |
*/ |
void write_string_pgm_down(uint8_t, uint8_t, char*, uint8_t); |
void write_string_pgm_down(uint8_t, uint8_t, const char*, uint8_t); |
/** |
* Write only some digits of a unsigned <number> at <x>/<y> to MAX7456 display memory |
/C-OSD/trunk/osd_helpers.c |
---|
71,7 → 71,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"; |
char rose[48] = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212, |
static char rose[48] 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}; |
80,7 → 80,7 |
// and *10 / 225 would take ages... so we take the uncorrect way |
uint8_t front = 19 + (heading / 22); |
for (uint8_t i = 0; i < 9; i++) { |
write_char_xy(x++, y, rose[front - 4 + i]); |
write_char_xy(x++, y, pgm_read_byte(&rose[front - 4 + i])); |
} |
} |
147,22 → 147,22 |
} |
// big vario arrays |
char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff}; |
char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0}; |
char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1}; |
char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00}; |
char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00}; |
char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00}; |
char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00}; |
char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00}; |
char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00}; |
char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00}; |
char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00}; |
char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00}; |
char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00}; |
char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00}; |
char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00}; |
char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04, |
const char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff}; |
const char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0}; |
const char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1}; |
const char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00}; |
const char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00}; |
const char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00}; |
const char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00}; |
const char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00}; |
const char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00}; |
const char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00}; |
const char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00}; |
const char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00}; |
const char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00}; |
const char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00}; |
const char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00}; |
const char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04, |
vario_05, vario_06, vario_07, vario_08, |
vario_09, vario_10, vario_11, vario_12, |
vario_13, vario_14}; |
177,6 → 177,8 |
// TODO: why does write_string_pgm_down(x, y-2, vario_pnt[index], 5); |
// not work??? WTF?! |
write_string_pgm_down(x, y-2, (const char *) (pgm_read_word ( &(vario_pnt[index]))), 5); |
#if 0 |
switch (index) { |
case 0: write_string_pgm_down(x, y-2, vario_pnt[0], 5); |
break; |
208,6 → 210,7 |
break; |
default: write_string_pgm_down(x, y-2, vario_pnt[14], 5); |
} |
#endif |
} |
/* ########################################################################## |
/C-OSD/trunk/osd_ncmode_default.c |
---|
60,7 → 60,7 |
write_ndigit_number_u(13, top_line, naviData.CompassHeading, 100, 0); |
write_ascii_string(17, top_line, directions[heading_conv(naviData.CompassHeading)]); |
write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word ( &(directions[heading_conv(naviData.CompassHeading)])))); |
draw_variometer(21, top_line, naviData.Variometer); |