Skip to content

Commit

Permalink
Ardupilot tested with OSD in native and betaflight mode, fonts added.
Browse files Browse the repository at this point in the history
  • Loading branch information
tipoman9 committed Nov 11, 2024
1 parent fa68683 commit a961b47
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 5 deletions.
49 changes: 48 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"configurations": [

{
"name": "C Debug",
"name": "UDP_OSD",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/msposd",
Expand Down Expand Up @@ -93,6 +93,53 @@
],
"preLaunchTask": "copy msposd"

},
{
//--on CAM read serial and forward via mavlink port
// msposd --channels 7 --master /dev/ttyS2 --baudrate 115200 --out 127.0.0.1:14550 --matrix 11 --ahi 3 -r 50

"name": "OSD_UART",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/msposd",
"args": [
"--master",
"/dev/ttyUSB0",
"--baudrate",
"115200",
"--osd",
"-c",
"7",
"-c",
"9",
"-r",
"50",
"--ahi",
"3",
"--matrix",
"11",
"-v",
"-f",
"/home/home/",
" "

],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",

"setupCommands": [
{
"description": "MAVLINk gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "copy msposd"

}
]
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ curl -k -L -o /usr/share/fonts/font.png https://raw.githubusercontent.com/openip
curl -k -L -o /usr/share/fonts/font_hd.png https://raw.githubusercontent.com/openipc/msposd/main/fonts/betaflight/font_hd.png
```


**For Ardupilot**:
Set
```SERIALx_PROTOCOL = 42``` replace x with the UART number.
```OSD_TYPE = 5```
To use betaflight fonts, set ```MSP_OPTIONS = 5``` and copy fonts for betaflight as shown above.
If you prefer to use ardupilot "native" fonts (more icons), then set ```MSP_OPTIONS = 4``` and copy the fonts below.
```
mkdir /usr/share/fonts
curl -k -L -o /usr/share/fonts/font.png https://raw.githubusercontent.com/openipc/msposd/main/fonts/ardupilot/font.png
curl -k -L -o /usr/share/fonts/font_hd.png https://raw.githubusercontent.com/openipc/msposd/main/fonts/ardupilot/font_hd.png
```

Start msposd or reference it in OpenIPC boot scripts.

### To install on Goke/HiSilicon camera
Expand Down
2 changes: 1 addition & 1 deletion develepment_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Enhanced AHI ladder, home indicator on the main AHI line
msposd --channels 7 --master /dev/ttyUSB0 --baudrate 115200 --osd --matrix 11 --ahi 3 -r 30 -v

--on PC read serial and forward to test air no OSD mode
msposd --channels 7 --master /dev/ttyUSB0 --baudrate 115200 --out 127.0.0.1:14550 --matrix 11 --ahi 3 -r 50 -v
msposd_x86 --channels 7 --master /dev/ttyUSB0 --baudrate 115200 --out 127.0.0.1:14550 --matrix 11 --ahi 3 -r 50 -v


--on CAM read serial and forward via mavlink port
Expand Down
Binary file added fonts/ardupilot/font.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/ardupilot/font_hd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ static void clear_screen()
return ;
//ClearScreen_x86();
//BetaFlight needs this. INAV can be configured to skip it
if (font_pages>2 || (get_time_ms() - LastCleared)>500) {//no faster than 0.5 per second
if (!DrawOSD || font_pages == 1 || font_pages>2 || (get_time_ms() - LastCleared)>300) {//no faster than 0.5 per second
memset(character_map, 0, sizeof(character_map));
if (bmpBuff.pData!=NULL)//Set whole BMP as transparant, Palette index 0xF if 4bit
memset(bmpBuff.pData, PIXEL_FORMAT_DEFAULT==PIXEL_FORMAT_I4 ? 0xFF : 0x00 , bmpBuff.u32Height * getRowStride(bmpBuff.u32Width , PIXEL_FORMAT_BitsPerPixel));
Expand Down Expand Up @@ -1788,7 +1788,7 @@ static void msp_callback(msp_msg_t *msp_message)
{
displayport_process_message(display_driver, msp_message);
}

static int set_mode_global_counter=0;
static void set_options(uint8_t font, msp_hd_options_e is_hd) {
/*
if(is_hd) {
Expand All @@ -1798,7 +1798,7 @@ static void set_options(uint8_t font, msp_hd_options_e is_hd) {
}
*/
//we need FullHD option?!
if (verbose)
if (verbose&&set_mode_global_counter++<10)
printf("FC set mode:%d\r\n",is_hd);
}

Expand Down
Binary file modified release/goke/msposd
Binary file not shown.
Binary file modified release/hisi/msposd
Binary file not shown.
Binary file modified release/star6e/msposd
Binary file not shown.
Binary file modified release/x86/msposd
Binary file not shown.

0 comments on commit a961b47

Please sign in to comment.