Skip to content

Commit

Permalink
Merge pull request #1511 from squilter/update_kill_switch_for_AC3.3
Browse files Browse the repository at this point in the history
Bring back kill switch
  • Loading branch information
m4gr3d committed Jul 9, 2015
2 parents ea0c4ae + 356cb43 commit 379c813
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'

compile 'com.o3dr.android:dronekit-android:2.3.32'
compile 'com.o3dr.android:dronekit-android:2.3.34'

compile 'me.grantland:autofittextview:0.2.1'
compile(name:'shimmer-android-release', ext:'aar')
Expand Down
16 changes: 3 additions & 13 deletions Android/res/menu/menu_super_activiy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@
android:id="@+id/menu_download_mission"
app:showAsAction="never"
android:title="@string/download_mission"/>

<item
android:id="@+id/menu_advanced"
android:id="@+id/menu_kill_switch"
app:showAsAction="never"
android:enabled="false"
android:visible="false"
android:title="@string/pref_advanced"
app:showAsAction="never">
<menu>
<item
android:id="@+id/menu_kill_switch"
app:showAsAction="never"
android:enabled="false"
android:visible="false"
android:title="KILL SWITCH"/>
</menu>
</item>
android:title="Kill Switch"/>

</group>

Expand Down
2 changes: 1 addition & 1 deletion Android/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
<string name="file_saved_success">Datei gespeichert</string>
<string name="firmware_version">Firmware-Version</string>
<string name="help_item_description">Wie man eine Mission plant und fliegt</string>
<string name="label_advaned">Erweitert</string>
<string name="label_advanced">Erweitert</string>
<string name="label_altitude_step">Höhenschritt</string>
<string name="label_enter_filename">Dateinamen eingeben</string>
<string name="label_steps_count">Anzahl Schritte</string>
Expand Down
2 changes: 1 addition & 1 deletion Android/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
<string name="file_saved_success">File salvato</string>
<string name="firmware_version">Versione Firmware</string>
<string name="help_item_description">Come pianificare e avviare una missione</string>
<string name="label_advaned">Avanzate</string>
<string name="label_advanced">Avanzate</string>
<string name="pref_title_mapbox">Preferenze MapBox</string>
<string name="pref_tts_periodic_alt">Altezza</string>
<string name="pref_tts_periodic_bat_volt">Voltaggio batteria</string>
Expand Down
2 changes: 1 addition & 1 deletion Android/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
<!-- Help -->
<string name="help_item_description">如何规划和执行飞行任务</string>

<string name="label_advaned">高级设定</string>
<string name="label_advanced">高级设定</string>
<string name="label_steps_count">步数</string>
<string name="label_altitude_step">高度级别</string>
<string name="menu_search_toggle">切换搜索</string>
Expand Down
2 changes: 1 addition & 1 deletion Android/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@

<!-- Help -->
<string name="help_item_description">如何設定和實際操作任務,請點我看影片</string>
<string name="label_advaned">進階設定</string>
<string name="label_advanced">進階設定</string>
<string name="label_steps_count">階層數</string>
<string name="label_altitude_step">階層高度</string>
<string name="menu_search_toggle">切換搜尋</string>
Expand Down
4 changes: 2 additions & 2 deletions Android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
<!-- Help -->
<string name="help_item_description">How to plan and fly a mission</string>

<string name="label_advaned">Advanced</string>
<string name="label_advanced">Advanced</string>
<string name="label_steps_count">Number of Steps</string>
<string name="label_altitude_step">Altitude Step</string>
<string name="menu_search_toggle">Toggle Search</string>
Expand Down Expand Up @@ -546,7 +546,7 @@
<string name="pref_map_rotation_title">Enable map rotation</string>
<string name="pref_map_rotation_summary">Check to enable the ability to rotate the map.</string>
<string name="pref_advance_menu_title">Advanced Menu Options</string>
<string name="pref_enable_kill_switch_summary">If enabled, a Kill Switch option will appear under the Advanced section in the menu, allowing to disarm the vehicle immediately.</string>
<string name="pref_enable_kill_switch_summary">If enabled, a Kill Switch option will appear in the menu, allowing immediate vehicle disarming.</string>
<string name="pref_enable_kill_switch_title">Enable Kill Switch</string>
<string name="pref_enable_udp_server_title">Enable UDP server ping</string>
<string name="pref_udp_server_ping_summary">Enable to allow the app to periodically ping the udp server.</string>
Expand Down
3 changes: 1 addition & 2 deletions Android/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@

</PreferenceCategory>

<!-- Disabling kill switch until arducopter v3.3 is out.
<PreferenceCategory
android:title="@string/pref_advance_menu_title">

Expand All @@ -307,7 +306,7 @@
android:summary="@string/pref_enable_kill_switch_summary"
android:title="@string/pref_enable_kill_switch_title"/>

</PreferenceCategory>-->
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
import android.view.MenuItem;

import com.o3dr.android.client.Drone;
import com.o3dr.android.client.apis.drone.DroneStateApi;
import com.o3dr.services.android.lib.drone.attribute.AttributeEvent;
import com.o3dr.services.android.lib.drone.attribute.AttributeType;
import com.o3dr.services.android.lib.drone.property.Type;
import com.o3dr.services.android.lib.drone.property.VehicleMode;

import org.droidplanner.android.DroidPlannerApp;
import org.droidplanner.android.R;
Expand Down Expand Up @@ -175,12 +179,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
menu.setGroupEnabled(R.id.menu_group_connected, true);
menu.setGroupVisible(R.id.menu_group_connected, true);

final boolean isAdvancedEnabled = mAppPrefs.isAdvancedMenuEnabled();
final MenuItem advancedSubMenu = menu.findItem(R.id.menu_advanced);
advancedSubMenu.setEnabled(isAdvancedEnabled);
advancedSubMenu.setVisible(isAdvancedEnabled);

//Enable specific sub items within the advanced menu section.
final MenuItem killSwitchItem = menu.findItem(R.id.menu_kill_switch);
final boolean isKillEnabled = mAppPrefs.isKillSwitchEnabled();
killSwitchItem.setEnabled(isKillEnabled);
Expand Down Expand Up @@ -256,7 +254,7 @@ public void onNo() {
SlideToUnlockDialog unlockDialog = SlideToUnlockDialog.newInstance("disable vehicle", new Runnable() {
@Override
public void run() {
dpApp.getDrone().arm(false);
DroneStateApi.arm(dpApp.getDrone(), false, true);
}
});
unlockDialog.show(getSupportFragmentManager(), "Slide to use the Kill Switch");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
});
}

final CheckBoxPreference killSwitch = (CheckBoxPreference) findPreference(DroidPlannerPrefs.PREF_ENABLE_KILL_SWITCH);
if(killSwitch != null) {
killSwitch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,6 @@ public boolean isMapRotationEnabled(){
return prefs.getBoolean(PREF_ENABLE_MAP_ROTATION, DEFAULT_ENABLE_MAP_ROTATION);
}

public boolean isAdvancedMenuEnabled(){
return isKillSwitchEnabled();
}

public boolean isKillSwitchEnabled(){
return prefs.getBoolean(PREF_ENABLE_KILL_SWITCH, DEFAULT_ENABLE_KILL_SWITCH);
}
Expand All @@ -433,6 +429,7 @@ public int getMaxAltitude(){
return getAltitudePreference(PREF_ALT_MAX_VALUE, DEFAULT_MAX_ALT);
}


/**
* @return the min altitude in meters
*/
Expand Down

0 comments on commit 379c813

Please sign in to comment.