Subversion Repositories Projects

Rev

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

Rev 757 Rev 758
Line 183... Line 183...
183
/* ##########################################################################
183
/* ##########################################################################
184
 * NEW artificial horizon     By AGRESSiVA --=-- COPTERTRONiC
184
 * NEW artificial horizon     By AGRESSiVA --=-- COPTERTRONiC
185
 * ##########################################################################*/
185
 * ##########################################################################*/
186
// draw routine 
186
// draw routine 
187
int draw_noodles(int8_t pos_x, int8_t pos_y, int8_t num, int8_t old_num) {
187
int draw_noodles(int8_t pos_x, int8_t pos_y, int8_t num, int8_t old_num) {
188
        char noodle[5] = {0x78, 0x79, 0x7A, 0x7B, 0x7C};
188
        const char noodle[5] = {0x78, 0x79, 0x7A, 0x7B, 0x7C};
189
        int8_t line,car;
189
        int8_t line, car;
Line 190... Line 190...
190
               
190
               
191
        line = num / 5;
191
        line = num / 5;
192
        car = num - (line * 5);
192
        car = num - (line * 5);
193
        if (num != old_num) {
193
        if (num != old_num) {
194
                write_char_xy(15 - pos_x , pos_y + (old_num), 0);
194
                write_char_xy(15 - pos_x , pos_y + (old_num), 0);
Line 195... Line 195...
195
                }
195
        }
196
 
196
 
Line 197... Line 197...
197
        if (num < 0) {car = -1* car; car = 4 - car; line--; num = num - 5;}
197
        if (num < 0) {car = -1* car; car = 4 - car; line--; num = num - 5;}
Line 209... Line 209...
209
        static int8_t old1 = 0,old2 = 0,old3 = 0,old4, old5 = 0, old6 = 0,old7 = 0,old8 = 0;
209
        static int8_t old1 = 0,old2 = 0,old3 = 0,old4, old5 = 0, old6 = 0,old7 = 0,old8 = 0;
210
        int8_t ticy = 0, ticx = 0;
210
        int8_t ticy = 0, ticx = 0;
211
        uint8_t center_x = 15;
211
        uint8_t center_x = 15;
212
        uint8_t center_y = lastline - firstline;
212
        uint8_t center_y = lastline - firstline;
213
        center_y = 7;
213
        center_y = 7;
214
        write_char_xy(center_x - 7 ,center_y,226);
214
        write_char_xy(center_x - 7 ,center_y,226); // left bar
215
        write_char_xy(center_x + 6 ,center_y,226);
215
        write_char_xy(center_x + 6 ,center_y,226); // right bar
Line 216... Line 216...
216
 
216
 
217
 
217
 
218
#if FCONLY
218
#if FCONLY
Line 227... Line 227...
227
if (ticx >= 30) ticx = 30;      // limit x
227
if (ticx >= 30) ticx = 30;      // limit x
Line 228... Line 228...
228
 
228
 
229
        //write_ndigit_number_u (0 , 5 , ticy ,3, 1);
229
        //write_ndigit_number_u (0 , 5 , ticy ,3, 1);
Line 230... Line 230...
230
        //write_ndigit_number_u (0 , 6 , ticx ,3, 1);
230
        //write_ndigit_number_u (0 , 6 , ticx ,3, 1);
231
 
231
 
232
        if ((ticy != old_ticy) || (ticx != old_ticx)) {
232
        //if ((ticy != old_ticy) || (ticx != old_ticx)) { 
233
                        old1 = draw_noodles(   4, 3,  (ticy /  2) + 20 + ticx, old1);
233
                        old1 = draw_noodles(   4, 3,  (ticy /  2) + 20 + ticx, old1);
234
                        old2 = draw_noodles(   3, 3,  (ticy /  3) + 20 + ticx, old2);
234
                        old2 = draw_noodles(   3, 3,  (ticy /  3) + 20 + ticx, old2);
235
                        old3 = draw_noodles(   2, 3,  (ticy /  6) + 20 + ticx, old3);
235
                        old3 = draw_noodles(   2, 3,  (ticy /  6) + 20 + ticx, old3);
236
                        old4 = draw_noodles(   1, 3,  (ticy / 14) + 20 + ticx, old4);
236
                        old4 = draw_noodles(   1, 3,  (ticy / 14) + 20 + ticx, old4);
237
                        old5 = draw_noodles( - 3, 3, -(ticy /  2) + 20 + ticx, old5);
237
                        old5 = draw_noodles( - 3, 3, -(ticy /  2) + 20 + ticx, old5);
238
                        old6 = draw_noodles( - 2, 3, -(ticy /  3) + 20 + ticx, old6);
238
                        old6 = draw_noodles( - 2, 3, -(ticy /  3) + 20 + ticx, old6);
239
                        old7 = draw_noodles( - 1, 3, -(ticy /  6) + 20 + ticx, old7);
239
                        old7 = draw_noodles( - 1, 3, -(ticy /  6) + 20 + ticx, old7);
240
                        old8 = draw_noodles(   0, 3, -(ticy / 14) + 20 + ticx, old8);
240
                        old8 = draw_noodles(   0, 3, -(ticy / 14) + 20 + ticx, old8);
241
                        }
241
                        //}
242
        // update old vars
242
        // update old vars
243
        old_ticy = ticy;
243
        old_ticy = ticy;
Line 255... Line 255...
255
/**
255
/**
256
 * draw roll und nick indicators (could be enhanced to full artificial horizon)
256
 * draw roll und nick indicators (could be enhanced to full artificial horizon)
257
 * from line <firstline> to <listlines> for given <nick> and <roll> values
257
 * from line <firstline> to <listlines> for given <nick> and <roll> values
258
 */
258
 */
259
void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) {
259
void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) {
260
        char noodle[5] = {225, 225, 226, 227, 227};
260
        const char noodle[5] = {225, 225, 226, 227, 227};
261
        uint8_t center_x = 15;
261
        uint8_t center_x = 15;
262
        uint8_t center_y = lastline - firstline;
262
        uint8_t center_y = lastline - firstline;
263
        center_y = 7;
263
        center_y = 7;
264
        write_char_xy(center_x,center_y,228);
264
        write_char_xy(center_x,center_y,228);
265
        uint8_t cpos, nicky, rollx;
265
        uint8_t cpos, nicky, rollx;