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
Line 69... Line 69...
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 :";
Line -... Line 80...
-
 
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};
-
 
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,
80
char* stats_item_pointers[] PROGMEM = {stats_item_0, stats_item_1, stats_item_2,
102
        str_N};
Line 81... Line 103...
81
    stats_item_3, stats_item_4, stats_item_5, stats_item_6, stats_item_7};
103
#endif
82
 
104
 
83
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))
105
#endif // ends !(ALLCHARSDEBUG|(WRITECHARS != -1))
Line 111... Line 133...
111
 * ##########################################################################*/
133
 * ##########################################################################*/
Line 112... Line 134...
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) {
-
 
117
    OCR0 = 15; // preload
138
ISR(TIMER0_COMP_vect) {
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++;
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();
Line 214... Line 235...
214
 
235
 
-
 
236
    // set up timer
215
    // set up timer
237
        // CTC, Prescaler /64
-
 
238
        TCCR0 = (1 << WGM01) | (0 << WGM00) | (0 << CS02) | (1 << CS01) | (1 << CS00);
-
 
239
 
-
 
240
        TCNT0 = 0;
-
 
241
        OCR0 = 250;
-
 
242
 
216
    TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64
243
        // enable timer output compare interrupt
217
    OCR0 = 15; // preload
244
        TIMSK &= ~(1 << TOIE0);
Line 218... Line 245...
218
    TIMSK |= (1 << TOIE0); // enable overflow timer0
245
        TIMSK |= (1 << OCIE0);
219
 
246
 
220
        // SPI setup
247
        // SPI setup
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;
Line 266... Line 293...
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;
-
 
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};
295
    uint8_t old_MKFlags = 0;
Line 272... Line 296...
272
#endif
296
#endif
273
 
297
 
274
    while (1) {
298
    while (1) {