1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

AndroidGCS Tuning: Connect the SmartSave button to the tuning page

This commit is contained in:
James Cotton 2012-08-29 02:41:58 -05:00
parent 5ed5e1170e
commit 4a433d32f7

View File

@ -1,16 +1,20 @@
package org.openpilot.androidgcs; package org.openpilot.androidgcs;
import org.openpilot.androidgcs.util.SmartSave;
import org.openpilot.androidgcs.views.ScrollBarView;
import org.openpilot.uavtalk.UAVDataObject; import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.widget.Button;
public class TuningActivity extends ObjectManagerActivity { public class TuningActivity extends ObjectManagerActivity {
private final String TAG = TuningActivity.class.getSimpleName(); private final String TAG = TuningActivity.class.getSimpleName();
private final boolean DEBUG = false; private final boolean DEBUG = false;
private SmartSave smartSave;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -26,18 +30,17 @@ public class TuningActivity extends ObjectManagerActivity {
// Subscribe to updates from ManualControlCommand and show the values for crude feedback // Subscribe to updates from ManualControlCommand and show the values for crude feedback
UAVDataObject stabilizationSettings = (UAVDataObject) objMngr.getObject("StabilizationSettings"); UAVDataObject stabilizationSettings = (UAVDataObject) objMngr.getObject("StabilizationSettings");
if (stabilizationSettings != null)
registerObjectUpdates(stabilizationSettings);
}
/** smartSave = new SmartSave(objMngr, stabilizationSettings,
* Show the string description of manual control command (Button) findViewById(R.id.saveBtn),
*/ (Button) findViewById(R.id.applyBtn));
@Override
protected void objectUpdated(UAVObject obj) {
if (obj.getName().compareTo("StabilizationSettings") == 0) {
} smartSave.addControlMapping((ScrollBarView) findViewById(R.id.rollRateKp), "RollRatePID", 0);
smartSave.addControlMapping((ScrollBarView) findViewById(R.id.rollRateKi), "RollRatePID", 1);
smartSave.addControlMapping((ScrollBarView) findViewById(R.id.pitchRateKp), "PitchRatePID", 0);
smartSave.addControlMapping((ScrollBarView) findViewById(R.id.pitchRateKi), "PitchRatePID", 1);
smartSave.addControlMapping((ScrollBarView) findViewById(R.id.rollKp), "RollPI", 0);
smartSave.addControlMapping((ScrollBarView) findViewById(R.id.pitchKp), "PitchPI", 0);
} }
} }