Subversion Repositories Projects

Rev

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

Rev 507 Rev 519
Line 50... Line 50...
50
                    write_char_xy(27, bottom_line, 0xC9); // sat2
50
                    write_char_xy(27, bottom_line, 0xC9); // sat2
51
                        COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
51
                        COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
52
                }
52
                }
Line 53... Line 53...
53
 
53
 
54
                // first line
54
                // first line
Line 55... Line 55...
55
                write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 100, 0);
55
                write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
56
 
56
 
57
                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 100, 0);
57
                write_ndigit_number_u(7, top_line, naviData.RC_Quality, 3, 0);
58
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
58
                if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
59
                    for (uint8_t x = 0; x < 4; x++)
59
                    for (uint8_t x = 0; x < 4; x++)
60
                        write_char_att_xy(7 + x, top_line, BLINK);
60
                        write_char_att_xy(7 + x, top_line, BLINK);
Line 68... Line 68...
68
                    write_char_xy(11, top_line, 0); // clear
68
                    write_char_xy(11, top_line, 0); // clear
69
                } else {
69
                } else {
70
                    write_char_xy(11, top_line, 0xC6); // PC icon
70
                    write_char_xy(11, top_line, 0xC6); // PC icon
71
                }
71
                }
Line 72... Line 72...
72
 
72
 
Line 73... Line 73...
73
                write_ndigit_number_u(13, top_line, naviData.CompassHeading, 100, 0);
73
                write_ndigit_number_u(13, top_line, naviData.CompassHeading, 3, 0);
Line 74... Line 74...
74
 
74
 
Line 75... Line 75...
75
                write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word ( &(directions[heading_conv(naviData.CompassHeading)]))));
75
                write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word ( &(directions[heading_conv(naviData.CompassHeading)]))));
76
 
76
 
77
                draw_variometer(21, top_line, naviData.Variometer);
77
                draw_variometer(21, top_line, naviData.Variometer);
78
 
78
 
79
                //note:lephisto:according to several sources it's /30
79
                //note:lephisto:according to several sources it's /30
80
                if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
80
                if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
81
                    // above 10m only write full meters
81
                    // above 10m only write full meters
82
                    write_ndigit_number_s(23, top_line, naviData.Altimeter / 30, 1000, 0);
82
                    write_ndigit_number_s(23, top_line, naviData.Altimeter / 30, 4, 0);
83
                } else {
83
                } else {
Line -... Line 84...
-
 
84
                    // up to 10m write meters.dm
-
 
85
                    //write_number_u_10th(21, top_line, naviData.Altimeter / 3);
-
 
86
                    write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 3, 3, 0);
84
                    // up to 10m write meters.dm
87
                }
85
                    //write_number_u_10th(21, top_line, naviData.Altimeter / 3);
88
 
Line 86... Line 89...
86
                    write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 3, 100, 0);
89
                // GPS HIGHT
87
                }
90
                //write_ndigit_number_s(23, top_line-1, (int16_t) (naviData.CurrentPosition.Altitude / 1000), 4, 0);
88
 
91
 
89
                // seccond line
92
                // seccond line
90
                draw_compass(11, top_line + 1, naviData.CompassHeading);
93
                draw_compass(11, top_line + 1, naviData.CompassHeading);
Line 91... Line 94...
91
 
94
 
Line 92... Line 95...
92
                // TODO: verify correctness
95
                // TODO: verify correctness
93
                uint16_t heading_home = (naviData.HomePositionDeviation.Bearing + 360 - naviData.CompassHeading) % 360;
96
                uint16_t heading_home = (naviData.HomePositionDeviation.Bearing + 360 - naviData.CompassHeading) % 360;
94
                //write_char_xy(21, top_line + 1, arrowdir[heading_conv(heading_home)]);
97
                //write_char_xy(21, top_line + 1, arrowdir[heading_conv(heading_home)]);
95
                // finer resolution, 0xa0 is first character and we add the index 0 <= index < 16
98
                // finer resolution, 0xa0 is first character and we add the index 0 <= index < 16
Line 116... Line 119...
116
                } else {
119
                } else {
117
                    // stats
120
                    // stats
118
                    if ((COSD_FLAGS2 & COSD_WASFLYING) && (COSD_FLAGS & COSD_FLAG_STATS)) {
121
                    if ((COSD_FLAGS2 & COSD_WASFLYING) && (COSD_FLAGS & COSD_FLAG_STATS)) {
119
                                uint8_t line = 3;
122
                                uint8_t line = 3;
120
                        write_ascii_string_pgm(2, line, (const char *) (pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
123
                        write_ascii_string_pgm(2, line, (const char *) (pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
121
                        write_ndigit_number_s(18, line, max_Altimeter / 30, 1000, 0);
124
                        write_ndigit_number_s(18, line, max_Altimeter / 30, 4, 0);
122
                        write_char_xy(22, line, 204); // small meters m
125
                        write_char_xy(22, line, 204); // small meters m
123
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
126
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
124
                        write_ndigit_number_u(19, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 100, 0);
127
                        write_ndigit_number_u(19, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
125
                        write_char_xy(22, line, 203); // km/h
128
                        write_char_xy(22, line, 203); // km/h
126
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
129
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
127
                        write_ndigit_number_u(19, line, max_Distance / 10, 100, 0);
130
                        write_ndigit_number_u(19, line, max_Distance / 10, 3, 0);
128
                        write_char_xy(22, line, 204); // small meters m
131
                        write_char_xy(22, line, 204); // small meters m
129
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
132
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
130
                        write_ndigit_number_u_10th(18, line, min_UBat, 100, 0);
133
                        write_ndigit_number_u_10th(18, line, min_UBat, 3, 0);
131
                        write_char_xy(22, line, 0x9E); // small V
134
                        write_char_xy(22, line, 0x9E); // small V
132
                                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
135
                                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
133
                                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere
136
                                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[7])))); // ampere
134
                                        write_ndigit_number_u_10th(18, line, max_ampere / 10, 100, 0);
137
                                        write_ndigit_number_u_10th(18, line, max_ampere / 10, 3, 0);
135
                                        write_char_xy(22, line, 0x9F); // small A
138
                                        write_char_xy(22, line, 0x9F); // small A
136
                                }
139
                                }
137
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[4])))); // max time
140
                        write_ascii_string_pgm(2, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[4])))); // max time
138
                        write_time(16, line, max_FlyingTime);
141
                        write_time(16, line, max_FlyingTime);
139
                        write_char_xy(22, line, 210); // fly clock
142
                        write_char_xy(22, line, 210); // fly clock
Line 153... Line 156...
153
                    draw_big_variometer(27, 8, naviData.Variometer);
156
                    draw_big_variometer(27, 8, naviData.Variometer);
154
                }
157
                }
Line 155... Line 158...
155
 
158
 
156
                // pre-bottom line
159
                // pre-bottom line
157
                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
160
                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
158
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
161
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
159
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
162
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
160
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 1000, 0);
163
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
161
                        if (COSD_FLAGS & COSD_FLAG_STROMVOLT) {
164
                        if (COSD_FLAGS & COSD_FLAG_STROMVOLT) {
162
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 100, 0);
165
                                write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
163
                        }
166
                        }
Line 164... Line 167...
164
                }
167
                }
165
 
168
 
166
                // bottom line
169
                // bottom line
167
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
170
                draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage);
168
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 100, 0);
171
                write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 3, 0);
169
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
172
                if (naviData.UBat <= min_voltage && last_UBat > min_voltage) {
170
                    for (uint8_t x = 2; x < 8; x++)
173
                    for (uint8_t x = 2; x < 8; x++)
171
                        write_char_att_xy(x, bottom_line, BLINK);
174
                        write_char_att_xy(x, bottom_line, BLINK);
Line 175... Line 178...
175
                }
178
                }
Line 176... Line 179...
176
 
179
 
177
                write_time(8, bottom_line, uptime);
180
                write_time(8, bottom_line, uptime);
Line 178... Line 181...
178
                write_time(15, bottom_line, naviData.FlyingTime);
181
                write_time(15, bottom_line, naviData.FlyingTime);
Line 179... Line 182...
179
 
182
 
180
                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 10, 0);
183
                write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 2, 0);
181
 
184
 
182
                if (naviData.NCFlags & NC_FLAG_MANUAL_CONTROL) {
185
                if (naviData.NCFlags & NC_FLAG_MANUAL_CONTROL) {