Subversion Repositories Projects

Rev

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

Rev 453 Rev 489
Line 69... Line 69...
69
/**
69
/**
70
 * draw a compass rose at <x>/<y> for <heading>
70
 * draw a compass rose at <x>/<y> for <heading>
71
 */
71
 */
72
void draw_compass(uint8_t x, uint8_t y, uint16_t heading) {
72
void draw_compass(uint8_t x, uint8_t y, uint16_t heading) {
73
    //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W";
73
    //char* rose = "---N---O---S---W---N---O---S---W---N---O---S---W";
74
    char rose[48] = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212,
74
    static char rose[48] PROGMEM = {216, 215, 216, 211, 216, 215, 216, 213, 216, 215, 216, 212,
75
                    216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213,
75
                    216, 215, 216, 214, 216, 215, 216, 211, 216, 215, 216, 213,
76
                    216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211,
76
                    216, 215, 216, 212, 216, 215, 216, 214, 216, 215, 216, 211,
77
                    216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214};
77
                    216, 215, 216, 213, 216, 215, 216, 212, 216, 215, 216, 214};
78
        // the center is char 19 (north), we add the current heading in 8th
78
        // the center is char 19 (north), we add the current heading in 8th
79
        // which would be 22.5 degrees, but float would bloat up the code
79
        // which would be 22.5 degrees, but float would bloat up the code
80
        // and *10 / 225 would take ages... so we take the uncorrect way
80
        // and *10 / 225 would take ages... so we take the uncorrect way
81
    uint8_t front = 19 + (heading / 22);
81
    uint8_t front = 19 + (heading / 22);
82
    for (uint8_t i = 0; i < 9; i++) {
82
    for (uint8_t i = 0; i < 9; i++) {
83
                write_char_xy(x++, y, rose[front - 4 + i]);
83
                write_char_xy(x++, y, pgm_read_byte(&rose[front - 4 + i]));
84
    }
84
    }
85
}
85
}
Line 86... Line 86...
86
 
86
 
87
/* ##########################################################################
87
/* ##########################################################################
Line 145... Line 145...
145
                }
145
                }
146
        }
146
        }
147
}
147
}
Line 148... Line 148...
148
 
148
 
149
// big vario arrays 
149
// big vario arrays 
150
char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff};
150
const char vario_00[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xff};
151
char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0};
151
const char vario_01[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc0};
152
char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1};
152
const char vario_02[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0xc1};
153
char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00};
153
const char vario_03[5] PROGMEM = {0x00, 0x00, 0xc2, 0xff, 0x00};
154
char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00};
154
const char vario_04[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc0, 0x00};
155
char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00};
155
const char vario_05[5] PROGMEM = {0x00, 0x00, 0xc2, 0xc1, 0x00};
156
char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00};
156
const char vario_06[5] PROGMEM = {0x00, 0x00, 0xc2, 0x00, 0x00};
157
char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00};
157
const char vario_07[5] PROGMEM = {0x00, 0x00, 0xbb, 0x00, 0x00};
158
char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00};
158
const char vario_08[5] PROGMEM = {0x00, 0x00, 0xc3, 0x00, 0x00};
159
char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00};
159
const char vario_09[5] PROGMEM = {0x00, 0xc4, 0xc3, 0x00, 0x00};
160
char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00};
160
const char vario_10[5] PROGMEM = {0x00, 0xc5, 0xc3, 0x00, 0x00};
161
char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00};
161
const char vario_11[5] PROGMEM = {0x00, 0xff, 0xc3, 0x00, 0x00};
162
char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00};
162
const char vario_12[5] PROGMEM = {0xc4, 0xff, 0xc3, 0x00, 0x00};
163
char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00};
163
const char vario_13[5] PROGMEM = {0xc5, 0xff, 0xc3, 0x00, 0x00};
164
char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00};
164
const char vario_14[5] PROGMEM = {0xff, 0xff, 0xc3, 0x00, 0x00};
165
char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04,
165
const char* vario_pnt[15] PROGMEM = {vario_00, vario_01, vario_02, vario_03, vario_04,
166
                                vario_05, vario_06, vario_07, vario_08,
166
                                vario_05, vario_06, vario_07, vario_08,
167
                                vario_09, vario_10, vario_11, vario_12,
167
                                vario_09, vario_10, vario_11, vario_12,
Line 168... Line 168...
168
                                vario_13, vario_14};
168
                                vario_13, vario_14};
Line 175... Line 175...
175
        if (index > 14) index = 14;
175
        if (index > 14) index = 14;
176
        else if (index < 0) index = 0;
176
        else if (index < 0) index = 0;
Line 177... Line 177...
177
       
177
       
178
        // TODO: why does write_string_pgm_down(x, y-2, vario_pnt[index], 5);
178
        // TODO: why does write_string_pgm_down(x, y-2, vario_pnt[index], 5);
-
 
179
        // not work??? WTF?!
-
 
180
        write_string_pgm_down(x, y-2, (const char *) (pgm_read_word ( &(vario_pnt[index]))), 5);
179
        // not work??? WTF?!
181
#if 0
180
        switch (index) {
182
        switch (index) {
181
                case 0: write_string_pgm_down(x, y-2, vario_pnt[0], 5);
183
                case 0: write_string_pgm_down(x, y-2, vario_pnt[0], 5);
182
                        break;
184
                        break;
183
                case 1: write_string_pgm_down(x, y-2, vario_pnt[1], 5);
185
                case 1: write_string_pgm_down(x, y-2, vario_pnt[1], 5);
Line 205... Line 207...
205
                case 12: write_string_pgm_down(x, y-2, vario_pnt[12], 5);
207
                case 12: write_string_pgm_down(x, y-2, vario_pnt[12], 5);
206
                        break;
208
                        break;
207
                case 13: write_string_pgm_down(x, y-2, vario_pnt[13], 5);
209
                case 13: write_string_pgm_down(x, y-2, vario_pnt[13], 5);
208
                        break;
210
                        break;
209
                default: write_string_pgm_down(x, y-2, vario_pnt[14], 5);
211
                default: write_string_pgm_down(x, y-2, vario_pnt[14], 5);
210
        }              
212
        }
-
 
213
#endif
211
}
214
}
Line 212... Line 215...
212
 
215
 
213
/* ##########################################################################
216
/* ##########################################################################
214
 * artificial horizon
217
 * artificial horizon