X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosConfigData.java;h=18815cf4b26a86b3c8ccec7f23b5ba2944dbb73e;hb=6cb7457b87913d5f18b6b87d401b2782d8f665a4;hp=bb7f5bcc374a8ef725df606761dae2607a3b5d52;hpb=ceca79d6b20cf623e7a7214e400347fc0bc019dd;p=fw%2Faltos diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index bb7f5bcc..18815cf4 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -83,6 +83,9 @@ public class AltosConfigData { /* HAS_BEEP */ public int beep; + /* HAS_RADIO_10MW */ + public int radio_10mw; + /* Storage info replies */ public int storage_size; public int storage_erase_unit; @@ -199,10 +202,18 @@ public class AltosConfigData { case AltosLib.AO_LOG_FORMAT_FULL: return 0x7fff - value; case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: - case AltosLib.AO_LOG_FORMAT_TELEMETRUM: case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: return 4095 - value; + case AltosLib.AO_LOG_FORMAT_TELEMETRUM: + /* + * TeleMetrum v2 and later use the same log format, but + * have different accelerometers. This is the only place + * it matters in altoslib. + */ + if (product.startsWith("TeleMetrum-v2")) + return 4095 - value; + /* fall through */ case AltosLib.AO_LOG_FORMAT_TELEMEGA_4: case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: case AltosLib.AO_LOG_FORMAT_EASYMOTOR: @@ -215,6 +226,8 @@ public class AltosConfigData { } public boolean has_monitor_battery() { + if (product == null) + return false; if (product.startsWith("TeleBT")) return true; return false; @@ -305,6 +318,8 @@ public class AltosConfigData { beep = AltosLib.MISSING; + radio_10mw = AltosLib.MISSING; + tracker_motion = AltosLib.MISSING; tracker_interval = AltosLib.MISSING; @@ -321,6 +336,9 @@ public class AltosConfigData { /* Return + accel calibration relative to a specific pad orientation */ public int accel_cal_plus(int pad_orientation) { adjust_accel_cal(); + if (!accel_cal_adjusted) + return AltosLib.MISSING; + switch (pad_orientation) { case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP: case AltosLib.AO_PAD_ORIENTATION_WORDS_UPRIGHT: @@ -338,6 +356,9 @@ public class AltosConfigData { /* Return - accel calibration relative to a specific pad orientation */ public int accel_cal_minus(int pad_orientation) { adjust_accel_cal(); + if (!accel_cal_adjusted) + return AltosLib.MISSING; + switch (pad_orientation) { case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP: case AltosLib.AO_PAD_ORIENTATION_WORDS_UPRIGHT: @@ -357,6 +378,7 @@ public class AltosConfigData { */ private void adjust_accel_cal() { if (!accel_cal_adjusted && + product != null && pad_orientation != AltosLib.MISSING && accel_cal_plus != AltosLib.MISSING && accel_cal_minus != AltosLib.MISSING) @@ -488,6 +510,9 @@ public class AltosConfigData { /* HAS_BEEP */ try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {} + /* HAS_RADIO_10MW */ + try { radio_10mw = get_int(line, "Radio 10mw limit:"); } catch (Exception e) {} + /* HAS_TRACKER */ try { int[] values = get_values(line, "Tracker setting:"); @@ -538,9 +563,6 @@ public class AltosConfigData { } } } catch (Exception e) {} - - /* Fix accel cal as soon as all of the necessary values appear */ - adjust_accel_cal(); } public AltosConfigData() { @@ -610,6 +632,8 @@ public class AltosConfigData { return false; if (product.startsWith("TeleMetrum-v3")) return false; + if (product.startsWith("TeleMetrum-v4")) + return true; if (product.startsWith("EasyMega")) return false; return true; @@ -636,6 +660,8 @@ public class AltosConfigData { return true; if (product.startsWith("TeleMetrum-v3")) return true; + if (product.startsWith("TeleMetrum-v4")) + return true; if (product.startsWith("TeleMega-v4")) return true; if (product.startsWith("EasyMotor-v2")) @@ -650,6 +676,8 @@ public class AltosConfigData { return AltosAdxl375.X_AXIS; if (product.startsWith("TeleMetrum-v3")) return AltosAdxl375.X_AXIS; + if (product.startsWith("TeleMetrum-v4")) + return AltosAdxl375.X_AXIS; if (product.startsWith("TeleMega-v4")) return AltosAdxl375.X_AXIS; if (product.startsWith("EasyMotor-v2")) @@ -716,6 +744,11 @@ public class AltosConfigData { /* HAS_BEEP */ if (beep != AltosLib.MISSING) beep = source.beep(); + + /* HAS_RADIO_10MW */ + if (radio_10mw != AltosLib.MISSING) + radio_10mw = source.radio_10mw(); + /* HAS_TRACKER */ if (tracker_motion != AltosLib.MISSING) tracker_motion = source.tracker_motion(); @@ -771,6 +804,7 @@ public class AltosConfigData { dest.set_aprs_format(aprs_format); dest.set_aprs_offset(aprs_offset); dest.set_beep(beep); + dest.set_radio_10mw(radio_10mw); dest.set_tracker_motion(tracker_motion); dest.set_tracker_interval(tracker_interval); } @@ -890,6 +924,10 @@ public class AltosConfigData { if (beep != AltosLib.MISSING) link.printf("c b %d\n", beep); + /* HAS_RADIO_10MW */ + if (radio_10mw != AltosLib.MISSING) + link.printf("c p %d\n", radio_10mw); + /* HAS_TRACKER */ if (tracker_motion != AltosLib.MISSING && tracker_interval != AltosLib.MISSING) link.printf("c t %d %d\n", tracker_motion, tracker_interval); @@ -914,5 +952,6 @@ public class AltosConfigData { read_link(link, "done"); break; } + adjust_accel_cal(); } }