/C-OSD/trunk/CHANGE.LOG |
---|
18,6 → 18,11 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
20100214-1700 |
+mah wasted per flight (still counts up after landing, but space gets tight) |
*init phase from 2000ms to 3000ms |
*init only takes place after first "valid" UBat is received (<4V should case the Mega to reset anyways) |
20100212-2310 |
*adapted MK-datastructs to NC 0.18c |
*added choice for current display measured by FC |
/C-OSD/trunk/config.c |
---|
41,16 → 41,6 |
char ON[] PROGMEM = "ON "; |
char OFF[] PROGMEM = "OFF"; |
// store init strings in progmem |
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}; |
// video modes |
const char VM_PAL[] PROGMEM = "PAL "; |
const char VM_NTSC[] PROGMEM = "NTSC"; |
118,20 → 108,16 |
*/ |
void init_cosd(uint8_t UBat) { |
clear(); |
write_ascii_string_pgm(2, 1, init_point[0]); // C-OSD Initialisation |
//write_ascii_string(2, 1, "C-OSD Initialisation"); |
write_ascii_string_pgm(2, 1, PSTR("C-OSD Initialisation")); // C-OSD Initialisation |
#if FCONLY |
write_ascii_string_pgm(2, 2, init_point[1]); // FC only mode |
//write_ascii_string(2, 2, "FC only Mode"); |
write_ascii_string_pgm(2, 2, PSTR("FC only Mode")); // FC only mode |
#else |
write_ascii_string_pgm(2, 2, init_point[2]); // NaviCtrl Mode |
//write_ascii_string(2, 2, "NaviCtrl Mode"); |
write_ascii_string_pgm(2, 2, PSTR("NaviCtrl Mode")); // NaviCtrl Mode |
#endif |
write_ascii_string_pgm(2, 3, PSTR(BUILDDATE)); |
uint8_t cellnum = 0; |
if (CELL_NUM == -1) { |
write_ascii_string_pgm(2, 4, init_point[3]); // Guessing Number of Cells |
//write_ascii_string(2, 6, "Guessing Number of Cells"); |
write_ascii_string_pgm(2, 4, PSTR("Guessing Number of Cells")); // Guessing Number of Cells |
do { |
cellnum++; |
} while (UBat > ((cellnum * CELL_VOLT_MAX) + 23)); |
140,14 → 126,11 |
} |
min_voltage = cellnum * CELL_VOLT_MIN; |
max_voltage = cellnum * CELL_VOLT_MAX; |
write_ascii_string_pgm(2, 5, init_point[4]); // Number of Cells |
//write_ascii_string(2, 5, "Number of Cells:"); |
write_ascii_string_pgm(2, 5, PSTR("Number of Cells:")); // Number of Cells |
write_ndigit_number_u(21, 5, cellnum, 1, 0); |
write_ascii_string_pgm(2, 6, init_point[5]); // Warn Voltage |
//write_ascii_string(2, 6, "Warn Voltage :"); |
write_ascii_string_pgm(2, 6, PSTR("Warn Voltage :")); // Warn Voltage |
write_ndigit_number_s_10th(20, 6, min_voltage, 3, 0); |
write_ascii_string_pgm(2, 7, init_point[6]); // Max Voltage |
//write_ascii_string(2, 7, "Max Voltage :"); |
write_ascii_string_pgm(2, 7, PSTR("Max Voltage :")); // Max Voltage |
write_ndigit_number_s_10th(20, 7, max_voltage, 3, 0); |
get_eeprom(1); |
198,7 → 181,7 |
usart1_request_mk_data(1, 'o', 100); |
#endif |
_delay_ms(2000); |
_delay_ms(3000); |
clear(); |
// update flags to paint display again because of clear |
COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN; |
/C-OSD/trunk/default/Makefile |
---|
13,7 → 13,7 |
## Compile options common for all C compilation units. |
CFLAGS += $(COMMON) |
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums |
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 |
## Assembly specific flags |
/C-OSD/trunk/main.c |
---|
56,8 → 56,6 |
* global definitions and global vars |
* ##########################################################################*/ |
volatile uint16_t setsReceived = 0; |
volatile NaviData_t naviData; |
volatile DebugOut_t debugData; |
382,10 → 380,12 |
// init on first data retrival, distinguished by last battery :) |
if (last_UBat == 255) { |
// fix for min_UBat |
min_UBat = debugData.Analog[9]; |
last_UBat = debugData.Analog[9]; |
init_cosd(last_UBat); |
if (debugData.Analog[9] > 40) |
// fix for min_UBat |
min_UBat = debugData.Analog[9]; |
last_UBat = debugData.Analog[9]; |
init_cosd(last_UBat); |
} |
} else { |
osd_fcmode(); |
} |
397,10 → 397,12 |
// init on first data retrival, distinguished by last battery :) |
if (last_UBat == 255) { |
// fix for min_UBat |
min_UBat = naviData.UBat; |
last_UBat = naviData.UBat; |
init_cosd(last_UBat); |
if (naviData.UBat > 40) { |
// fix for min_UBat |
min_UBat = naviData.UBat; |
last_UBat = naviData.UBat; |
init_cosd(last_UBat); |
} |
} else { |
osd_ncmode(); |
} |
/C-OSD/trunk/main.h |
---|
140,6 → 140,7 |
volatile uint16_t uptime; |
volatile uint16_t timer; |
volatile uint16_t flytime_fc; |
volatile uint16_t wasted_ampere_offset; |
// remember last time data was received |
volatile uint8_t seconds_since_last_data; |
/C-OSD/trunk/mk-data-structs.h |
---|
107,13 → 107,23 |
/* |
* MikroKopter Flags |
* taken from |
* http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.73d%2Ffc.h |
* http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.78b%2Ffc.h |
*/ |
#define FLAG_MOTOR_RUN 1 |
#define FLAG_FLY 2 |
#define FLAG_CALIBRATE 4 |
#define FLAG_START 8 |
#define FCFLAG_MOTOR_RUN 0x01 |
#define FCFLAG_FLY 0x02 |
#define FCFLAG_CALIBRATE 0x04 |
#define FCFLAG_START 0x08 |
#define FCFLAG_NOTLANDUNG 0x10 |
#define FCFLAG_LOWBAT 0x20 |
#define FCFLAG_SPI_RX_ERR 0x40 |
#define FCFLAG_I2CERR 0x80 |
// backward compat |
#define FLAG_MOTOR_RUN FCFLAG_MOTOR_RUN |
#define FLAG_FLY FCFLAG_FLY |
#define FLAG_CALIBRATE FCFLAG_CALIBRATE |
#define FLAG_START FCFLAG_START |
/* |
* NaviCtrl Flags |
* taken from |
/C-OSD/trunk/osd_ncmode_default.c |
---|
106,7 → 106,7 |
write_char_xy(21, top_line + 1, 0xa0 + heading_fine_conv(heading_home)); |
write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 3, 0); |
// center |
if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running |
if (!(old_MKFlags & FLAG_MOTOR_RUN)) { // motors just started, clear middle |
113,6 → 113,12 |
clear(); |
// remember current heigth for gps offset |
altimeter_offset = naviData.CurrentPosition.Altitude / 1000; |
// set wasted counter to current offset |
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
wasted_ampere_offset = ampere_wasted / 10; |
} else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) { |
wasted_ampere_offset = naviData.UsedCapacity; |
} |
// update flags to paint display again if needed |
COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN; |
} |
145,6 → 151,16 |
write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere |
write_ndigit_number_u_10th(18, line, max_ampere / 10, 3, 0); |
write_char_xy(22, line, 0x9F); // small A |
// wasted mampere in this flight (will count up after landing) |
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
write_ndigit_number_u(23, line, (ampere_wasted / 10) - wasted_ampere_offset, 4, 0); |
} else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) { |
write_ndigit_number_u(23, line, naviData.UsedCapacity - wasted_ampere_offset, 4, 0); |
} |
write_char_xy(27, line, 0xB5); // mah |
} |
write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[4])))); // max time |
write_time(16, line, max_FlyingTime); |
/C-OSD/trunk/usart1.h |
---|
21,7 → 21,7 |
#define baud 57600 |
#define RXD_BUFFER_LEN 150 |
#define TXD_BUFFER_LEN 150 |
#define TXD_BUFFER_LEN 10 // not needed |
extern volatile uint8_t rxd_buffer_locked; |
extern volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |