/C-OSD/trunk/CHANGE.LOG |
---|
18,6 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
20100822-2300 |
*removed debug-leftover in ppm.c (thx OktoMac) |
*made number display-routines more stable when big numbers occur |
20100803-0355 |
*removed constantly requests for the NC Uart in NC mode which |
caused problems when using OSD/MKTool at the same time |
215,7 → 219,7 |
20090418-0100 |
*variometer uses more steps (9 instead of 5) |
*home-arrow is now home-clock using more steps (22,5° resolution) |
*home-arrow is now home-clock using more steps (22,5� resolution) |
+visual battery-gauge according to difference between UBAT_WRN and UBAT_MAX |
20090417-1115 |
/C-OSD/trunk/buttons.c |
---|
18,9 → 18,9 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <util/delay.h> |
#include "main.h" |
/* ########################################################################## |
* debounce buttons |
/C-OSD/trunk/characters.c |
---|
18,10 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <util/delay.h> |
#include "main.h" |
#include "max7456_software_spi.h" |
/C-OSD/trunk/config.c |
---|
18,6 → 18,7 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/eeprom.h> |
#include <avr/pgmspace.h> |
25,7 → 26,6 |
#include <util/delay.h> |
#include "max7456_software_spi.h" |
#include "config.h" |
#include "main.h" |
#include "buttons.h" |
#include "usart1.h" |
62,7 → 62,6 |
} |
} |
/** |
* save data to eeprom |
*/ |
/C-OSD/trunk/default/dist.bat |
---|
19,7 → 19,7 |
:: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
:: ****************************************************************************/ |
set DATE=20100803-0355 |
set DATE=20100822-2300 |
:: date /T |
/C-OSD/trunk/main.c |
---|
25,11 → 25,11 |
* Manuel "KeyOz" Schrape for explaining the MK protocol to me * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/delay.h> |
#include <avr/pgmspace.h> |
#include "main.h" |
#include "max7456_software_spi.h" |
#ifdef ANTENNATRACKTEST |
#include "usart0.h" |
414,7 → 414,7 |
/* |
naviData.HomePositionDeviation.Distance = 23 * 100; // 23m away (cm * 100) |
naviData.HomePositionDeviation.Bearing = 35; // 35° |
naviData.HomePositionDeviation.Bearing = 35; // 35� |
altimeter_offset = 50; // 50m start height |
naviData.CurrentPosition.Altitude = (int32_t) ((int32_t)250 * (int32_t)1000); // 250m height (mm * 1000) |
*/ |
/C-OSD/trunk/main.h |
---|
21,6 → 21,15 |
#ifndef _MAIN_H |
#define _MAIN_H |
#ifndef MCU |
#define MCU atmega162 |
#endif |
#ifndef __AVR_ATmega162__ |
#define __AVR_ATmega162__ |
#endif |
#include <avr/pgmspace.h> |
#include "mk-data-structs.h" |
/C-OSD/trunk/max7456_software_spi.c |
---|
18,17 → 18,24 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <util/delay.h> |
#include <avr/pgmspace.h> |
#include <string.h> |
#include <stdlib.h> |
#include "main.h" |
#include "max7456_software_spi.h" |
char conv_array[7]; // general array for number -> char conversation |
int pow(int a, int b) { |
if (b <= 0) return 1; |
int res = 1; |
while (b-- > 0) res *= a; |
return res; |
} |
/* ########################################################################## |
* MAX7456 SPI & Display stuff |
* ##########################################################################*/ |
228,6 → 235,9 |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) { |
if (number >= pow(10, length)) { |
number = pow(10, length) - 1; |
} |
itoa(number, conv_array, 10); |
for (uint8_t i = 0; i < length - strlen(conv_array); i++) { |
if (pad) write_char((x++)+(y * 30), 10); |
242,11 → 252,19 |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) { |
if (number <= -pow(10, length)) { |
number = -pow(10, length) + 1; |
} else if (number >= pow(10, length)) { |
number = pow(10, length) - 1; |
} |
itoa(number, conv_array, 10); |
if (strlen(conv_array) < length) { |
for (uint8_t i = 0; i < length - strlen(conv_array); i++) { |
if (pad) write_char((x++)+(y * 30), 10); |
else write_ascii_char((x++)+(y * 30), 0); |
} |
} |
write_ascii_string(x, y, conv_array); |
} |
256,6 → 274,9 |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_u_10th(uint8_t x, uint8_t y, uint16_t number, int16_t length, uint8_t pad) { |
if (number >= pow(10, length)) { |
number = pow(10, length) - 1; |
} |
itoa(number, conv_array, 10); |
uint8_t len = strlen(conv_array); |
for (uint8_t i = 0; i < length - len; i++) { |
283,6 → 304,9 |
* <pad> = 1 will cause blank spaced to be filled up with zeros e.g. 007 instead of 7 |
*/ |
void write_ndigit_number_s_10th(uint8_t x, uint8_t y, int16_t number, int16_t length, uint8_t pad) { |
if (number >= pow(10, length)) { |
number = pow(10, length) - 1; |
} |
itoa(number, conv_array, 10); |
uint8_t len = strlen(conv_array); |
for (uint8_t i = 0; i < length - len; i++) { |
/C-OSD/trunk/osd_helpers.c |
---|
18,8 → 18,8 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/pgmspace.h> |
#include "main.h" |
#include "osd_helpers.h" |
#include "max7456_software_spi.h" |
80,7 → 80,7 |
// the center is char 19 (north), we add the current heading in 8th |
// which would be 22.5 degrees, but float would bloat up the code |
// and *10 / 225 would take ages... so we take the uncorrect way |
uint8_t front = 19 + (heading / 22); |
uint8_t front = 19 + ((heading % 360) / 22); |
for (uint8_t i = 0; i < 9; i++) { |
write_char_xy(x++, y, pgm_read_byte(&rose[front - 4 + i])); |
} |
/C-OSD/trunk/osd_ncmode_default.c |
---|
110,7 → 110,7 |
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) { |
write_ndigit_number_s(23, top_line, naviData.Altimeter / 10 * 32 / 20, 4, 0); // BARO |
} else { |
//cite:killagreg "Faktor 20 bis 21 wäre korrekt." (http://forum.mikrokopter.de/topic-post211192.html#post211192) |
//cite:killagreg "Faktor 20 bis 21 w�re korrekt." (http://forum.mikrokopter.de/topic-post211192.html#post211192) |
if (naviData.Altimeter > 200 || naviData.Altimeter < -200) { |
// above 10m only write full meters |
write_ndigit_number_s(23, top_line, naviData.Altimeter / 20, 4, 0); // BARO |
239,13 → 239,13 |
// pre-bottom line |
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) { |
//write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0); |
write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0); |
write_ndigit_number_u_10th(2, bottom_line - 1, ampere / 10, 4, 0); |
write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0); |
if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) { |
write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0); |
} |
} else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) { |
write_ndigit_number_u_10th(3, bottom_line - 1, naviData.Current, 3, 0); |
write_ndigit_number_u_10th(2, bottom_line - 1, naviData.Current, 4, 0); |
write_ndigit_number_u(10, bottom_line - 1, naviData.UsedCapacity, 4, 0); |
} |
/C-OSD/trunk/ppm.c |
---|
18,10 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include "ppm.h" |
#include "main.h" |
#include "max7456_software_spi.h" // clearing |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
71,7 → 71,7 |
//write_ndigit_number_u(2, 6, valid_ppm_to_go, 100, 0); // debug |
//write_ndigit_number_u(2, 7, COSD_FLAGS_CONFIG, 100, 0); // debug |
PORTC ^= (1 << PC3); |
uptime = ppm; |
//uptime = ppm; |
} |
#endif |
/C-OSD/trunk/spi.c |
---|
18,10 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include "spi.h" |
#include "main.h" |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
/C-OSD/trunk/usart0.c |
---|
18,10 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/delay.h> |
#include "main.h" |
#include "usart0.h" |
#ifdef ANTENNATRACKTEST |
/C-OSD/trunk/usart1.c |
---|
18,10 → 18,10 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
****************************************************************************/ |
#include "main.h" |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/delay.h> |
#include "main.h" |
#include "usart1.h" |
#if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
213,7 → 213,6 |
RxDataLen = ptrOut - 3; |
} |
/** |
* Request Data through usart1 until a answer is received |
*/ |