mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
Fixed some timer issues. Got connection with this.
This commit is contained in:
parent
03b9bbbb8a
commit
06f583ff75
@ -101,7 +101,14 @@ public class Telemetry {
|
||||
}
|
||||
|
||||
synchronized void transTimerSetPeriod(int periodMs) {
|
||||
transTimer = new Timer();
|
||||
if(transTimerTask != null)
|
||||
transTimerTask.cancel();
|
||||
|
||||
if(transTimer != null)
|
||||
transTimer.purge();
|
||||
|
||||
transTimer = new Timer();
|
||||
|
||||
transTimerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -164,7 +164,6 @@ public class TelemetryMonitor {
|
||||
gcsStatsObj = objMngr.getObject("GCSTelemetryStats");
|
||||
flightStatsObj = objMngr.getObject("FlightTelemetryStats");
|
||||
|
||||
System.out.println(flightStatsObj.toString());
|
||||
if ( ((String) gcsStatsObj.getField("Status").getValue()).compareTo("Connected") != 0 ||
|
||||
((String) flightStatsObj.getField("Status").getValue()).compareTo("Connected") == 0 )
|
||||
{
|
||||
@ -250,8 +249,6 @@ public class TelemetryMonitor {
|
||||
boolean gcsConnected = ((String) statusField.getValue()).compareTo("Connected") == 0;
|
||||
boolean gcsDisconnected = ((String) statusField.getValue()).compareTo("Disconnected") == 0;
|
||||
|
||||
if(gcsConnected)
|
||||
System.out.println("Detected here");
|
||||
if ( gcsStatusChanged ||
|
||||
((String) flightStatsObj.getField("Status").getValue()).compareTo("Disconnected") != 0 )
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ public class UAVTalk extends Observable{
|
||||
break;
|
||||
}
|
||||
|
||||
System.out.println("Received byte " + val + " in state + " + rxState);
|
||||
//System.out.println("Received byte " + val + " in state + " + rxState);
|
||||
processInputByte(val);
|
||||
}
|
||||
}
|
||||
@ -423,7 +423,6 @@ public class UAVTalk extends Observable{
|
||||
// Update CRC
|
||||
rxCS = updateCRC(rxCS, rxbyte);
|
||||
|
||||
//System.out.println(rxCount + "/" + rxLength);
|
||||
rxBuffer.put(rxCount++, (byte) (rxbyte & 0xff));
|
||||
if (rxCount < rxLength)
|
||||
break;
|
||||
@ -491,7 +490,7 @@ public class UAVTalk extends Observable{
|
||||
// All instances, not allowed for OBJ messages
|
||||
if (!allInstances)
|
||||
{
|
||||
System.out.println("Received object: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
System.out.println("Received object: " + objMngr.getObject(objId).getName());
|
||||
// Get object and update its data
|
||||
obj = updateObject(objId, instId, data);
|
||||
// Check if an ack is pending
|
||||
@ -513,7 +512,7 @@ public class UAVTalk extends Observable{
|
||||
// All instances, not allowed for OBJ_ACK messages
|
||||
if (!allInstances)
|
||||
{
|
||||
System.out.println("Received object ack: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
// System.out.println("Received object ack: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
// Get object and update its data
|
||||
obj = updateObject(objId, instId, data);
|
||||
// Transmit ACK
|
||||
@ -533,7 +532,7 @@ public class UAVTalk extends Observable{
|
||||
break;
|
||||
case TYPE_OBJ_REQ:
|
||||
// Get object, if all instances are requested get instance 0 of the object
|
||||
System.out.println("Received object request: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
// System.out.println("Received object request: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
if (allInstances)
|
||||
{
|
||||
obj = objMngr.getObject(objId);
|
||||
@ -556,7 +555,7 @@ public class UAVTalk extends Observable{
|
||||
// All instances, not allowed for ACK messages
|
||||
if (!allInstances)
|
||||
{
|
||||
System.out.println("Received ack: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
// System.out.println("Received ack: " + objId + " " + objMngr.getObject(objId).getName());
|
||||
// Get object
|
||||
obj = objMngr.getObject(objId, instId);
|
||||
// Check if an ack is pending
|
||||
@ -617,14 +616,14 @@ public class UAVTalk extends Observable{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Unpacking new object");
|
||||
// System.out.println("Unpacking new object");
|
||||
instobj.unpack(data);
|
||||
return instobj;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unpack data into object instance
|
||||
System.out.println("Unpacking existing object: " + data.position() + " / " + data.capacity() );
|
||||
// System.out.println("Unpacking existing object: " + data.position() + " / " + data.capacity() );
|
||||
obj.unpack(data);
|
||||
return obj;
|
||||
}
|
||||
@ -772,7 +771,6 @@ public class UAVTalk extends Observable{
|
||||
bbuf.position(0);
|
||||
byte [] dst = new byte[packlen];
|
||||
bbuf.get(dst,0,packlen);
|
||||
System.out.println("Outputting: " + dst.length);
|
||||
outStream.write(dst);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
Loading…
x
Reference in New Issue
Block a user