42
42
#define SHUTDOWN_STRING "MSP OSD SHUTTING DOWN..."
43
43
44
44
#define FALLBACK_FONT_PATH "/blackbox/font.bin"
45
+ #define ENTWARE_FONT_PATH "/opt/fonts/font.bin"
45
46
#define SDCARD_FONT_PATH "/storage/sdcard0/font.bin"
46
47
#define FONT_FILE_SIZE 1990656
47
48
53
54
54
55
#define SWAP32 (data ) \
55
56
( (((data) >> 24) & 0x000000FF) | (((data) >> 8) & 0x0000FF00) | \
56
- (((data) << 8) & 0x00FF0000) | (((data) << 24) & 0xFF000000) )
57
+ (((data) << 8) & 0x00FF0000) | (((data) << 24) & 0xFF000000) )
57
58
58
59
static volatile sig_atomic_t quit = 0 ;
59
60
dji_display_state_t * dji_display ;
@@ -90,18 +91,18 @@ static void draw_screen() {
90
91
for (uint8_t gy = 0 ; gy < FONT_HEIGHT ; gy ++ ) {
91
92
uint32_t font_offset = character_offset + (gy * FONT_WIDTH * BYTES_PER_PIXEL ) + (gx * BYTES_PER_PIXEL );
92
93
uint32_t target_offset = ((((pixel_x + gx ) * BYTES_PER_PIXEL ) + ((pixel_y + gy ) * WIDTH * BYTES_PER_PIXEL )));
93
- * ((uint8_t * )fb_addr + target_offset ) = * (uint8_t * )((uint8_t * )font + font_offset + 2 );
94
- * ((uint8_t * )fb_addr + target_offset + 1 ) = * (uint8_t * )((uint8_t * )font + font_offset + 1 );
95
- * ((uint8_t * )fb_addr + target_offset + 2 ) = * (uint8_t * )((uint8_t * )font + font_offset );
96
- * ((uint8_t * )fb_addr + target_offset + 3 ) = ~* (uint8_t * )((uint8_t * )font + font_offset + 3 );
94
+ * ((uint8_t * )fb_addr + target_offset ) = * (uint8_t * )((uint8_t * )font + font_offset + 2 );
95
+ * ((uint8_t * )fb_addr + target_offset + 1 ) = * (uint8_t * )((uint8_t * )font + font_offset + 1 );
96
+ * ((uint8_t * )fb_addr + target_offset + 2 ) = * (uint8_t * )((uint8_t * )font + font_offset );
97
+ * ((uint8_t * )fb_addr + target_offset + 3 ) = ~* (uint8_t * )((uint8_t * )font + font_offset + 3 );
97
98
}
98
99
}
99
100
DEBUG_PRINT ("%c" , c > 31 ? c : 20 );
100
101
}
101
102
DEBUG_PRINT (" " );
102
103
}
103
104
DEBUG_PRINT ("\n" );
104
- }
105
+ }
105
106
}
106
107
107
108
static void clear_screen ()
@@ -113,7 +114,7 @@ static void draw_complete() {
113
114
draw_screen ();
114
115
dji_display_push_frame (dji_display , which_fb );
115
116
which_fb = !which_fb ;
116
- DEBUG_PRINT ("drew a frame\n" );
117
+ DEBUG_PRINT ("drew a frame\n" );
117
118
}
118
119
119
120
static void msp_callback (msp_msg_t * msp_message )
@@ -167,7 +168,9 @@ static void stop_display() {
167
168
168
169
static void load_font () {
169
170
if (open_font (SDCARD_FONT_PATH , & font ) < 0 ) {
170
- open_font (FALLBACK_FONT_PATH , & font );
171
+ if (open_font (ENTWARE_FONT_PATH , & font ) < 0 ) {
172
+ open_font (FALLBACK_FONT_PATH , & font );
173
+ }
171
174
}
172
175
}
173
176
@@ -185,7 +188,7 @@ int main(int argc, char *argv[])
185
188
186
189
msp_state_t * msp_state = calloc (1 , sizeof (msp_state_t ));
187
190
msp_state -> cb = & msp_callback ;
188
-
191
+
189
192
int event_fd = open (INPUT_FILENAME , O_RDONLY );
190
193
assert (event_fd > 0 );
191
194
@@ -252,7 +255,7 @@ int main(int argc, char *argv[])
252
255
}
253
256
DEBUG_PRINT ("input type: %i, code: %i, value: %i\n" , ev .type , ev .code , ev .value );
254
257
}
255
- if (poll_fds [0 ].revents ) {
258
+ if (poll_fds [0 ].revents ) {
256
259
// Got UDP packet
257
260
if (0 < (recv_len = recvfrom (socket_fd ,& buffer ,sizeof (buffer ),0 ,(struct sockaddr * )& src_addr ,& src_addr_len )))
258
261
{
@@ -273,4 +276,4 @@ int main(int argc, char *argv[])
273
276
close (event_fd );
274
277
275
278
return 0 ;
276
- }
279
+ }
0 commit comments