Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 761 → Rev 760

/C-OSD/trunk/CHANGE.LOG
18,11 → 18,6
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
****************************************************************************/
 
20100501-1130
*distance to home now 4 digits for long distance flights
*max height and speed shown again in stats
*clear full screen before stats shown so the art-horizon does not bug us
 
20100419-0020
*fixed bug causing PPM-based display on/off to fail
*fixed display of AGRESSiVA-horizion during motor run
/C-OSD/trunk/c-osd.aws
1,0 → 0,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA162"/><Files><File00000 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.c" Position="1142 155 1691 613" LineCol="397 0" State="Maximized"/><File00001 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\mk-data-structs.h" Position="1164 177 1705 605" LineCol="68 0" State="Maximized"/><File00002 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.h" Position="1186 199 1727 627" LineCol="0 0" State="Maximized"/><File00003 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.c" Position="1208 221 1749 649" LineCol="92 0" State="Maximized"/><File00004 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.c" Position="1230 243 1771 671" LineCol="117 0" State="Maximized"/><File00005 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.h" Position="1252 265 1793 693" LineCol="0 0" State="Maximized"/><File00006 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.c" Position="1274 287 1815 715" LineCol="2924 0" State="Maximized"/><File00007 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.h" Position="1296 309 1837 737" LineCol="146 0" State="Maximized"/><File00008 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.c" Position="1318 331 1859 759" LineCol="215 0" State="Maximized"/><File00009 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.h" Position="1340 353 1881 781" LineCol="70 0" State="Maximized"/><File00010 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.c" Position="1138 132 1889 789" LineCol="137 96" State="Maximized"/><File00011 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.c" Position="1164 177 1705 605" LineCol="104 0" State="Maximized"/><File00012 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.c" Position="1186 199 1727 627" LineCol="337 0" State="Maximized"/><File00013 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.h" Position="1208 221 1749 649" LineCol="25 0" State="Maximized"/><File00014 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.c" Position="1230 243 1771 671" LineCol="0 0" State="Maximized"/><File00015 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.h" Position="1252 265 1793 693" LineCol="0 0" State="Maximized"/><File00016 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.c" Position="1274 287 1815 715" LineCol="0 0" State="Maximized"/><File00017 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.h" Position="1296 309 1837 737" LineCol="0 0" State="Maximized"/><File00018 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.c" Position="1318 331 1859 759" LineCol="43 0" State="Maximized"/><File00019 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.h" Position="1340 353 1881 781" LineCol="0 0" State="Maximized"/><File00020 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.c" Position="1142 155 1683 583" LineCol="171 0" State="Maximized"/><File00021 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.h" Position="1164 177 1705 605" LineCol="0 0" State="Maximized"/><File00022 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.h" Position="1186 199 1727 627" LineCol="0 0" State="Maximized"/><File00023 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.h" Position="1208 221 1749 649" LineCol="7 0" State="Maximized"/><File00024 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.h" Position="1230 243 1771 671" LineCol="24 0" State="Maximized"/><File00025 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_jopl.c" Position="1252 265 1793 693" LineCol="28 0" State="Maximized"/><File00026 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\default\Makefile" Position="1274 287 1815 715" LineCol="16 0" State="Maximized"/></Files></AVRWorkspace>
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA162"/><Files><File00000 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.c" Position="908 133 1642 590" LineCol="397 5" State="Maximized"/><File00001 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\mk-data-structs.h" Position="930 155 1656 582" LineCol="68 0" State="Maximized"/><File00002 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.h" Position="952 177 1678 604" LineCol="0 0" State="Maximized"/><File00003 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.c" Position="974 199 1700 626" LineCol="92 0" State="Maximized"/><File00004 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.c" Position="996 221 1722 648" LineCol="117 0" State="Maximized"/><File00005 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.h" Position="1018 243 1744 670" LineCol="0 0" State="Maximized"/><File00006 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.c" Position="1040 265 1766 692" LineCol="2924 0" State="Maximized"/><File00007 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.h" Position="1062 287 1788 714" LineCol="146 24" State="Maximized"/><File00008 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.c" Position="1084 309 1810 736" LineCol="215 0" State="Maximized"/><File00009 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.h" Position="1106 331 1832 758" LineCol="70 0" State="Maximized"/><File00010 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.c" Position="908 133 1634 560" LineCol="32 47" State="Maximized"/><File00011 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.c" Position="930 155 1656 582" LineCol="104 0" State="Maximized"/><File00012 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.c" Position="904 110 1840 766" LineCol="337 45" State="Maximized"/><File00013 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.h" Position="974 199 1700 626" LineCol="25 0" State="Maximized"/><File00014 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.c" Position="996 221 1722 648" LineCol="0 0" State="Maximized"/><File00015 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.h" Position="1018 243 1744 670" LineCol="0 0" State="Maximized"/><File00016 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.c" Position="1040 265 1766 692" LineCol="0 0" State="Maximized"/><File00017 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.h" Position="1062 287 1788 714" LineCol="0 0" State="Maximized"/><File00018 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.c" Position="1084 309 1810 736" LineCol="43 3" State="Maximized"/><File00019 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.h" Position="1106 331 1832 758" LineCol="0 0" State="Maximized"/><File00020 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.c" Position="908 133 1634 560" LineCol="171 0" State="Maximized"/><File00021 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.h" Position="930 155 1656 582" LineCol="0 0" State="Maximized"/><File00022 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.h" Position="952 177 1678 604" LineCol="0 0" State="Maximized"/><File00023 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.h" Position="974 199 1700 626" LineCol="7 0" State="Maximized"/><File00024 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.h" Position="996 221 1722 648" LineCol="24 0" State="Maximized"/><File00025 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_jopl.c" Position="1018 243 1744 670" LineCol="28 0" State="Maximized"/><File00026 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\default\Makefile" Position="1040 265 1766 692" LineCol="16 59" State="Maximized"/></Files></AVRWorkspace>
/C-OSD/trunk/characters.c
5927,6 → 5927,7
 
const char *chars[] PROGMEM = {chr0, chr1, chr2, chr3, chr4, chr5, chr6, chr7, chr8, chr9, chr10, chr11, chr12, chr13, chr14, chr15, chr16, chr17, chr18, chr19, chr20, chr21, chr22, chr23, chr24, chr25, chr26, chr27, chr28, chr29, chr30, chr31, chr32, chr33, chr34, chr35, chr36, chr37, chr38, chr39, chr40, chr41, chr42, chr43, chr44, chr45, chr46, chr47, chr48, chr49, chr50, chr51, chr52, chr53, chr54, chr55, chr56, chr57, chr58, chr59, chr60, chr61, chr62, chr63, chr64, chr65, chr66, chr67, chr68, chr69, chr70, chr71, chr72, chr73, chr74, chr75, chr76, chr77, chr78, chr79, chr80, chr81, chr82, chr83, chr84, chr85, chr86, chr87, chr88, chr89, chr90, chr91, chr92, chr93, chr94, chr95, chr96, chr97, chr98, chr99, chr100, chr101, chr102, chr103, chr104, chr105, chr106, chr107, chr108, chr109, chr110, chr111, chr112, chr113, chr114, chr115, chr116, chr117, chr118, chr119, chr120, chr121, chr122, chr123, chr124, chr125, chr126, chr127, chr128, chr129, chr130, chr131, chr132, chr133, chr134, chr135, chr136, chr137, chr138, chr139, chr140, chr141, chr142, chr143, chr144, chr145, chr146, chr147, chr148, chr149, chr150, chr151, chr152, chr153, chr154, chr155, chr156, chr157, chr158, chr159, chr160, chr161, chr162, chr163, chr164, chr165, chr166, chr167, chr168, chr169, chr170, chr171, chr172, chr173, chr174, chr175, chr176, chr177, chr178, chr179, chr180, chr181, chr182, chr183, chr184, chr185, chr186, chr187, chr188, chr189, chr190, chr191, chr192, chr193, chr194, chr195, chr196, chr197, chr198, chr199, chr200, chr201, chr202, chr203, chr204, chr205, chr206, chr207, chr208, chr209, chr210, chr211, chr212, chr213, chr214, chr215, chr216, chr217, chr218, chr219, chr220, chr221, chr222, chr223, chr224, chr225, chr226, chr227, chr228, chr229, chr230, chr231, chr232, chr233, chr234, chr235, chr236, chr237, chr238, chr239, chr240, chr241, chr242, chr243, chr244, chr245, chr246, chr247, chr248, chr249, chr250, chr251, chr252, chr253, chr254, chr255};
 
 
/**
* put the above chars in the memory of the MAX7456
* TODO: read out character, compare and write only if different
/C-OSD/trunk/config.c
23,6 → 23,7
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <util/delay.h>
//#include <avr/delay.h>
#include "max7456_software_spi.h"
#include "config.h"
#include "main.h"
82,6 → 83,7
eeprom_write_byte(&ee_COSD_DISPLAYMODE, COSD_DISPLAYMODE);
}
 
 
/**
* auto config some stuff on startup, currently only battery cells
*/
185,6 → 187,7
}
}
 
 
/**
* helper function for menu updating
*/
/C-OSD/trunk/default/dist.bat
19,7 → 19,7
:: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
:: ****************************************************************************/
 
set DATE=20100501-1130
set DATE=20100412-2125
:: date /T
 
:: clean up first
/C-OSD/trunk/main.c
125,8 → 125,7
str_SW,
str_W,
str_NW,
str_N
};
str_N};
 
/* ##########################################################################
* Different display mode function pointers
/C-OSD/trunk/max7456_software_spi.c
19,6 → 19,7
****************************************************************************/
 
#include <avr/io.h>
 
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <string.h>
65,6 → 66,7
MAX_CS_HIGH
}
 
 
/**
* write a <character> to <address> of MAX7456 display memory
*/
74,6 → 76,7
spi_send_byte(0x07, character); // DMDI
}
 
 
/**
* clear display memory
* (also sets 8bit mode)
92,7 → 95,6
 
 
#if (ALLCHARSDEBUG|(WRITECHARS != -1))
 
/**
* for testing write all chars to screen
*/
/C-OSD/trunk/mk-data-structs.h
38,6 → 38,7
uint16_t Analog[32]; // Debugvalues
} __attribute__((packed)) DebugOut_t;
 
 
typedef struct {
unsigned char SWMajor;
unsigned char SWMinor;
47,6 → 48,7
unsigned char Reserved[5];
} str_VersionInfo;
 
 
/*
* NaviCtrl OSD Structs
* portions taken and adapted from
62,6 → 64,7
#define NEWDATA 0x01
#define PROCESSED 0x02
 
 
typedef struct {
u16 Distance; // distance to target in cm
s16 Bearing; // course to target in deg
/C-OSD/trunk/osd_helpers.c
89,7 → 89,6
/* ##########################################################################
* battery index
* ##########################################################################*/
 
/**
* draw a battery symbol at <x>/<y> according to <voltage>
*/
104,7 → 103,6
/* ##########################################################################
* variometer
* ##########################################################################*/
 
/**
* draw variometer arrows at <x>/<y> according to <variometer>
*/
186,7 → 184,6
* NEW artificial horizon By AGRESSiVA --=-- COPTERTRONiC
* ##########################################################################*/
// draw routine
 
int draw_noodles(int8_t pos_x, int8_t pos_y, int8_t num, int8_t old_num) {
const char noodle[5] = {0x78, 0x79, 0x7A, 0x7B, 0x7C};
int8_t line, car;
197,12 → 194,7
write_char_xy(15 - pos_x, pos_y + (old_num), 0);
}
 
if (num < 0) {
car = -1 * car;
car = 4 - car;
line--;
num = num - 5;
}
if (num < 0) {car = -1* car; car = 4 - car; line--; num = num - 5;}
write_char_xy(15 - pos_x, pos_y + line, noodle[car]);
 
return line;
/C-OSD/trunk/osd_ncmode_default.c
133,9 → 133,9
 
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
// feet
write_ndigit_number_u(23, top_line + 1, naviData.HomePositionDeviation.Distance / 10 * 32 / 10, 4, 0);
write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10 * 32 / 10, 3, 0);
} else {
write_ndigit_number_u(23, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 4, 0);
write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 3, 0);
}
 
// center
167,11 → 167,6
// motors are on, assume we were/are flying
COSD_FLAGS_RUNTIME |= COSD_WASFLYING;
} else {
if ((old_MKFlags & FLAG_MOTOR_RUN)) { // motors just stopped
clear(); // clear whole screen in case there is horizon stuff left
// update flags to paint display again if needed
COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
}
// stats
if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
uint8_t line = 3;
180,18 → 175,18
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance
 
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0);
write_ndigit_number_s(16, line, max_Altimeter * 32 / 10, 4, 0);
write_char_xy(20, line - 2, 0x7E); // small feet ft
write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
write_ndigit_number_u(17, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 279) / (uint32_t) 12500), 3, 0);
write_char_xy(20, line - 1, 0x7D); // mp/h
write_ndigit_number_u(17, line - 0, max_Distance / 10 * 32 / 10, 3, 0);
write_ndigit_number_u(17, line, max_Distance / 10 * 32 / 10, 3, 0);
write_char_xy(20, line - 0, 0x7E); // small feet ft
} else {
write_ndigit_number_s(16, line - 2, max_Altimeter, 4, 0);
write_ndigit_number_s(16, line, max_Altimeter, 4, 0);
write_char_xy(20, line - 2, 204); // small meters m
write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
write_ndigit_number_u(17, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
write_char_xy(20, line - 1, 203); // km/h
write_ndigit_number_u(17, line - 0, max_Distance / 10, 3, 0);
write_ndigit_number_u(17, line, max_Distance / 10, 3, 0);
write_char_xy(20, line - 0, 204); // small meters m
}
 
/C-OSD/trunk/spi.c
50,6 → 50,7
//sei(); // we do it later
}
 
 
/**
* SPI interrupt handler
*/
/C-OSD/trunk/usart1.c
90,6 → 90,7
}
}*/
 
 
/**
* send a PGM<string> throught usart1
*/
124,7 → 125,6
// the rxd buffer is unlocked
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