Subversion Repositories Projects

Rev

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

Rev 325 Rev 326
Line 52... Line 52...
52
#define BLINK   0b01001111      // attribute byte for blinking chars
52
#define BLINK   0b01001111      // attribute byte for blinking chars
Line 53... Line 53...
53
 
53
 
54
/* ##########################################################################
54
/* ##########################################################################
55
 * FLAGS usable during runtime
55
 * FLAGS usable during runtime
56
 * ##########################################################################*/
56
 * ##########################################################################*/
57
#define COSD_FLAG_NTSC                  1
57
#define COSD_FLAG_NTSC                   1
58
#define COSD_FLAG_ARTHORIZON    2
58
#define COSD_FLAG_ARTHORIZON     2
59
#define COSD_FLAG_NOOSD                 4
59
#define COSD_FLAG_NOOSD                  4
-
 
60
#define COSD_FLAG_NOOSD_BUT_WRN  8
Line 60... Line 61...
60
#define COSD_FLAG_NOOSD_BUT_WRN 8
61
#define COSD_ICONS_WRITTEN              16
61
 
62
 
62
/* ##########################################################################
63
/* ##########################################################################
63
 * Software SPI to communicate with MAX7456
64
 * Software SPI to communicate with MAX7456
Line 196... Line 197...
196
// 16bit should be enough, normal LiPos don't last that long
197
// 16bit should be enough, normal LiPos don't last that long
197
volatile uint16_t uptime = 0;
198
volatile uint16_t uptime = 0;
198
volatile uint16_t timer = 0;
199
volatile uint16_t timer = 0;
Line 199... Line 200...
199
 
200
 
-
 
201
#endif // ends !(ALLCHARSDEBUG|WRITECHARS)
-
 
202
 
-
 
203
// general PAL|NTSC distingiusch stuff
-
 
204
uint8_t top_line = 1;
-
 
205
uint8_t bottom_line = 14;
-
 
206
 
-
 
207
// Flags
-
 
208
uint8_t COSD_FLAGS = 0;
-
 
209
 
-
 
210
/* ##########################################################################
-
 
211
 * debounce buttons
-
 
212
 * ##########################################################################*/
-
 
213
int s1_pressed() {
-
 
214
        if (S1_PRESSED) {
-
 
215
                _delay_ms(25);
-
 
216
                if (S1_PRESSED) return 1;
-
 
217
        }
-
 
218
        return 0;
-
 
219
}
-
 
220
 
-
 
221
int s2_pressed() {
-
 
222
        if (S2_PRESSED) {
-
 
223
                _delay_ms(25);
-
 
224
                if (S2_PRESSED) return 1;
-
 
225
        }
-
 
226
        return 0;
-
 
227
}
200
#endif // ends !(ALLCHARSDEBUG|WRITECHARS)
228
 
201
/* ##########################################################################
229
/* ##########################################################################
202
 * MAX7456 SPI & Display stuff
230
 * MAX7456 SPI & Display stuff
Line 203... Line 231...
203
 * ##########################################################################*/
231
 * ##########################################################################*/
Line 768... Line 796...
768
        //write_number_s(20,7,ypos);    
796
        //write_number_s(20,7,ypos);    
769
        //write_number_s(0,7,nick);             
797
        //write_number_s(0,7,nick);             
770
        //write_number_s(18,11,roll);   
798
        //write_number_s(18,11,roll);   
771
}
799
}
Line -... Line 800...
-
 
800
 
-
 
801
/* ##########################################################################
-
 
802
 * A simple config menu for the flags
-
 
803
 * ##########################################################################*/
-
 
804
void config_menu(void) {
-
 
805
        // disable interrupts (makes the menu more smoothely)
-
 
806
        cli();
-
 
807
 
-
 
808
        // clear screen
-
 
809
        clear();
-
 
810
       
-
 
811
        char* menu[4] = {"Normal OSD      ",
-
 
812
                                         "+ Art.Horizon   ",
-
 
813
                                         "NO OSD          ",
-
 
814
                                         "NO OSD but WRN  "};
-
 
815
 
-
 
816
        uint8_t inmenu = 1;
-
 
817
        uint8_t chosen = 0;
-
 
818
        write_ascii_string(10,  4, "Config Menu");
-
 
819
       
-
 
820
        // clear all mode flags
-
 
821
        COSD_FLAGS &= ~(COSD_FLAG_ARTHORIZON | COSD_FLAG_NOOSD | COSD_FLAG_NOOSD_BUT_WRN);
-
 
822
 
-
 
823
        // wait a bit before doing stuff so user has chance to release button
-
 
824
        _delay_ms(250);
-
 
825
 
-
 
826
        while (inmenu) {
-
 
827
                        write_ascii_string(2,  7, menu[chosen]);
-
 
828
                        if (s2_pressed()) {
-
 
829
                                chosen = (chosen + 1) % 4;
-
 
830
                                _delay_ms(500);
-
 
831
                        } else if (s1_pressed()) {
-
 
832
                                switch (chosen) {
-
 
833
                                        case 1:         // artificial horizon
-
 
834
                                                COSD_FLAGS |= COSD_FLAG_ARTHORIZON;
-
 
835
                                                break;
-
 
836
                                        case 2:         // everything off
-
 
837
                                                COSD_FLAGS |= COSD_FLAG_NOOSD;
-
 
838
                                                break;
-
 
839
                                        case 3:         // only warning
-
 
840
                                                COSD_FLAGS |= COSD_FLAG_NOOSD_BUT_WRN;
-
 
841
                                                break;
-
 
842
                                        //default:      // normal OSD, so let the flags cleared
-
 
843
                                }
-
 
844
                                // leave menu
-
 
845
                                inmenu = 0;
-
 
846
                                _delay_ms(500);
-
 
847
                        }
-
 
848
        }
-
 
849
 
-
 
850
        // clear screen up again
-
 
851
        clear();
-
 
852
 
-
 
853
        // update flags to paint display again if needed
-
 
854
        COSD_FLAGS &= ~COSD_ICONS_WRITTEN;
-
 
855
 
772
 
856
        // enable interrupts again
-
 
857
        sei();
-
 
858
}
-
 
859
 
Line 773... Line 860...
773
#endif
860
#endif // ends !(ALLCHARSDEBUG|WRITECHARS)
774
 
861
 
775
/* ##########################################################################
862
/* ##########################################################################
776
 * MAIN
863
 * MAIN
777
 * ##########################################################################*/
864
 * ##########################################################################*/
778
int main(void) {
865
int main(void) {
779
        // set up FLAGS, compiler should flatten this one
866
        // set up FLAGS, compiler should flatten this one
780
        uint8_t COSD_FLAGS = (NTSC << (COSD_FLAG_NTSC - 1));
867
        COSD_FLAGS = (NTSC << (COSD_FLAG_NTSC - 1));
781
        COSD_FLAGS |= (ARTHORIZON << (COSD_FLAG_ARTHORIZON - 1));
868
        COSD_FLAGS |= (ARTHORIZON << (COSD_FLAG_ARTHORIZON - 1));
Line 782... Line 869...
782
        COSD_FLAGS |= (NOOSD << (COSD_FLAG_NOOSD - 1));
869
        COSD_FLAGS |= (NOOSD << (COSD_FLAG_NOOSD - 1));
Line 804... Line 891...
804
    DDRC &= ~(1 << PC4); // PC4 input  (MODE)
891
    DDRC &= ~(1 << PC4); // PC4 input  (MODE)
805
    PORTC |= (1 << PC4); // pullup
892
    PORTC |= (1 << PC4); // pullup
806
    DDRC &= ~(1 << PC5); // PC5 input  (SET)
893
    DDRC &= ~(1 << PC5); // PC5 input  (SET)
807
    PORTC |= (1 << PC5); // pullup
894
    PORTC |= (1 << PC5); // pullup
Line -... Line 895...
-
 
895
 
-
 
896
        // set up top and bottom lines
-
 
897
        if (COSD_FLAGS & COSD_FLAG_NTSC) {
-
 
898
                bottom_line = 12;
-
 
899
        } else {
-
 
900
                bottom_line = 14;
-
 
901
        }
-
 
902
 
808
 
903
        // reset the MAX7456 to be sure any undefined states do no harm
809
    MAX_RESET_LOW
904
    MAX_RESET_LOW
Line 810... Line 905...
810
    MAX_RESET_HIGH
905
    MAX_RESET_HIGH
811
 
906
 
812
        // check for keypress at startup
907
        // check for keypress at startup
813
        if (S2_PRESSED) { // togle COSD_FLAG_ARTHORIZON
908
        if (s2_pressed()) { // togle COSD_FLAG_ARTHORIZON
814
                        COSD_FLAGS ^= (1 << (COSD_FLAG_ARTHORIZON - 1));
909
                        COSD_FLAGS ^= (1 << (COSD_FLAG_ARTHORIZON - 1));
Line 815... Line 910...
815
                        _delay_ms(100);
910
                        _delay_ms(100);
Line 849... Line 944...
849
 
944
 
850
    /**
945
    /**
851
     * easy char creation:
946
     * easy char creation:
852
     * http://cascade.dyndns.org/~cascade/scripts/max7456/
947
     * http://cascade.dyndns.org/~cascade/scripts/max7456/
-
 
948
     */
-
 
949
        // flashing more than 8 chars per time is not proven to be safe
-
 
950
        // so take care
853
     */
951
#if WRITECHARS == 200
854
    // GPS
952
        // GPS
855
    unsigned char cc8[54] = {0x55, 0x50, 0x55, 0x55, 0x4a, 0x15, 0x55, 0x2a,
953
    unsigned char cc8[54] = {0x55, 0x50, 0x55, 0x55, 0x4a, 0x15, 0x55, 0x2a,
856
        0x85, 0x55, 0x2a, 0xa1, 0x55, 0x4a, 0xa8, 0x55,
954
        0x85, 0x55, 0x2a, 0xa1, 0x55, 0x4a, 0xa8, 0x55,
857
        0x52, 0xa8, 0x55, 0x54, 0xaa, 0x55, 0x55, 0x09,
955
        0x52, 0xa8, 0x55, 0x54, 0xaa, 0x55, 0x55, 0x09,
858
        0x55, 0x55, 0x52, 0x55, 0x55, 0x1a, 0x55, 0x51,
956
        0x55, 0x55, 0x52, 0x55, 0x55, 0x1a, 0x55, 0x51,
Line 921... Line 1019...
921
        0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x55, 0x28,
1019
        0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x55, 0x28,
922
        0x55, 0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x55,
1020
        0x55, 0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x55,
923
        0x28, 0x55, 0x55, 0x28, 0x55, 0x55, 0x28, 0x55,
1021
        0x28, 0x55, 0x55, 0x28, 0x55, 0x55, 0x28, 0x55,
924
        0x55, 0x28, 0x55, 0x55, 0x00, 0x55};
1022
        0x55, 0x28, 0x55, 0x55, 0x00, 0x55};
Line -... Line 1023...
-
 
1023
 
-
 
1024
    learn_char(200, cc8);
-
 
1025
    learn_char(201, cc9);
-
 
1026
    learn_char(202, cca);
-
 
1027
    learn_char(203, ccb);
-
 
1028
    learn_char(204, ccc);
-
 
1029
    learn_char(205, ccd);
-
 
1030
    learn_char(206, cce);
-
 
1031
    learn_char(207, ccf);
-
 
1032
#endif
925
 
1033
#if WRITECHARS == 208
926
    // degree symbol
1034
   // degree symbol
927
    unsigned char cd0[54] = {0x55, 0x55, 0x55, 0x54, 0x01, 0x55, 0x52, 0xa8,
1035
    unsigned char cd0[54] = {0x55, 0x55, 0x55, 0x54, 0x01, 0x55, 0x52, 0xa8,
928
        0x55, 0x48, 0x02, 0x15, 0x48, 0x52, 0x15, 0x48,
1036
        0x55, 0x48, 0x02, 0x15, 0x48, 0x52, 0x15, 0x48,
929
        0x52, 0x15, 0x48, 0x02, 0x15, 0x52, 0xa8, 0x55,
1037
        0x52, 0x15, 0x48, 0x02, 0x15, 0x52, 0xa8, 0x55,
930
        0x54, 0x01, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1038
        0x54, 0x01, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
Line 993... Line 1101...
993
        0x01, 0x21, 0x00, 0xa8, 0x20, 0xaa, 0x01, 0x21,
1101
        0x01, 0x21, 0x00, 0xa8, 0x20, 0xaa, 0x01, 0x21,
994
        0x00, 0x55, 0x21, 0x55, 0x55, 0x45, 0x55, 0x55,
1102
        0x00, 0x55, 0x21, 0x55, 0x55, 0x45, 0x55, 0x55,
995
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1103
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
996
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
1104
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
Line -... Line 1105...
-
 
1105
 
-
 
1106
    learn_char(208, cd0);
-
 
1107
    learn_char(209, cd1);
-
 
1108
    learn_char(210, cd2);
-
 
1109
    learn_char(211, cd3);
-
 
1110
    learn_char(212, cd4);
-
 
1111
    learn_char(213, cd5);
-
 
1112
    learn_char(214, cd6);
-
 
1113
    learn_char(215, cd7);
-
 
1114
#endif
997
 
1115
#if WRITECHARS == 216
998
    // compass line
1116
    // compass line
999
    unsigned char cd8[54] = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1117
    unsigned char cd8[54] = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1000
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1118
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1001
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1119
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
Line 1065... Line 1183...
1065
        0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x54, 0x28,
1183
        0x55, 0x28, 0x55, 0x55, 0x28, 0x55, 0x54, 0x28,
1066
        0x15, 0x52, 0xaa, 0x85, 0x54, 0xaa, 0x15, 0x55,
1184
        0x15, 0x52, 0xaa, 0x85, 0x54, 0xaa, 0x15, 0x55,
1067
        0x28, 0x55, 0x55, 0x41, 0x55, 0x55, 0x55, 0x55,
1185
        0x28, 0x55, 0x55, 0x41, 0x55, 0x55, 0x55, 0x55,
1068
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
1186
        0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
Line -... Line 1187...
-
 
1187
 
-
 
1188
    learn_char(216, cd8);
-
 
1189
        learn_char(217, cd9);
-
 
1190
    learn_char(218, cda);
-
 
1191
    learn_char(219, cdb);
-
 
1192
    learn_char(220, cdc);
-
 
1193
    learn_char(221, cdd);
-
 
1194
    learn_char(222, cde);
-
 
1195
    learn_char(223, cdf);
-
 
1196
#endif
1069
 
1197
#if WRITECHARS == 224
1070
    // arrow right-down
1198
     // arrow right-down
1071
    unsigned char ce0[54] ={0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1199
    unsigned char ce0[54] ={0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1072
        0x55, 0x55, 0x55, 0x55, 0x54, 0x55, 0x55, 0x52,
1200
        0x55, 0x55, 0x55, 0x55, 0x54, 0x55, 0x55, 0x52,
1073
        0x15, 0x55, 0x4a, 0x85, 0x55, 0x52, 0xa1, 0x51,
1201
        0x15, 0x55, 0x4a, 0x85, 0x55, 0x52, 0xa1, 0x51,
1074
        0x54, 0xa8, 0x48, 0x55, 0x2a, 0x28, 0x55, 0x4a,
1202
        0x54, 0xa8, 0x48, 0x55, 0x2a, 0x28, 0x55, 0x4a,
Line 1137... Line 1265...
1137
        0xa1, 0x54, 0x88, 0x98, 0x14, 0xa8, 0x2a, 0x84,
1265
        0xa1, 0x54, 0x88, 0x98, 0x14, 0xa8, 0x2a, 0x84,
1138
        0x88, 0x4a, 0xa0, 0x88, 0x4a, 0xa8, 0x11, 0x52,
1266
        0x88, 0x4a, 0xa0, 0x88, 0x4a, 0xa8, 0x11, 0x52,
1139
        0xaa, 0x15, 0x54, 0xaa, 0x15, 0x55, 0x28, 0x55,
1267
        0xaa, 0x15, 0x54, 0xaa, 0x15, 0x55, 0x28, 0x55,
1140
        0x55, 0x41, 0x55, 0x55, 0x55, 0x55};
1268
        0x55, 0x41, 0x55, 0x55, 0x55, 0x55};
Line 1141... Line -...
1141
 
-
 
1142
 
-
 
1143
        // flashing more than 8 chars per time is not proven to be safe
-
 
1144
        // so take care
-
 
1145
#if WRITECHARS == 200
-
 
1146
    learn_char(200, cc8);
-
 
1147
    learn_char(201, cc9);
-
 
1148
    learn_char(202, cca);
-
 
1149
    learn_char(203, ccb);
-
 
1150
    learn_char(204, ccc);
-
 
1151
    learn_char(205, ccd);
-
 
1152
    learn_char(206, cce);
-
 
1153
    learn_char(207, ccf);
-
 
1154
#endif
-
 
1155
#if WRITECHARS == 208
-
 
1156
    learn_char(208, cd0);
-
 
1157
    learn_char(209, cd1);
-
 
1158
    learn_char(210, cd2);
-
 
1159
    learn_char(211, cd3);
-
 
1160
    learn_char(212, cd4);
-
 
1161
    learn_char(213, cd5);
-
 
1162
    learn_char(214, cd6);
-
 
1163
    learn_char(215, cd7);
-
 
1164
#endif
-
 
1165
#if WRITECHARS == 216
-
 
1166
    learn_char(216, cd8);
-
 
1167
        learn_char(217, cd9);
-
 
1168
    learn_char(218, cda);
-
 
1169
    learn_char(219, cdb);
-
 
1170
    learn_char(220, cdc);
-
 
1171
    learn_char(221, cdd);
-
 
1172
    learn_char(222, cde);
-
 
1173
    learn_char(223, cdf);
-
 
1174
#endif
-
 
1175
#if WRITECHARS == 224
1269
 
1176
    learn_char(224, ce0);
1270
    learn_char(224, ce0);
1177
        learn_char(225, ce1);
1271
        learn_char(225, ce1);
1178
        learn_char(226, ce2);
1272
        learn_char(226, ce2);
1179
        learn_char(227, ce3);
1273
        learn_char(227, ce3);
Line 1186... Line 1280...
1186
    /* ##########################################################################
1280
    /* ##########################################################################
1187
     * continue normal main
1281
     * continue normal main
1188
     * ##########################################################################*/
1282
     * ##########################################################################*/
Line 1189... Line 1283...
1189
       
1283
       
1190
        // Setup Video Mode
-
 
1191
        uint8_t top_line = 1;
-
 
1192
        uint8_t bottom_line = 0;
1284
        // Setup Video Mode
1193
        if (COSD_FLAGS & COSD_FLAG_NTSC) {
1285
        if (COSD_FLAGS & COSD_FLAG_NTSC) {
1194
        // NTSC + enable display immediately (VM0)
1286
        // NTSC + enable display immediately (VM0)
1195
        spi_send_byte(0x00, 0b00001000);
-
 
1196
                bottom_line = 12;
1287
        spi_send_byte(0x00, 0b00001000);
1197
        } else {
1288
        } else {
1198
        // PAL + enable display immediately (VM0)
1289
        // PAL + enable display immediately (VM0)
1199
        spi_send_byte(0x00, 0b01001000);
-
 
1200
                bottom_line = 14;
1290
        spi_send_byte(0x00, 0b01001000);
Line 1201... Line 1291...
1201
        }
1291
        }
1202
 
1292
 
Line 1219... Line 1309...
1219
    // set up timer
1309
    // set up timer
1220
    TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64
1310
    TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64
1221
    OCR0 = 6; // preload
1311
    OCR0 = 6; // preload
1222
    TIMSK |= (1 << TOIE0); // enable overflow timer0
1312
    TIMSK |= (1 << TOIE0); // enable overflow timer0
Line 1223... Line 1313...
1223
 
1313
 
1224
    // unmask interrupts
1314
    // enable interrupts
1225
    sei();
1315
    sei();
Line 1226... Line 1316...
1226
#endif
1316
#endif
1227
 
1317
 
1228
    //write_ascii_string(2,  7, "         CaScAdE          ");
1318
    //write_ascii_string(2,  7, "         CaScAdE          ");
1229
    //write_ascii_string(2,  8, "is TESTING his open source");
-
 
1230
    //write_ascii_string(2,  9, "    EPi OSD Firmware");
-
 
1231
    //write_ascii_string(2, 10, "Scheiss Kompass");
-
 
1232
 
-
 
Line 1233... Line 1319...
1233
 
1319
    //write_ascii_string(2,  8, "is TESTING his open source");
1234
 
1320
    //write_ascii_string(2,  9, "    EPi OSD Firmware");
1235
 
1321
 
1236
    // custom char preview
1322
    // custom char preview
Line 1284... Line 1370...
1284
        uint16_t max_FlyingTime = 0;
1370
        uint16_t max_FlyingTime = 0;
Line 1285... Line 1371...
1285
 
1371
 
1286
        // flags from last round to check for changes
1372
        // flags from last round to check for changes
Line 1287... Line -...
1287
        uint8_t old_MKFlags = 0;
-
 
1288
       
-
 
1289
    // write fix characters, only update the data dependend
-
 
1290
    write_char_xy(5, top_line, 203); // km/h
-
 
1291
    write_char_xy(10, top_line, 202); // RC-transmitter
-
 
1292
    write_char_xy(16, top_line, 208); // degree symbol
-
 
1293
    write_char_xy(27, top_line, 204); // small meters m
-
 
1294
    write_ascii_string(6, bottom_line, "V"); // voltage
-
 
1295
    write_char_xy(14, bottom_line, 209); // on clock
-
 
1296
    write_char_xy(22, bottom_line, 210); // fly clock
-
 
1297
    write_char_xy(26, bottom_line, 200); // sat1
-
 
1298
    write_char_xy(27, bottom_line, 201); // sat2
1373
        uint8_t old_MKFlags = 0;
1299
 
1374
       
Line 1300... Line 1375...
1300
    char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "};
1375
    char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "};
-
 
1376
        char arrowdir[8] =   { 218,  217,  224,  223,  222,  221,  220, 219};
-
 
1377
 
-
 
1378
    while (1) {
-
 
1379
                // write icons at init or after menu/mode-switch
-
 
1380
                if (!(COSD_FLAGS & COSD_ICONS_WRITTEN)) {
-
 
1381
                            write_char_xy(5, top_line, 203); // km/h
-
 
1382
                            write_char_xy(10, top_line, 202); // RC-transmitter
-
 
1383
                            write_char_xy(16, top_line, 208); // degree symbol
-
 
1384
                            write_char_xy(27, top_line, 204); // small meters m
-
 
1385
                            write_ascii_string(6, bottom_line, "V"); // voltage
-
 
1386
                            write_char_xy(14, bottom_line, 209); // on clock
-
 
1387
                            write_char_xy(22, bottom_line, 210); // fly clock
-
 
1388
                            write_char_xy(26, bottom_line, 200); // sat1
1301
        char arrowdir[8] =   { 218,  217,  224,  223,  222,  221,  220, 219};
1389
                            write_char_xy(27, bottom_line, 201); // sat2
1302
 
1390
                                COSD_FLAGS |= COSD_ICONS_WRITTEN;
1303
    while (1) {
1391
                }
1304
        if (rxd_buffer_locked) {
1392
        if (rxd_buffer_locked) {
1305
            if (rxd_buffer[2] == 'D') { // FC Data
1393
            if (rxd_buffer[2] == 'D') { // FC Data
Line 1429... Line 1517...
1429
                                old_MKFlags = naviData.MKFlags;
1517
                                old_MKFlags = naviData.MKFlags;
1430
            }
1518
            }
1431
            rxd_buffer_locked = 0;
1519
            rxd_buffer_locked = 0;
1432
        }
1520
        }
1433
        // handle keypress
1521
        // handle keypress
1434
        if (S1_PRESSED) {
1522
        if (s1_pressed()) {
1435
            uptime = 0;
-
 
1436
            _delay_ms(100);
-
 
1437
        }
-
 
1438
        if (S2_PRESSED) {
-
 
1439
                        //sendMKData('d', 1, (unsigned char*) 0, 1);
1523
                        //sendMKData('d', 1, (unsigned char*) 0, 1);
1440
            // request OSD Data from NC every 100ms
1524
            // request OSD Data from NC every 100ms
1441
                        unsigned char ms = 10;
1525
                        /*unsigned char ms = 10;
1442
            sendMKData('o', 1, &ms, 1);
1526
            sendMKData('o', 1, &ms, 1);
-
 
1527
            _delay_ms(500);*/
-
 
1528
                        config_menu();
-
 
1529
        }
-
 
1530
                if (s2_pressed()) {
-
 
1531
            uptime = 0;
1443
            _delay_ms(500);
1532
            _delay_ms(100);
1444
        }
1533
        }
1445
    }
1534
    }
1446
#endif
1535
#endif
1447
    return 0;
1536
    return 0;
1448
}
1537
}