summaryrefslogtreecommitdiff
path: root/altoslib/AltosIdleFetch.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-05-02 16:13:53 -0700
committerKeith Packard <keithp@keithp.com>2016-05-02 16:18:54 -0700
commit0b0b359cbce6b818257b44b2a6aee0edcbaee40d (patch)
tree38840d0a2addfdaa00bbd46a8980f6e31066afe0 /altoslib/AltosIdleFetch.java
parent1a797f5fd5d25ba635fd79ad7604763253caabf2 (diff)
altoslib: Deal with TeleMetrum v2.0 MMA6555 being inverted
Dumping the MMA655X data with the 'A' command provides the raw sensor value. On TM v2.0 boards, the sensor is inverted, and all of the firmware uses the inverted value except for the 'dump the raw data' command. As a result, MonitorIdle was using the un-inverted value and displaying mystic values. I've fixed this in the ground station code by checking the product name and conditionally inverting the value (4095 - value) for TeleMetrum v2.0 products. Unknown products will generate a warning dialog on AltosUI so we'll catch places where we've failed to add a new product name. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosIdleFetch.java')
-rw-r--r--altoslib/AltosIdleFetch.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java
index 3e96f3b8..0095bb73 100644
--- a/altoslib/AltosIdleFetch.java
+++ b/altoslib/AltosIdleFetch.java
@@ -40,7 +40,7 @@ class AltosIdler {
static final int idle_sensor_tmini = 14;
static final int idle_sensor_tgps = 15;
- public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
+ public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException, AltosUnknownProduct {
for (int idler : idlers) {
AltosIdle idle = null;
switch (idler) {
@@ -137,8 +137,9 @@ public class AltosIdleFetch implements AltosStateUpdate {
double frequency;
String callsign;
- public void update_state(AltosState state) throws InterruptedException {
+ public void update_state(AltosState state) throws InterruptedException, AltosUnknownProduct {
try {
+ boolean matched = false;
/* Fetch config data from remote */
AltosConfigData config_data = new AltosConfigData(link);
state.set_state(AltosLib.ao_flight_stateless);
@@ -150,9 +151,12 @@ public class AltosIdleFetch implements AltosStateUpdate {
for (AltosIdler idler : idlers) {
if (idler.matches(config_data)) {
idler.update_state(state, link, config_data);
+ matched = true;
break;
}
}
+ if (!matched)
+ throw new AltosUnknownProduct(config_data.product);
state.set_received_time(System.currentTimeMillis());
} catch (TimeoutException te) {
}