Subversion Repositories Projects

Rev

Rev 477 | Rev 495 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 477 Rev 489
Line 67... Line 67...
67
 
67
 
68
// remember last time data was received
68
// remember last time data was received
69
volatile uint8_t seconds_since_last_data = 0;
69
volatile uint8_t seconds_since_last_data = 0;
70
 
70
 
71
// store stats description in progmem to save space
71
// store stats description in progmem to save space
72
char stats_item_0[] PROGMEM = "max Altitude:";
72
const char stats_item_0[] PROGMEM = "max Altitude:";
73
char stats_item_1[] PROGMEM = "max Speed   :";
73
const char stats_item_1[] PROGMEM = "max Speed   :";
74
char stats_item_2[] PROGMEM = "max Distance:";
74
const char stats_item_2[] PROGMEM = "max Distance:";
75
char stats_item_3[] PROGMEM = "min voltage :";
75
const char stats_item_3[] PROGMEM = "min Voltage :";
76
char stats_item_4[] PROGMEM = "max time    :";
76
const char stats_item_4[] PROGMEM = "max Time    :";
77
char stats_item_5[] PROGMEM = "longitude   :";
77
const char stats_item_5[] PROGMEM = "longitude   :";
78
char stats_item_6[] PROGMEM = "latitude    :";
78
const char stats_item_6[] PROGMEM = "latitude    :";
79
char stats_item_7[] PROGMEM = "max current :";
79
const char stats_item_7[] PROGMEM = "max current :";
80
char* stats_item_pointers[] PROGMEM = {stats_item_0, stats_item_1, stats_item_2,
80
const char* stats_item_pointers[] PROGMEM = {stats_item_0, stats_item_1, stats_item_2,
81
    stats_item_3, stats_item_4, stats_item_5, stats_item_6, stats_item_7};
81
    stats_item_3, stats_item_4, stats_item_5, stats_item_6, stats_item_7};
82
 
82
 
-
 
83
#if !(FCONLY)
-
 
84
//char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "};
-
 
85
    //char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219};
-
 
86
const char str_NE[] PROGMEM = "NE";
-
 
87
const char str_E[] PROGMEM  = "E ";
-
 
88
const char str_SE[] PROGMEM = "SE";
-
 
89
const char str_S[] PROGMEM  = "S ";
-
 
90
const char str_SW[] PROGMEM = "SW";
-
 
91
const char str_W[] PROGMEM  = "W ";
-
 
92
const char str_NW[] PROGMEM = "NW";
-
 
93
const char str_N[] PROGMEM  = "N ";
-
 
94
const char *directions[8] PROGMEM = {
-
 
95
        str_NE,
-
 
96
        str_E,
-
 
97
        str_SE,
-
 
98
        str_S,
-
 
99
        str_SW,
-
 
100
        str_W,
-
 
101
        str_NW,
-
 
102
        str_N};
-
 
103
#endif
-
 
104
 
83
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))
105
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))
84
 
106
 
85
// general PAL|NTSC distingiusch stuff
107
// general PAL|NTSC distingiusch stuff
86
uint8_t top_line = 1;
108
uint8_t top_line = 1;
87
uint8_t bottom_line = 14;
109
uint8_t bottom_line = 14;
Line 111... Line 133...
111
 * ##########################################################################*/
133
 * ##########################################################################*/
112
 
134
 
113
/**
135
/**
114
 * timer kicks in every 1000uS ^= 1ms
136
 * timer kicks in every 1000uS ^= 1ms
115
 */
137
 */
116
ISR(TIMER0_OVF_vect) {
138
ISR(TIMER0_COMP_vect) {
117
    OCR0 = 15; // preload
-
 
118
    if (!timer--) {
139
    if (!timer--) {
119
        uptime++;
140
        uptime++;
120
        timer = 999;
141
        timer = 999;
121
        seconds_since_last_data++;
142
        seconds_since_last_data++;
122
    }
143
    }
Line 211... Line 232...
211
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
232
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
212
    // init usart
233
    // init usart
213
    usart1_init();
234
    usart1_init();
214
 
235
 
215
    // set up timer
236
    // set up timer
-
 
237
        // CTC, Prescaler /64
216
    TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64
238
        TCCR0 = (1 << WGM01) | (0 << WGM00) | (0 << CS02) | (1 << CS01) | (1 << CS00);
-
 
239
 
-
 
240
        TCNT0 = 0;
-
 
241
        OCR0 = 250;
-
 
242
 
-
 
243
        // enable timer output compare interrupt
217
    OCR0 = 15; // preload
244
        TIMSK &= ~(1 << TOIE0);
218
    TIMSK |= (1 << TOIE0); // enable overflow timer0
245
        TIMSK |= (1 << OCIE0);
219
 
246
 
220
        // SPI setup
247
        // SPI setup
221
    DDRD |= (1 << PD2); // PD2 output (INT0)
248
    DDRD |= (1 << PD2); // PD2 output (INT0)
222
    SpiMasterInit();
249
    SpiMasterInit();
223
 
250
 
Line 264... Line 291...
264
    int16_t max_Distance = 0;
291
    int16_t max_Distance = 0;
265
    uint16_t max_FlyingTime = 0;
292
    uint16_t max_FlyingTime = 0;
266
 
293
 
267
    // flags from last round to check for changes
294
    // flags from last round to check for changes
268
    uint8_t old_MKFlags = 0;
295
    uint8_t old_MKFlags = 0;
269
 
-
 
270
    char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "};
-
 
271
    //char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219};
-
 
272
#endif
296
#endif
273
 
297
 
274
    while (1) {
298
    while (1) {
275
        // in case SPI is ready and there is nothing to send right now
299
        // in case SPI is ready and there is nothing to send right now
276
        if (!icnt && spi_ready) {
300
        if (!icnt && spi_ready) {