diff --git a/libraries/AP_OSD/AP_OSD.h b/libraries/AP_OSD/AP_OSD.h index bc66aeeb08..698c4f71d3 100644 --- a/libraries/AP_OSD/AP_OSD.h +++ b/libraries/AP_OSD/AP_OSD.h @@ -183,6 +183,7 @@ private: AP_OSD_Setting vtx_power{false, 0, 0}; AP_OSD_Setting hgt_abvterr{false, 23, 7}; AP_OSD_Setting fence{false, 14, 9}; + AP_OSD_Setting rngf{false, 0, 0}; #if HAL_PLUSCODE_ENABLE AP_OSD_Setting pluscode{false, 0, 0}; #endif @@ -254,6 +255,7 @@ private: void draw_vtx_power(uint8_t x, uint8_t y); void draw_hgt_abvterr(uint8_t x, uint8_t y); void draw_fence(uint8_t x, uint8_t y); + void draw_rngf(uint8_t x, uint8_t y); struct { diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 2825b7ddd6..f675d5dbbd 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #if APM_BUILD_TYPE(APM_BUILD_Rover) #include #endif @@ -976,6 +977,22 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = { // @Description: Vertical position on screen // @Range: 0 15 AP_SUBGROUPINFO(fence, "FENCE", 59, AP_OSD_Screen, AP_OSD_Setting), + + // @Param: RNGF_EN + // @DisplayName: RNGF_EN + // @Description: Displays a rangefinder's distance in cm + // @Values: 0:Disabled,1:Enabled + + // @Param: RNGF_X + // @DisplayName: RNGF_X + // @Description: Horizontal position on screen + // @Range: 0 29 + + // @Param: RNGF_Y + // @DisplayName: RNGF_Y + // @Description: Vertical position on screen + // @Range: 0 15 + AP_SUBGROUPINFO(rngf, "RNGF", 60, AP_OSD_Screen, AP_OSD_Setting), AP_GROUPEND }; @@ -1074,6 +1091,7 @@ AP_OSD_Screen::AP_OSD_Screen() #define SYM_TERALT 0xEF #define SYM_FENCE_ENABLED 0xF5 #define SYM_FENCE_DISABLED 0xF6 +#define SYM_RNGFD 0xF7 void AP_OSD_AbstractScreen::set_backend(AP_OSD_Backend *_backend) @@ -1967,6 +1985,18 @@ void AP_OSD_Screen::draw_fence(uint8_t x, uint8_t y) } } +void AP_OSD_Screen::draw_rngf(uint8_t x, uint8_t y) +{ + RangeFinder *rangefinder = RangeFinder::get_singleton(); + if (rangefinder == nullptr) { + return; + } + if (rangefinder->status_orient(ROTATION_PITCH_270) <= RangeFinder::Status::NoData) { + backend->write(x, y, false, "%cNO DATA", SYM_RNGFD); + } else { + backend->write(x, y, false, "%c%2.2f%c", SYM_RNGFD, u_scale(DISTANCE, (rangefinder->distance_cm_orient(ROTATION_PITCH_270) * 0.01f)), u_icon(DISTANCE)); + } +} #define DRAW_SETTING(n) if (n.enabled) draw_ ## n(n.xpos, n.ypos) @@ -1989,6 +2019,7 @@ void AP_OSD_Screen::draw(void) DRAW_SETTING(hgt_abvterr); #endif + DRAW_SETTING(rngf); DRAW_SETTING(waypoint); DRAW_SETTING(xtrack_error); DRAW_SETTING(bat_volt); diff --git a/libraries/AP_OSD/fonts/bfstyle.mcm b/libraries/AP_OSD/fonts/bfstyle.mcm index 7e082b26ce..db83448be8 100644 --- a/libraries/AP_OSD/fonts/bfstyle.mcm +++ b/libraries/AP_OSD/fonts/bfstyle.mcm @@ -15822,33 +15822,33 @@ MAX7456 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 +00000000 +00000000 +00000000 +00101010 +10000010 +10101000 +00100000 +00100010 +00000000 +00100000 +00100010 +00000000 +00101010 +10000010 +10100010 +00100010 +00000010 +00000000 +00100000 +10000010 +00000000 +00100000 +00100010 +00010010 +00000000 +00000000 +00010000 01010101 01010101 01010101 diff --git a/libraries/AP_OSD/fonts/bfstyle.png b/libraries/AP_OSD/fonts/bfstyle.png index 0076584208..a310e39ad6 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 7c68c56860..8a722e0955 100644 --- a/libraries/AP_OSD/fonts/bold.mcm +++ b/libraries/AP_OSD/fonts/bold.mcm @@ -15825,33 +15825,33 @@ MAX7456 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 +00000000 +00000000 +00000000 +00101010 +10000010 +10101000 +00100000 +00100010 +00000000 +00100000 +00100010 +00000000 +00101010 +10000010 +10100010 +00100010 +00000010 +00000000 +00100000 +10000010 +00010000 +00100000 +00100010 +00010010 +00000001 +00000000 +00010000 01010101 01010101 01010101 diff --git a/libraries/AP_OSD/fonts/bold.png b/libraries/AP_OSD/fonts/bold.png index 6e25459593..f123d438cc 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 index d00216c9a3..a41da95d07 100644 --- a/libraries/AP_OSD/fonts/clarity.mcm +++ b/libraries/AP_OSD/fonts/clarity.mcm @@ -15831,33 +15831,33 @@ MAX7456 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 +00000000 +00000000 +00000000 +00101010 +10000010 +10101000 +00100000 +00100010 +00000000 +00100000 +00100010 +00000000 +00101010 +10000010 +10100010 +00100010 +00000010 +00000000 +00100000 +10000010 +00000000 +00100000 +00100010 +00000010 +00000000 +00000000 +00000000 01010101 01010101 01010101 diff --git a/libraries/AP_OSD/fonts/clarity.png b/libraries/AP_OSD/fonts/clarity.png index 65868a3ca8..716fba22cb 100644 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 476652159b..c567e049c3 100644 --- a/libraries/AP_OSD/fonts/clarity_medium.mcm +++ b/libraries/AP_OSD/fonts/clarity_medium.mcm @@ -15831,33 +15831,33 @@ MAX7456 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 +00000000 +00000000 +00000000 +00101010 +10000010 +10101000 +00100000 +00100010 +00000000 +00100000 +00100010 +00000000 +00101010 +10000010 +10100010 +00100010 +00000010 +00000000 +00100000 +10000010 +00000000 +00100000 +00100010 +00000010 +00000000 +00000000 +00000000 01010101 01010101 01010101 diff --git a/libraries/AP_OSD/fonts/clarity_medium.png b/libraries/AP_OSD/fonts/clarity_medium.png index c3e19d5228..4f5de63bed 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 1aa8b37692..20a3eebd54 100644 --- a/libraries/AP_OSD/fonts/digital.mcm +++ b/libraries/AP_OSD/fonts/digital.mcm @@ -15828,33 +15828,33 @@ MAX7456 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 +00000000 +00000000 +00000000 +00101010 +10000010 +10101000 +00100000 +00100010 +00000000 +00100000 +00100010 +00000000 +00101010 +10000010 +10100010 +00100010 +00000010 +00000000 +00100000 +10000010 +00000000 +00100000 +00100010 +00000010 +00000000 +00000000 +00000000 01010101 01010101 01010101 diff --git a/libraries/AP_OSD/fonts/digital.png b/libraries/AP_OSD/fonts/digital.png index 1034ed9618..ccbe568208 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 8c29f79dcd..e6950c8a8f 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 122e0f1480..71342e45f6 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 2cb2878f58..32595cfe77 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 c08459668e..56c126e6f1 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 951bb31007..2930e46aff 100644 Binary files a/libraries/AP_OSD/fonts/font4.bin and b/libraries/AP_OSD/fonts/font4.bin differ