Skip to content

Commit

Permalink
Added 4th telemetry port option
Browse files Browse the repository at this point in the history
  • Loading branch information
kripper committed Jun 1, 2023
1 parent 311ef83 commit 2f3c0d4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/sq/rogue/rosettadrone/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,12 @@ private void createTelemetrySockets() {
int port = Integer.parseInt(Objects.requireNonNull(mainActivityRef.prefs.getString("pref_telemetry_3_port", "")));
mainActivityRef.mMavlinkReceiver.mavLinkConnections.add(new MAVLinkConnection(host, port));
}

if (mainActivityRef.prefs.getBoolean("pref_telemetry_4_enabled", false)) {
String host = mainActivityRef.prefs.getString("pref_telemetry_4_host", "");
int port = Integer.parseInt(Objects.requireNonNull(mainActivityRef.prefs.getString("pref_telemetry_4_port", "")));
mainActivityRef.mMavlinkReceiver.mavLinkConnections.add(new MAVLinkConnection(host, port));
}
}

protected void close() {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
<string name="pref_telemetry_3_host">Host 3</string>
<string name="pref_telemetry_3_port">Port 3</string>

<string name="pref_telemetry_4_enabled">Enable Telemetry 4</string>
<string name="pref_telemetry_4_host">Host 4</string>
<string name="pref_telemetry_4_port">Port 4</string>

<string name="pref_video_ip">Video IP address</string>
<string name="pref_video_port">Video port</string>
<string name="pref_video_bitrate">Video bitrate</string>
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@
android:key="pref_telemetry_3_port"
android:title="@string/pref_telemetry_3_port" />

<androidx.preference.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_telemetry_4_enabled"
android:title="@string/pref_telemetry_4_enabled" />
<androidx.preference.EditTextPreference
android:defaultValue=""
android:dependency="pref_telemetry_4_enabled"
android:digits="0123456789."
android:inputType="number"
android:key="pref_telemetry_4_host"
android:title="@string/pref_telemetry_4_host" />
<androidx.preference.EditTextPreference
android:defaultValue=""
android:dependency="pref_telemetry_4_enabled"
android:key="pref_telemetry_4_port"
android:title="@string/pref_telemetry_4_port" />

</PreferenceCategory>

<PreferenceCategory
Expand Down

0 comments on commit 2f3c0d4

Please sign in to comment.