1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

AndroidGCS: In the SystemAlarms display rank fields by alarm severity. Also

make hte fake telemetry object generate alarms.
This commit is contained in:
James Cotton 2012-08-06 13:52:42 -05:00
parent a3038af4ad
commit 19b5cf4616
3 changed files with 21 additions and 5 deletions

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:layout_gravity="center" >
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/system_alarms_status"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
android:layout_height="fill_parent"
android:layout_gravity="center" />
</LinearLayout>

View File

@ -228,7 +228,14 @@ public class OPTelemetryService extends Service {
UAVDataObject attitudeActual = (UAVDataObject) objMngr.getObject("AttitudeActual");
UAVDataObject homeLocation = (UAVDataObject) objMngr.getObject("HomeLocation");
UAVDataObject positionActual = (UAVDataObject) objMngr.getObject("PositionActual");
UAVDataObject systemAlarms = (UAVDataObject) objMngr.getObject("SystemAlarms");
systemAlarms.getField("Alarm").setValue("Warning",0);
systemAlarms.getField("Alarm").setValue("OK",1);
systemAlarms.getField("Alarm").setValue("Critical",2);
systemAlarms.getField("Alarm").setValue("Error",3);
systemAlarms.updated();
homeLocation.getField("Latitude").setDouble(379420315);
homeLocation.getField("Longitude").setDouble(-88330078);
homeLocation.getField("Be").setDouble(26702.78710938,0);
@ -250,6 +257,7 @@ public class OPTelemetryService extends Service {
roll = (roll + 10) % 180;
pitch = (pitch + 10) % 180;
yaw = (yaw + 10) % 360;
systemStats.updated();
attitudeActual.updated();
positionActual.updated();

View File

@ -20,8 +20,14 @@ public class SystemAlarmActivity extends ObjectManagerActivity {
UAVObjectField a = obj.getField("Alarm");
List<String> names = a.getElementNames();
String contents = new String();
for (int i = 0; i < names.size(); i++) {
contents += names.get(i) + " : " + a.getValue(i).toString() + "\n";
List <String> options = a.getOptions();
// Rank the alarms by order of severity, skip uninitialized
for (int j = options.size() - 1; j > 0; j--) {
for (int i = 0; i < names.size(); i++) {
if(a.getDouble(i) == j)
contents += names.get(i) + " : " + a.getValue(i).toString() + "\n";
}
}
alarms.setText(contents);
}