1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

AndroidGCS: Remove an unnecessary check that was triggering false positive telemetry errors

This commit is contained in:
James Cotton 2012-10-14 19:43:58 -05:00
parent d975a65f65
commit f94f187528
2 changed files with 16 additions and 21 deletions

View File

@ -50,7 +50,7 @@ public class TelemetryMonitor extends Observable {
static final int STATS_CONNECT_PERIOD_MS = 1000;
static final int CONNECTION_TIMEOUT_MS = 8000;
private final boolean HANDSHAKE_IS_CONNECTED = false;
private final boolean HANDSHAKE_IS_CONNECTED = true;
private final UAVObjectManager objMngr;
private final Telemetry tel;
@ -77,7 +77,8 @@ public class TelemetryMonitor extends Observable {
return objects_updated;
};
public TelemetryMonitor(UAVObjectManager objMngr, Telemetry tel, OPTelemetryService s) {
public TelemetryMonitor(UAVObjectManager objMngr, Telemetry tel,
OPTelemetryService s) {
this(objMngr, tel);
telemService = s;
}
@ -373,7 +374,9 @@ public class TelemetryMonitor extends Observable {
startRetrievingObjects();
else
firmwareIapObj.updateRequested();
if (HANDSHAKE_IS_CONNECTED) setChanged(); // Enabling this line makes the opConnected signal occur whenever we get a handshake
if (HANDSHAKE_IS_CONNECTED)
setChanged(); // Enabling this line makes the opConnected signal
// occur whenever we get a handshake
}
if (gcsDisconnected && gcsStatusChanged) {
if (DEBUG)
@ -429,7 +432,8 @@ public class TelemetryMonitor extends Observable {
final int HASH_SIZE_USED = 8;
String jarName = new String();
for (int i = 0; i < HASH_SIZE_USED; i++)
jarName += Integer.toHexString((int) description.getDouble(i+60));
jarName += Integer.toHexString((int) description
.getDouble(i + 60));
jarName += ".jar";
if (DEBUG) Log.d(TAG, "Attempting to load: " + jarName);
if (telemService.loadUavobjects(jarName, objMngr)) {

View File

@ -418,7 +418,7 @@ public class UAVTalk {
{
UAVObject rxObj = objMngr.getObject(rxObjId);
if (rxObj == null) {
if (DEBUG) Log.d(TAG, "Unknown ID: " + rxObjId);
if (WARN) Log.w(TAG, "Unknown ID: " + rxObjId);
stats.rxErrors++;
rxState = RxStateType.STATE_SYNC;
break;
@ -432,17 +432,7 @@ public class UAVTalk {
// Check length and determine next state
if (rxLength >= MAX_PAYLOAD_LENGTH) {
stats.rxErrors++;
rxState = RxStateType.STATE_SYNC;
break;
}
// Check the lengths match
if ((rxPacketLength + rxLength) != packetSize) { // packet error
// -
// mismatched
// packet
// size
if (WARN) Log.w(TAG, "Greater than max payload length");
stats.rxErrors++;
rxState = RxStateType.STATE_SYNC;
break;
@ -506,7 +496,7 @@ public class UAVTalk {
rxCSPacket = rxbyte;
if (rxCS != rxCSPacket) { // packet error - faulty CRC
if (DEBUG) Log.d(TAG,"Bad crc");
if (WARN) Log.w(TAG,"Bad crc");
stats.rxErrors++;
rxState = RxStateType.STATE_SYNC;
break;
@ -515,7 +505,7 @@ public class UAVTalk {
if (rxPacketLength != (packetSize + 1)) { // packet error -
// mismatched packet
// size
if (DEBUG) Log.d(TAG,"Bad size");
if (WARN) Log.w(TAG,"Bad size");
stats.rxErrors++;
rxState = RxStateType.STATE_SYNC;
break;
@ -532,6 +522,7 @@ public class UAVTalk {
break;
default:
if (WARN) Log.w(TAG, "Bad state");
rxState = RxStateType.STATE_SYNC;
stats.rxErrors++;
}