Skip to content

Commit

Permalink
Add configuration to enable/disable VTX MSP. Default: disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus Lopez Garcia committed Sep 23, 2023
1 parent 9b0fbd7 commit f3a8bc4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/goggles/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"fakehd_columns": "S",
"fakehd_rows": "WWWWWWCCWWWWWWWD",
"rec_enabled": true,
"rec_pb_enabled": true
"rec_pb_enabled": true,
"vtx_msp": false
}
4 changes: 4 additions & 0 deletions config/goggles/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
"hide_diagnostics": {
"name": "Hide diagnostic information",
"widget": "checkbox"
},
"vtx_msp": {
"name": "Enable VTX MSP",
"widget": "checkbox"
}
},
"units": [
Expand Down
11 changes: 10 additions & 1 deletion config/goggles/schemaV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@
true,
false
]
}
},
"vtx_msp": {
"type": "boolean",
"title": "Enable VTX MSP",
"description": "Control video channel from Betaflight or ELRS Lua script VTX admin",
"enum": [
true,
false
]
}
},
"dependencies": {
"fakehd_enable": {
Expand Down
5 changes: 4 additions & 1 deletion config/goggles/uiSchemaV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@
},
"fakehd_rows": {
"ui:help": "FakeHD row alignment config, each character configures the alignment for one row. [Read more](https://github.com/fpv-wtf/msp-osd#customising-the-default-fakehd-grid)"
}
},
"vtx_msp": {
"ui:help": "Enable VTX MSP protocol to control the video channel from Betaflight or ELRS Lua script VTX admin"
},
}
7 changes: 6 additions & 1 deletion jni/util/vtx_manager.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include <stdlib.h>
#include <dlfcn.h>
#include "json/osd_config.h"
#include "util/debug.h"


#define VTX_MPS_CONFIG_KEY "vtx_msp"

static void *tp1801_gui_lib = NULL;
static uint32_t (* setChannelPilotOriginal)(void *this,unsigned short param_1, bool param_2) = 0;
Expand All @@ -11,6 +12,10 @@ static uint32_t userSettingsInstance = 0;
static int8_t currentChannel = -1;

void changeChannel(int8_t channel) {
if(!get_boolean_config_value(VTX_MPS_CONFIG_KEY)) {
return;
}

//Load SetPilotChannel original
setChannelPilotOriginal = dlsym (RTLD_NEXT, "_ZN17GlassUserSettings15setPilotChannelEtb");
if (setChannelPilotOriginal == NULL) {
Expand Down

0 comments on commit f3a8bc4

Please sign in to comment.