diff --git a/libraries/AP_OSD/AP_OSD.h b/libraries/AP_OSD/AP_OSD.h index bfd2382839..d4806ece2a 100644 --- a/libraries/AP_OSD/AP_OSD.h +++ b/libraries/AP_OSD/AP_OSD.h @@ -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(); diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index af4f0f9e43..f412de7c33 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -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); } diff --git a/libraries/AP_OSD/fonts/bfstyle.mcm b/libraries/AP_OSD/fonts/bfstyle.mcm index 1aad09b2cf..e1b7778028 100644 --- a/libraries/AP_OSD/fonts/bfstyle.mcm +++ b/libraries/AP_OSD/fonts/bfstyle.mcm @@ -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 diff --git a/libraries/AP_OSD/fonts/bfstyle.png b/libraries/AP_OSD/fonts/bfstyle.png index 54652aac6d..bd199ecc3b 100644 Binary files a/libraries/AP_OSD/fonts/bfstyle.png and b/libraries/AP_OSD/fonts/bfstyle.png differ diff --git a/libraries/AP_OSD/fonts/bold.mcm b/libraries/AP_OSD/fonts/bold.mcm index 77348ccd58..856fcb58fe 100644 --- a/libraries/AP_OSD/fonts/bold.mcm +++ b/libraries/AP_OSD/fonts/bold.mcm @@ -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 diff --git a/libraries/AP_OSD/fonts/bold.png b/libraries/AP_OSD/fonts/bold.png index 3e247add16..15bdb35a65 100644 Binary files a/libraries/AP_OSD/fonts/bold.png and b/libraries/AP_OSD/fonts/bold.png differ diff --git a/libraries/AP_OSD/fonts/clarity.mcm b/libraries/AP_OSD/fonts/clarity.mcm old mode 100644 new mode 100755 index 96c67eb8bf..a88d67d005 --- a/libraries/AP_OSD/fonts/clarity.mcm +++ b/libraries/AP_OSD/fonts/clarity.mcm @@ -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 diff --git a/libraries/AP_OSD/fonts/clarity.png b/libraries/AP_OSD/fonts/clarity.png old mode 100644 new mode 100755 index 2c226b3fdb..f642a7581e Binary files a/libraries/AP_OSD/fonts/clarity.png and b/libraries/AP_OSD/fonts/clarity.png differ diff --git a/libraries/AP_OSD/fonts/clarity_medium.mcm b/libraries/AP_OSD/fonts/clarity_medium.mcm index 4d54edbd7e..df20f03f3e 100644 --- a/libraries/AP_OSD/fonts/clarity_medium.mcm +++ b/libraries/AP_OSD/fonts/clarity_medium.mcm @@ -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 diff --git a/libraries/AP_OSD/fonts/clarity_medium.png b/libraries/AP_OSD/fonts/clarity_medium.png index a472db58b2..a0e83388c4 100644 Binary files a/libraries/AP_OSD/fonts/clarity_medium.png and b/libraries/AP_OSD/fonts/clarity_medium.png differ diff --git a/libraries/AP_OSD/fonts/digital.mcm b/libraries/AP_OSD/fonts/digital.mcm index 9f28ede344..fa5f30bea4 100644 --- a/libraries/AP_OSD/fonts/digital.mcm +++ b/libraries/AP_OSD/fonts/digital.mcm @@ -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 diff --git a/libraries/AP_OSD/fonts/digital.png b/libraries/AP_OSD/fonts/digital.png index 50dacad788..1fc1a8c196 100644 Binary files a/libraries/AP_OSD/fonts/digital.png and b/libraries/AP_OSD/fonts/digital.png differ diff --git a/libraries/AP_OSD/fonts/font0.bin b/libraries/AP_OSD/fonts/font0.bin index 9f678b10cf..48f7faade1 100644 Binary files a/libraries/AP_OSD/fonts/font0.bin and b/libraries/AP_OSD/fonts/font0.bin differ diff --git a/libraries/AP_OSD/fonts/font1.bin b/libraries/AP_OSD/fonts/font1.bin index d4adda5664..e0a601dda0 100644 Binary files a/libraries/AP_OSD/fonts/font1.bin and b/libraries/AP_OSD/fonts/font1.bin differ diff --git a/libraries/AP_OSD/fonts/font2.bin b/libraries/AP_OSD/fonts/font2.bin index 4012a07e0b..e25638453a 100644 Binary files a/libraries/AP_OSD/fonts/font2.bin and b/libraries/AP_OSD/fonts/font2.bin differ diff --git a/libraries/AP_OSD/fonts/font3.bin b/libraries/AP_OSD/fonts/font3.bin index 102aa44354..e3eef2965e 100644 Binary files a/libraries/AP_OSD/fonts/font3.bin and b/libraries/AP_OSD/fonts/font3.bin differ diff --git a/libraries/AP_OSD/fonts/font4.bin b/libraries/AP_OSD/fonts/font4.bin index c1fd5c4fcc..fa180030b2 100644 Binary files a/libraries/AP_OSD/fonts/font4.bin and b/libraries/AP_OSD/fonts/font4.bin differ