mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
AndroidGCS Tuning: Connect the SmartSave button to the tuning page
This commit is contained in:
parent
5ed5e1170e
commit
4a433d32f7
@ -1,16 +1,20 @@
|
||||
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.UAVObject;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
|
||||
public class TuningActivity extends ObjectManagerActivity {
|
||||
private final String TAG = TuningActivity.class.getSimpleName();
|
||||
|
||||
private final boolean DEBUG = false;
|
||||
|
||||
private SmartSave smartSave;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
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
|
||||
UAVDataObject stabilizationSettings = (UAVDataObject) objMngr.getObject("StabilizationSettings");
|
||||
if (stabilizationSettings != null)
|
||||
registerObjectUpdates(stabilizationSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the string description of manual control command
|
||||
*/
|
||||
@Override
|
||||
protected void objectUpdated(UAVObject obj) {
|
||||
if (obj.getName().compareTo("StabilizationSettings") == 0) {
|
||||
smartSave = new SmartSave(objMngr, stabilizationSettings,
|
||||
(Button) findViewById(R.id.saveBtn),
|
||||
(Button) findViewById(R.id.applyBtn));
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user