1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Enable some debugging statements

This commit is contained in:
James Cotton 2012-05-10 11:59:50 -05:00
parent c1c12ed57e
commit 9d7c15fb7f
4 changed files with 16 additions and 11 deletions

View File

@ -17,7 +17,7 @@ public class TcpUAVTalk {
public static boolean DEBUG = LOGLEVEL > 0; public static boolean DEBUG = LOGLEVEL > 0;
// Temporarily define fixed device name // Temporarily define fixed device name
public final static String IP_ADDRESS = "127.0.0.1"; public final static String IP_ADDRESS = "10.21.18.120";
public final static int PORT = 9001; public final static int PORT = 9001;
private UAVTalk uavTalk; private UAVTalk uavTalk;
@ -47,7 +47,7 @@ public class TcpUAVTalk {
private boolean openTelemetryTcp(UAVObjectManager objMngr) { private boolean openTelemetryTcp(UAVObjectManager objMngr) {
Log.d(TAG, "Opening conncetion to " + IP_ADDRESS); Log.d(TAG, "Opening conncetion to " + IP_ADDRESS + " at address " + PORT);
InetAddress serverAddr = null; InetAddress serverAddr = null;
try { try {

View File

@ -17,7 +17,7 @@ import android.util.Log;
public class Telemetry { public class Telemetry {
private final String TAG = "Telemetry"; private final String TAG = "Telemetry";
public static int LOGLEVEL = 0; public static int LOGLEVEL = 2;
public static boolean WARN = LOGLEVEL > 1; public static boolean WARN = LOGLEVEL > 1;
public static boolean DEBUG = LOGLEVEL > 0; public static boolean DEBUG = LOGLEVEL > 0;

View File

@ -185,7 +185,8 @@ public class TelemetryMonitor extends Observable{
// Force update if not yet connected // Force update if not yet connected
gcsStatsObj = objMngr.getObject("GCSTelemetryStats"); gcsStatsObj = objMngr.getObject("GCSTelemetryStats");
flightStatsObj = objMngr.getObject("FlightTelemetryStats"); flightStatsObj = objMngr.getObject("FlightTelemetryStats");
if (DEBUG) Log.d(TAG,"GCS Status: " + gcsStatsObj.getField("Status").getValue());
if (DEBUG) Log.d(TAG,"Flight Status: " + flightStatsObj.getField("Status").getValue());
if ( ((String) gcsStatsObj.getField("Status").getValue()).compareTo("Connected") != 0 || if ( ((String) gcsStatsObj.getField("Status").getValue()).compareTo("Connected") != 0 ||
((String) flightStatsObj.getField("Status").getValue()).compareTo("Connected") == 0 ) ((String) flightStatsObj.getField("Status").getValue()).compareTo("Connected") == 0 )
{ {

View File

@ -12,7 +12,7 @@ import android.util.Log;
public class UAVTalk extends Observable { public class UAVTalk extends Observable {
static final String TAG = "UAVTalk"; static final String TAG = "UAVTalk";
public static int LOGLEVEL = 0; public static int LOGLEVEL = 2;
public static boolean WARN = LOGLEVEL > 1; public static boolean WARN = LOGLEVEL > 1;
public static boolean DEBUG = LOGLEVEL > 0; public static boolean DEBUG = LOGLEVEL > 0;
@ -433,6 +433,7 @@ public class UAVTalk extends Observable {
rxCSPacket = rxbyte; rxCSPacket = rxbyte;
if (rxCS != rxCSPacket) { // packet error - faulty CRC if (rxCS != rxCSPacket) { // packet error - faulty CRC
if (DEBUG) Log.d(TAG,"Bad crc");
stats.rxErrors++; stats.rxErrors++;
rxState = RxStateType.STATE_SYNC; rxState = RxStateType.STATE_SYNC;
break; break;
@ -441,11 +442,14 @@ public class UAVTalk extends Observable {
if (rxPacketLength != (packetSize + 1)) { // packet error - if (rxPacketLength != (packetSize + 1)) { // packet error -
// mismatched packet // mismatched packet
// size // size
if (DEBUG) Log.d(TAG,"Bad size");
stats.rxErrors++; stats.rxErrors++;
rxState = RxStateType.STATE_SYNC; rxState = RxStateType.STATE_SYNC;
break; break;
} }
if (DEBUG) Log.d(TAG,"Received");
rxBuffer.position(0); rxBuffer.position(0);
receiveObject(rxType, rxObjId, rxInstId, rxBuffer); receiveObject(rxType, rxObjId, rxInstId, rxBuffer);
stats.rxObjectBytes += rxLength; stats.rxObjectBytes += rxLength;
@ -500,8 +504,8 @@ public class UAVTalk extends Observable {
case TYPE_OBJ_ACK: case TYPE_OBJ_ACK:
// All instances, not allowed for OBJ_ACK messages // All instances, not allowed for OBJ_ACK messages
if (!allInstances) { if (!allInstances) {
// System.out.println("Received object ack: " + objId + " " + System.out.println("Received object ack: " + objId + " " +
// objMngr.getObject(objId).getName()); objMngr.getObject(objId).getName());
// Get object and update its data // Get object and update its data
obj = updateObject(objId, instId, data); obj = updateObject(objId, instId, data);
// Transmit ACK // Transmit ACK
@ -517,8 +521,8 @@ public class UAVTalk extends Observable {
case TYPE_OBJ_REQ: case TYPE_OBJ_REQ:
// Get object, if all instances are requested get instance 0 of the // Get object, if all instances are requested get instance 0 of the
// object // object
// System.out.println("Received object request: " + objId + " " + System.out.println("Received object request: " + objId + " " +
// objMngr.getObject(objId).getName()); objMngr.getObject(objId).getName());
if (allInstances) { if (allInstances) {
obj = objMngr.getObject(objId); obj = objMngr.getObject(objId);
} else { } else {
@ -534,8 +538,8 @@ public class UAVTalk extends Observable {
case TYPE_ACK: case TYPE_ACK:
// All instances, not allowed for ACK messages // All instances, not allowed for ACK messages
if (!allInstances) { if (!allInstances) {
// System.out.println("Received ack: " + objId + " " + System.out.println("Received ack: " + objId + " " +
// objMngr.getObject(objId).getName()); objMngr.getObject(objId).getName());
// Get object // Get object
obj = objMngr.getObject(objId, instId); obj = objMngr.getObject(objId, instId);
// Check if an ack is pending // Check if an ack is pending