Skip to content

Commit

Permalink
Bottom/Center align for non-standard resolutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tipoman9 committed Nov 24, 2024
1 parent c1ffa36 commit b3ddae1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ toolchain/
majestic.yaml
/msposd
firmware/
release/
msposd_goke
msposd_hisi
msposd_star6b0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Usage: msposd [OPTIONS]
-d --wfb Monitors wfb.log file and reports errors via HUD messages
-s --osd Parse MSP and draw OSD over the video
-a --ahi Draw graphic AHI, mode [0-No, 2-Simple 1-Ladder, 3-LadderEx (home indicator on ladder)]
-x --matrix OSD matrix [0- 53:20 , 1- 50:18 chars, 11 Variable font size]
-x --matrix OSD matrix [0- 53:20 , 1- 50:18 chars, 11- Variable font size, 9-bottom align 720p mode, 8-center align 720p mode]
--mspvtx Enable alpha mspvtx functionality
-v --verbose Show debug info
--help Display this help
Expand Down Expand Up @@ -134,7 +134,7 @@ Copy msposd for the architecture you need on the cam.
Prebuild binaries for x86, SigmaStar, Goke and Hisilicon are at release/ folder.
**For SigmaStar** based SoC (ssc338q, sc30kq) :
```
curl -L -o /usr/bin/msposd https://raw.githubusercontent.com/openipc/msposd/main/release/star6e/msposd
curl -L -o /usr/bin/msposd https://github.com/OpenIPC/msposd/releases/download/latest/msposd_star6e
chmod 755 /usr/bin/msposd
```
Copy the font files for your flight controller firmware INAV/ Betaflight/ ArduPilot from here https://github.com/openipc/msposd/tree/main/fonts
Expand Down Expand Up @@ -170,9 +170,9 @@ Start msposd or reference it in OpenIPC boot scripts.

### To install on Goke/HiSilicon camera
```
curl -L -o /usr/bin/msposd https://raw.githubusercontent.com/openipc/msposd/main/release/goke/msposd
curl -L -o /usr/bin/msposd curl -L -o /usr/bin/msposd https://github.com/OpenIPC/msposd/releases/download/latest/msposd_goke
#or
curl -L -o /usr/bin/msposd https://raw.githubusercontent.com/openipc/msposd/main/release/hisi/msposd
curl -L -o /usr/bin/msposd curl -L -o /usr/bin/msposd https://github.com/OpenIPC/msposd/releases/download/latest/msposd_hisi
chmod 755 /usr/bin/msposd
#Download an additional driver for Region Module
curl -k -L -o /lib/modules/4.9.37/goke/gk7205v200_rgn.ko https://github.com/OpenIPC/firmware/raw/89ded200eba00726930b8307ddaf573ac449f076/general/package/goke-osdrv-gk7205v200/files/kmod/gk7205v200_rgn.ko
Expand Down
20 changes: 15 additions & 5 deletions osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ void LineTranspose(uint8_t* bmpData, int posX0, int posY0, int posX1, int posY1,
const bool show_center_indicator = false;////m_show_center_indicator;

const double ladder_stroke_faktor=0.1;
const int subline_thickness=2;
const int subline_thickness=1;

if (OVERLAY_HEIGHT<900){//720p mode
horizonWidth = 2;
Expand Down Expand Up @@ -851,7 +851,7 @@ void LineTranspose(uint8_t* bmpData, int posX0, int posY0, int posX1, int posY1,

//right upper line
//drawRectangleI4(bmpBuff.pData, px+width_ladder*2/3 , y , width_ladder/3 , stroke_s, m_color,subline_thickness);
LineTranspose(bmpBuff.pData, px+width_ladder*2/3 , y , (px+width_ladder*2/3) + width_ladder/3 , y , m_color, subline_thickness); // Top side
LineTranspose(bmpBuff.pData, px+width_ladder*2/3 , y , (px+width_ladder*2/3) + width_ladder/3 - 1 , y , m_color, subline_thickness); // Top side



Expand Down Expand Up @@ -1924,6 +1924,7 @@ void getExecutablePath(char *buffer, size_t bufferSize) {
}
}
int majestic_width;
int majestic_height;
int fd_mem;
static void InitMSPHook(){

Expand Down Expand Up @@ -1964,7 +1965,7 @@ static void InitMSPHook(){


int height = GetMajesticVideoConfig(&majestic_width);

majestic_height=height;
#ifdef _x86
if (DrawOSD)
Init_x86(&OVERLAY_WIDTH, &OVERLAY_HEIGHT);
Expand Down Expand Up @@ -2084,11 +2085,20 @@ On sigmastar the BMP row stride is aligned to 8 bytes, that is 16 pixels in PIXE
int XOffs=(majestic_width - OVERLAY_WIDTH)/2;
if (XOffs<0)
XOffs=8;
XOffs = (XOffs + 7) & ~7;//multiple of 8

int YOffs=0;
if (matrix_size==8)
YOffs=(majestic_height - OVERLAY_HEIGHT)/2;//vertical center

if (matrix_size==9)
YOffs=(majestic_height - OVERLAY_HEIGHT);//vertical bottom

//THIS IS NEEDED, the main region to draw inside
if (DrawOSD)
rgn=create_region(&osds[FULL_OVERLAY_ID].hand, XOffs, 0, OVERLAY_WIDTH, OVERLAY_HEIGHT);
rgn=create_region(&osds[FULL_OVERLAY_ID].hand, XOffs, YOffs, OVERLAY_WIDTH, OVERLAY_HEIGHT);
if (verbose)
printf("Create_region PixelFormat:%d Size: %d:%d X_Offset:%d results: %d \r\n", PIXEL_FORMAT_DEFAULT, OVERLAY_WIDTH,OVERLAY_HEIGHT, XOffs, rgn);
printf("Create_region PixelFormat:%d Size: %d:%d X_Offset:%d Y_Offset:%d results: %d \r\n", PIXEL_FORMAT_DEFAULT, OVERLAY_WIDTH,OVERLAY_HEIGHT, XOffs,YOffs, rgn);

if (DrawOSD){ //Show Font Preview
#ifdef _x86
Expand Down
Binary file removed release/goke/msposd
Binary file not shown.
Binary file removed release/hisi/msposd
Binary file not shown.
Binary file removed release/star6e/msposd
Binary file not shown.
Binary file removed release/x86/msposd
Binary file not shown.
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef VERSION_H
#define VERSION_H
#define GIT_VERSION "786ee76-dirty"
#define GIT_VERSION "c1ffa36-dirty"
#endif // VERSION_H

0 comments on commit b3ddae1

Please sign in to comment.