mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
Matek OSD support
I changed the HOME waypoint altitude to ground alt in order to avoid a compiler error about not finding waypoints[WP_HOME].a Matek osd will work now, TEXT artificial horizon is added, additional string format capabilities are given in the osd_put_s() and osd_sprintf() functions , able to inject special osd character code in to a string to be sent to the osd display and the code now checks the osd chip's busy flag instead of waiting and hoping that the OSD is not busy.
This commit is contained in:
@@ -28,6 +28,8 @@
|
|||||||
#include "std.h"
|
#include "std.h"
|
||||||
//#include "stdio.h"
|
//#include "stdio.h"
|
||||||
|
|
||||||
|
#include "inter_mcu.h"
|
||||||
|
|
||||||
#include "mcu_periph/sys_time.h"
|
#include "mcu_periph/sys_time.h"
|
||||||
#include "mcu_periph/gpio.h"
|
#include "mcu_periph/gpio.h"
|
||||||
#include "mcu_periph/spi.h"
|
#include "mcu_periph/spi.h"
|
||||||
@@ -167,7 +169,7 @@ static float home_direction(void)
|
|||||||
|
|
||||||
Home_Position.fx = WaypointY(WP_HOME);
|
Home_Position.fx = WaypointY(WP_HOME);
|
||||||
Home_Position.fy = WaypointX(WP_HOME);
|
Home_Position.fy = WaypointX(WP_HOME);
|
||||||
Home_Position.fz = waypoints[WP_HOME].a;
|
Home_Position.fz = ground_alt;
|
||||||
|
|
||||||
/* distance between plane and object */
|
/* distance between plane and object */
|
||||||
vSubtractVectors(&Home_PositionForPlane, Home_Position, svPlanePosition);
|
vSubtractVectors(&Home_PositionForPlane, Home_Position, svPlanePosition);
|
||||||
@@ -271,13 +273,9 @@ return(c);
|
|||||||
|
|
||||||
if (c >= '0' && c <= '9') {
|
if (c >= '0' && c <= '9') {
|
||||||
if (c == '0') { c -= 38; } else { c -= 48; }
|
if (c == '0') { c -= 38; } else { c -= 48; }
|
||||||
}
|
} else if (c >= 'A' && c <= 'Z') {
|
||||||
else
|
|
||||||
if (c >= 'A' && c <= 'Z'){
|
|
||||||
c -= 54;
|
c -= 54;
|
||||||
}
|
} else if (c >= 'a' && c <= 'z') {
|
||||||
else
|
|
||||||
if (c >= 'a' && c <= 'z'){
|
|
||||||
c -= 60;
|
c -= 60;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -335,9 +333,7 @@ if (attributes & C_JUST){
|
|||||||
// COPY THE MODIFIED STRING TO MAIN OSD STRING
|
// COPY THE MODIFIED STRING TO MAIN OSD STRING
|
||||||
x = 0;
|
x = 0;
|
||||||
do { osd_string[x] = osd_buf[x]; } while (osd_buf[x++] != 0xFF);
|
do { osd_string[x] = osd_buf[x]; } while (osd_buf[x++] != 0xFF);
|
||||||
}
|
} else if (attributes & R_JUST) {
|
||||||
else
|
|
||||||
if (attributes & R_JUST){
|
|
||||||
//if(x){ x -= 1; }
|
//if(x){ x -= 1; }
|
||||||
//if (char_nb < string_len){ char_nb = string_len; }
|
//if (char_nb < string_len){ char_nb = string_len; }
|
||||||
if (((int8_t)column - char_nb) >= 0) { column -= char_nb; }
|
if (((int8_t)column - char_nb) >= 0) { column -= char_nb; }
|
||||||
@@ -392,7 +388,7 @@ for (x=0; x < sizeof(osd_string); x++){ osd_string[x] = 0; }
|
|||||||
for (x = 0; x < sizeof(string_buf); x++) { string_buf[x] = 0; }
|
for (x = 0; x < sizeof(string_buf); x++) { string_buf[x] = 0; }
|
||||||
|
|
||||||
//copy the string passed as parameter to a buffer
|
//copy the string passed as parameter to a buffer
|
||||||
for (x=0; x < sizeof(string_buf); x++){ string_buf[x] = *(string+x); if(string_buf[x] == '\0') break; }
|
for (x = 0; x < sizeof(string_buf); x++) { string_buf[x] = *(string + x); if (string_buf[x] == '\0') { break; } }
|
||||||
x = 0;
|
x = 0;
|
||||||
param_start = 0;
|
param_start = 0;
|
||||||
param_end = 0;
|
param_end = 0;
|
||||||
@@ -405,7 +401,8 @@ param_end = 0;
|
|||||||
}
|
}
|
||||||
if (param_end - param_start) {
|
if (param_end - param_start) {
|
||||||
//load the special character value where the % character was
|
//load the special character value where the % character was
|
||||||
string_buf[x] = ((string_buf[param_start]-48)*100) + ((string_buf[param_start+1]-48)*10) + (string_buf[param_start+2]-48);
|
string_buf[x] = ((string_buf[param_start] - 48) * 100) + ((string_buf[param_start + 1] - 48) * 10) +
|
||||||
|
(string_buf[param_start + 2] - 48);
|
||||||
x++; // increment x to the next character which should be the first special character's digit
|
x++; // increment x to the next character which should be the first special character's digit
|
||||||
//Move the rest of the buffer forward so only the special character remains,
|
//Move the rest of the buffer forward so only the special character remains,
|
||||||
// for example in %170c '%' now has the special character's code and x now points to '1'
|
// for example in %170c '%' now has the special character's code and x now points to '1'
|
||||||
|
|||||||
Reference in New Issue
Block a user