Skip to content

Commit f3a8bc4

Browse files
author
Jesus Lopez Garcia
committed
Add configuration to enable/disable VTX MSP. Default: disabled
1 parent 9b0fbd7 commit f3a8bc4

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

config/goggles/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
"fakehd_columns": "S",
1111
"fakehd_rows": "WWWWWWCCWWWWWWWD",
1212
"rec_enabled": true,
13-
"rec_pb_enabled": true
13+
"rec_pb_enabled": true,
14+
"vtx_msp": false
1415
}

config/goggles/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
"hide_diagnostics": {
6161
"name": "Hide diagnostic information",
6262
"widget": "checkbox"
63+
},
64+
"vtx_msp": {
65+
"name": "Enable VTX MSP",
66+
"widget": "checkbox"
6367
}
6468
},
6569
"units": [

config/goggles/schemaV2.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,16 @@
5858
true,
5959
false
6060
]
61-
}
61+
},
62+
"vtx_msp": {
63+
"type": "boolean",
64+
"title": "Enable VTX MSP",
65+
"description": "Control video channel from Betaflight or ELRS Lua script VTX admin",
66+
"enum": [
67+
true,
68+
false
69+
]
70+
}
6271
},
6372
"dependencies": {
6473
"fakehd_enable": {

config/goggles/uiSchemaV2.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@
3131
},
3232
"fakehd_rows": {
3333
"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)"
34-
}
34+
},
35+
"vtx_msp": {
36+
"ui:help": "Enable VTX MSP protocol to control the video channel from Betaflight or ELRS Lua script VTX admin"
37+
},
3538
}

jni/util/vtx_manager.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include <stdlib.h>
22
#include <dlfcn.h>
3+
#include "json/osd_config.h"
34
#include "util/debug.h"
45

5-
6+
#define VTX_MPS_CONFIG_KEY "vtx_msp"
67

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

1314
void changeChannel(int8_t channel) {
15+
if(!get_boolean_config_value(VTX_MPS_CONFIG_KEY)) {
16+
return;
17+
}
18+
1419
//Load SetPilotChannel original
1520
setChannelPilotOriginal = dlsym (RTLD_NEXT, "_ZN17GlassUserSettings15setPilotChannelEtb");
1621
if (setChannelPilotOriginal == NULL) {

0 commit comments

Comments
 (0)