Skip to content

Commit

Permalink
Preference layout changed, USB Baud rate added
Browse files Browse the repository at this point in the history
  • Loading branch information
Paku- committed Jan 28, 2014
1 parent 761a8ed commit 47121ae
Show file tree
Hide file tree
Showing 12 changed files with 414 additions and 210 deletions.
10 changes: 10 additions & 0 deletions MavLinkHUB/res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<resources>
<string-array name="pref_usb_baud_entries">
<item>"57600"</item>
<item>"115200"</item>
</string-array>
<string-array name="pref_usb_baud_entriesValues">
<item >"57600"</item>
<item >"115200"</item>
</string-array>
</resources>
37 changes: 21 additions & 16 deletions MavLinkHUB/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,30 @@
<string name="bt_calibrate">Calibrate</string>
<string name="bt_connectivity">Disconnect</string>
<!-- Pref Section Logging -->
<string name="pref_section_logs_title">System logger</string>
<string name="pref_log_mavlink_folder_title">MavLink log file folder</string>
<string name="pref_log_system_folder_title">System log file folder</string>
<string name="pref_log_system_title">System log</string>
<string name="pref_log_system_summary">Enable System log writes</string>
<string name="pref_log_mavlink_byte_title">Drone log </string>
<string name="pref_log_mavlink_byte_summary">Enable Drone log writes</string>
<string name="pref_section_logs_title">Logs</string>
<string name="pref_log_system_title">Log MavLinkHUB system messages</string>
<string name="pref_log_system_summary">Enable system messages file logging</string>
<string name="pref_log_mavlink_byte_title">Log Drone data</string>
<string name="pref_log_mavlink_byte_summary">Enable Drone transmission (byte level) file logging</string>
<string name="pref_log_mavlink_folder_title">Logs folder</string>
<string name="pref_log_system_folder_title">System log file folder</string>
<!-- Pref Section Autoscroll -->
<string name="pref_section_auto_scroll_title">Auto Scroll</string>
<string name="pref_msg_items_autoscroll_summary">Autoscroll Mavlink messages list</string>
<string name="pref_msg_items_autoscroll_title">MAVLink messages</string>
<string name="pref_byte_log_autoscroll_summary">Autoscroll Drone log</string>
<string name="pref_byte_log_autoscroll_title">Drone Log</string>
<string name="pref_section_auto_scroll_title">Auto Scroll</string>

<string name="pref_msg_items_autoscroll_title">Autoscroll MavLink messages</string>
<string name="pref_msg_items_autoscroll_summary">Enable Mavlink messages list autoscroll function, disable to move the list with fingers</string>

<string name="pref_byte_log_autoscroll_title">Autscroll Drone data log</string>
<string name="pref_byte_log_autoscroll_summary">Enable Drone data autoscroll function, disable to move the list with fingers</string>

<string name="pref_sys_log_autoscroll_title">System Log</string>
<string name="pref_sys_log_autoscroll_summary">Autoscroll System log</string>
<string name="pref_sys_log_autoscroll_title">System Log</string>

<!-- Pref Section II -->
<string name="pref_title_section2">Section Title</string>
<string name="pref_title_do_it">Empty title</string>
<string name="pref_summary_do_it">Empty summary</string>
<string name="prefs_dialog_title_usb_baud">Select USB baud rate</string>
<string name="pref_section_network_title">Transmission</string>
<string name="pref_usb_baud_title">USB baud rate</string>
<string name="pref_usb_baud_summary">Set the USB serial speed for your Drone USB interface. (Reconnect after changing)</string>
<!-- Error Msgs-->
<string name="error_drone_connection_lost">Drone connection LOST !!!</string>
<string name="error_no_bt_adapter_or_paired_devices">No Bluetooth adapter or Paired Devices found</string>
Expand Down
59 changes: 36 additions & 23 deletions MavLinkHUB/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >


<PreferenceCategory android:title="@string/pref_section_network_title" >
<ListPreference
android:dialogTitle="@string/prefs_dialog_title_usb_baud"
android:entries="@array/pref_usb_baud_entries"
android:entryValues="@array/pref_usb_baud_entriesValues"
android:key="pref_usb_baud"
android:summary="@string/pref_usb_baud_summary"
android:title="@string/pref_usb_baud_title" />
<!--
backup
<ListPreference
android:dialogTitle="@string/dialog_title_list_preference"
android:entries="@array/pref_usb_baud_entries"
android:entryValues="@array/pref_usb_baud_entriesValues"
android:key="list_preference"
android:summary="@string/summary_list_preference"
android:title="@string/title_list_preference" />
-->
</PreferenceCategory>



<PreferenceCategory android:title="@string/pref_section_logs_title" >
<CheckBoxPreference
android:defaultValue="true"
android:key="pref_log_mavlink_byte"
android:summary="@string/pref_log_mavlink_byte_summary"
android:title="@string/pref_log_mavlink_byte_title" />

<EditTextPreference
android:key="pref_log_mavlink_folder"
android:title="@string/pref_log_mavlink_folder_title" />

<CheckBoxPreference
android:defaultValue="true"
android:key="pref_log_system"
android:summary="@string/pref_log_system_summary"
android:title="@string/pref_log_system_title" />
<EditTextPreference
android:selectable="false"
android:defaultValue="."
android:key="pref_log_mavlink_folder"
android:title="@string/pref_log_mavlink_folder_title" />
<!--
<EditTextPreference
android:key="pref_log_system_folder"
android:title="@string/pref_log_system_folder_title" />
-->
</PreferenceCategory>

<PreferenceCategory android:title="@string/pref_section_auto_scroll_title" >
Expand All @@ -33,31 +62,15 @@
android:key="pref_byte_log_autoscroll"
android:summary="@string/pref_byte_log_autoscroll_summary"
android:title="@string/pref_byte_log_autoscroll_title" />

<!--
<CheckBoxPreference
android:defaultValue="true"
android:key="pref_sys_log_autoscroll"
android:summary="@string/pref_sys_log_autoscroll_summary"
android:title="@string/pref_sys_log_autoscroll_title" />
-->

</PreferenceCategory>

<PreferenceCategory android:title="@string/pref_title_section2" >
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_do_it"
android:summary="@string/pref_summary_do_it"
android:title="@string/pref_title_do_it" />
<!--
backup
<ListPreference
android:dialogTitle="@string/dialog_title_list_preference"
android:entries="@array/entries_list_preference"
android:entryValues="@array/entryvalues_list_preference"
android:key="list_preference"
android:summary="@string/summary_list_preference"
android:title="@string/title_list_preference" />
-->
</PreferenceCategory>

</PreferenceScreen>
2 changes: 1 addition & 1 deletion MavLinkHUB/src/com/paku/mavlinkhub/HUBActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void enableProgressBar(boolean on) {
public void onDataUpdateStats() {

final TextView mTextViewLogStats = (TextView) findViewById(R.id.textView_system_status_bar);
mTextViewLogStats.setText(HUBGlobals.logger.hubStats.toString_(MSG_SOURCE.FROM_ALL));
mTextViewLogStats.setText(HUBGlobals.logger.hubStats.toString(MSG_SOURCE.FROM_ALL));

}

Expand Down
12 changes: 12 additions & 0 deletions MavLinkHUB/src/com/paku/mavlinkhub/fragments/FragmentSettings.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
package com.paku.mavlinkhub.fragments;

import com.paku.mavlinkhub.HUBGlobals;
import com.paku.mavlinkhub.R;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceFragment;

public class FragmentSettings extends PreferenceFragment {

protected HUBGlobals hub;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

hub = (HUBGlobals) getActivity().getApplication();

// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);

EditTextPreference logFolderPref = (EditTextPreference) findPreference("pref_log_mavlink_folder");
logFolderPref.setSummary(hub.getExternalFilesDir(null).getAbsolutePath());

//ListPreference pref = (ListPreference) findPreference("thePreferencesKey");

}

}
152 changes: 0 additions & 152 deletions MavLinkHUB/src/com/paku/mavlinkhub/mavlink/MavLinkClassExtractor.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
// $codepro.audit.disable
// com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
package com.paku.mavlinkhub.queue.endpoints.drone;

import java.io.IOException;
Expand Down Expand Up @@ -35,7 +36,7 @@ public void startClient(ItemPeerDevice drone) {
usbDevice = HUBGlobals.usbHub.openByLocation(hub, ((ItemPeerDeviceUSB) drone).getLocation());

usbDevice.setBitMode((byte) 0, D2xxManager.FT_BITMODE_RESET);
usbDevice.setBaudRate(115200);
usbDevice.setBaudRate(Integer.valueOf(hub.prefs.getString("pref_usb_baud", "115200")));
usbDevice.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8, D2xxManager.FT_STOP_BITS_1, D2xxManager.FT_PARITY_NONE);
usbDevice.setFlowControl(D2xxManager.FT_FLOW_NONE, (byte) 0x0b, (byte) 0x0d);

Expand Down
Loading

0 comments on commit 47121ae

Please sign in to comment.