37,6 → 37,11 |
#include "spi.h" |
#include "buttons.h" |
#include "ppm.h" |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
#include "osd_ncmode_default.h" |
#include "osd_ncmode_minimal.h" |
#include "osd_fcmode_default.h" |
#endif |
|
/* TODO: |
* - verifiy correctness of values |
43,9 → 48,6 |
* - clean up code :) |
*/ |
|
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
// data structs not needed for character flashing |
#include "mk-data-structs.h" |
|
/* ########################################################################## |
* global definitions and global vars |
68,6 → 70,27 |
// remember last time data was received |
volatile uint8_t seconds_since_last_data = 0; |
|
// general PAL|NTSC distingiusch stuff |
uint8_t top_line = 1; |
uint8_t bottom_line = 14; |
|
// battery voltages |
uint8_t min_voltage = 0; |
uint8_t max_voltage = 0; |
|
// Flags |
uint8_t COSD_FLAGS = 0, COSD_FLAGS2 = 0; |
|
// stats for after flight |
int16_t max_Altimeter = 0; |
uint8_t min_UBat = 255; |
uint16_t max_GroundSpeed = 0; |
int16_t max_Distance = 0; |
uint16_t max_FlyingTime = 0; |
|
// 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 :"; |
77,10 → 100,9 |
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, |
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}; |
|
#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"; |
100,20 → 122,26 |
str_W, |
str_NW, |
str_N}; |
#endif |
|
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
/* ########################################################################## |
* Different display mode function pointers |
* ##########################################################################*/ |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
const char str_1[] PROGMEM = "default"; |
const char str_2[] PROGMEM = "minimal"; |
|
// general PAL|NTSC distingiusch stuff |
uint8_t top_line = 1; |
uint8_t bottom_line = 14; |
const displaymode_t ncdisplaymodes[] PROGMEM = { |
{ osd_ncmode_default, (char *)str_1 }, |
{ osd_ncmode_minimal, (char *)str_2 } |
}; |
|
// battery voltages |
uint8_t min_voltage = 0; |
uint8_t max_voltage = 0; |
const displaymode_t fcdisplaymodes[] PROGMEM = { |
{ osd_fcmode_default, (char *)str_1 }, |
}; |
|
// Flags |
uint8_t COSD_FLAGS = 0, COSD_FLAGS2 = 0; |
int (*osd_ncmode)(void) = (int(*)(void)) &osd_ncmode_default; |
int (*osd_fcmode)(void) = (int(*)(void)) &osd_ncmode_default; |
#endif |
|
/* ########################################################################## |
* Interrupt handler |
283,18 → 311,6 |
usart1_request_mk_data(0, 'd', 0); |
#endif |
|
// stats for after flight |
int16_t max_Altimeter = 0; |
uint8_t min_UBat = 255; |
#if !(FCONLY) |
uint16_t max_GroundSpeed = 0; |
int16_t max_Distance = 0; |
uint16_t max_FlyingTime = 0; |
|
// flags from last round to check for changes |
uint8_t old_MKFlags = 0; |
#endif |
|
while (1) { |
// in case SPI is ready and there is nothing to send right now |
if (!icnt && spi_ready) { |
345,7 → 361,7 |
min_UBat = debugData.Analog[9]; |
init_cosd(debugData.Analog[9]); |
} |
#include OSD_FCMODE |
osd_fcmode(); |
} |
#else |
if (rxd_buffer[2] == 'O') { // NC OSD Data |
358,7 → 374,7 |
min_UBat = naviData.UBat; |
init_cosd(naviData.UBat); |
} |
#include OSD_NCMODE |
osd_ncmode(); |
} |
#endif |
rxd_buffer_locked = 0; |