AP_OSD: Adding efficiency and climb efficiency

and new font characters
This commit is contained in:
Hwurzburg 2018-08-16 18:26:49 -05:00 committed by Andrew Tridgell
parent dd33fce3b1
commit 53a28cdf18
17 changed files with 240 additions and 191 deletions

View File

@ -107,6 +107,8 @@ private:
AP_OSD_Setting dist{false,22,11};
AP_OSD_Setting stat{false,0,0};
AP_OSD_Setting flightime{false, 23, 10};
AP_OSD_Setting climbeff{false,0,0};
AP_OSD_Setting eff{false, 22, 10};
bool check_option(uint32_t option);
@ -162,6 +164,8 @@ private:
void draw_dist(uint8_t x, uint8_t y);
void draw_stat(uint8_t x, uint8_t y);
void draw_flightime(uint8_t x, uint8_t y);
void draw_climbeff(uint8_t x, uint8_t y);
void draw_eff(uint8_t x, uint8_t y);
};
class AP_OSD {
@ -233,6 +237,7 @@ public:
void set_nav_info(NavInfo &nav_info);
private:
void osd_thread();
void update_osd();

View File

@ -182,6 +182,14 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(flightime, "FLTIME", 34, AP_OSD_Screen, AP_OSD_Setting),
// @Group: CLIMBEFF
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(climbeff, "CLIMBEFF", 35, AP_OSD_Screen, AP_OSD_Setting),
// @Group: EFF
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(eff, "EFF", 36, AP_OSD_Screen, AP_OSD_Setting),
AP_GROUPEND
};
@ -274,6 +282,7 @@ AP_OSD_Screen::AP_OSD_Screen()
#define SYM_NM 0xF1
#define SYM_DIST 0x22
#define SYM_FLY 0x9C
#define SYM_EFF 0xF2
void AP_OSD_Screen::set_backend(AP_OSD_Backend *_backend)
{
@ -811,6 +820,7 @@ void AP_OSD_Screen::draw_temp(uint8_t x, uint8_t y)
backend->write(x, y, false, "%3d%c", (int)u_scale(TEMPERATURE, tmp), u_icon(TEMPERATURE));
}
void AP_OSD_Screen::draw_hdop(uint8_t x, uint8_t y)
{
AP_GPS & gps = AP::gps();
@ -862,9 +872,42 @@ void AP_OSD_Screen::draw_flightime(uint8_t x, uint8_t y)
if (stats) {
uint32_t t = stats->get_flight_time_s();
backend->write(x, y, false, "%c%3u:%02u", SYM_FLY, t/60, t%60);
}
}
void AP_OSD_Screen::draw_eff(uint8_t x, uint8_t y)
{
AP_BattMonitor &battery = AP_BattMonitor::battery();
AP_AHRS &ahrs = AP::ahrs();
Vector2f v = ahrs.groundspeed_vector();
float speed = u_scale(SPEED,v.length());
if (speed > 2.0){
backend->write(x, y, false, "%c%3d%c", SYM_EFF,int(1000*battery.current_amps()/speed),SYM_MAH);
} else {
backend->write(x, y, false, "%c---%c", SYM_EFF,SYM_MAH);
}
}
void AP_OSD_Screen::draw_climbeff(uint8_t x, uint8_t y)
{
char unit_icon = u_icon(DISTANCE);
Vector3f v;
float vspd;
if (AP::ahrs().get_velocity_NED(v)) {
vspd = -v.z;
} else {
vspd = AP::baro().get_climb_rate();
}
if (vspd < 0.0) vspd = 0.0;
AP_BattMonitor &battery = AP_BattMonitor::battery();
float amps = battery.current_amps();
if (amps > 0.0) {
backend->write(x, y, false,"%c%c%3.1f%c",SYM_PTCHUP,SYM_EFF,(3.6 * u_scale(VSPEED,vspd)/amps),unit_icon);
} else {
backend->write(x, y, false,"%c%c---%c",SYM_PTCHUP,SYM_EFF,unit_icon);
}
}
#define DRAW_SETTING(n) if (n.enabled) draw_ ## n(n.xpos, n.ypos)
void AP_OSD_Screen::draw(void)
@ -911,6 +954,7 @@ void AP_OSD_Screen::draw(void)
DRAW_SETTING(gps_longitude);
DRAW_SETTING(dist);
DRAW_SETTING(stat);
DRAW_SETTING(climbeff);
DRAW_SETTING(eff);
}

View File

@ -15487,60 +15487,60 @@ MAX7456
01010101
01010101
01010101
00000000
00010101
01010101
00101010
00010101
01010101
00100000
00010101
01010101
00101000
00010101
01010101
00100000
00010101
01010101
00101010
00010101
01010101
00000000
00000000
01010101
01010100
10101000
01010101
01010100
10000000
01010101
01010100
10100000
01010101
01010100
10000001
01010101
01010100
10000000
00000001
01010100
00000010
10100001
01010101
01010010
00000001
01010101
01010010
10000001
01010101
01010010
00000001
01010101
01010010
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010000
00010101
01010101
01010101
01010101

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -15487,60 +15487,60 @@ MAX7456
01010101
01010101
01010101
00000000
00010101
01010101
00101010
00010101
01010101
00100000
00010101
01010101
00101000
00010101
01010101
00100000
00010101
01010101
00101010
00010101
01010101
00000000
00000000
01010101
01010100
10101000
01010101
01010100
10000000
01010101
01010100
10100000
01010101
01010100
10000001
01010101
01010100
10000000
00000001
01010100
00000010
10100001
01010101
01010010
00000001
01010101
01010010
10000001
01010101
01010010
00000001
01010101
01010010
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010000
00010101
01010101
01010101
01010101

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

76
libraries/AP_OSD/fonts/clarity.mcm Normal file → Executable file
View File

@ -15487,60 +15487,60 @@ MAX7456
01010101
01010101
01010101
00000000
00010101
01010101
00101010
00010101
01010101
00100000
00010101
01010101
00101000
00010101
01010101
00100000
00010101
01010101
00101010
00010101
01010101
00000000
00000000
01010101
01010100
10101000
01010101
01010100
10000000
01010101
01010100
10100000
01010101
01010100
10000001
01010101
01010100
10000000
00000001
01010100
00000010
10100001
01010101
01010010
00000001
01010101
01010010
10000001
01010101
01010010
00000001
01010101
01010010
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010000
00010101
01010101
01010101
01010101

BIN
libraries/AP_OSD/fonts/clarity.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -15487,60 +15487,60 @@ MAX7456
01010101
01010101
01010101
00000000
00010101
01010101
00101010
00010101
01010101
00100000
00010101
01010101
00101000
00010101
01010101
00100000
00010101
01010101
00101010
00010101
01010101
00000000
00000000
01010101
01010100
10101000
01010101
01010100
10000000
01010101
01010100
10100000
01010101
01010100
10000001
01010101
01010100
10000000
00000001
01010100
00000010
10100001
01010101
01010010
00000001
01010101
01010010
10000001
01010101
01010010
00000001
01010101
01010010
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010000
00010101
01010101
01010101
01010101

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -15487,60 +15487,60 @@ MAX7456
01010101
01010101
01010101
00000000
00010101
01010101
00101010
00010101
01010101
00100000
00010101
01010101
00101000
00010101
01010101
00100000
00010101
01010101
00101010
00010101
01010101
00000000
00000000
01010101
01010100
10101000
01010101
01010100
10000000
01010101
01010100
10100000
01010101
01010100
10000001
01010101
01010100
10000000
00000001
01010100
00000010
10100001
01010101
01010010
00000001
01010101
01010010
10000001
01010101
01010010
00000001
01010101
01010010
00010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010000
00010101
01010101
01010101
01010101

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.