return sensor / 32767.0 * supply * 127/27;
}
- static double tele_gps_voltage(int sensor) {
+ static double tele_gps_1_voltage(int sensor) {
+ double supply = 3.3;
+
+ return sensor / 32767.0 * supply * (5.6 + 10.0) / 10.0;
+ }
+
+ static double tele_gps_2_voltage(int sensor) {
double supply = 3.3;
return sensor / 4095.0 * supply * (5.6 + 10.0) / 10.0;
static final int idle_sensor_emini1 = 13;
static final int idle_sensor_emini2 = 14;
static final int idle_sensor_tmini2 = 15;
- static final int idle_sensor_tgps = 16;
- static final int idle_sensor_tmini3 = 17;
+ static final int idle_sensor_tgps1 = 16;
+ static final int idle_sensor_tgps2 = 17;
+ static final int idle_sensor_tmini3 = 18;
public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException, TimeoutException, AltosUnknownProduct {
for (int idler : idlers) {
case idle_sensor_tmini2:
AltosSensorTMini2.provide_data(listener, link);
break;
- case idle_sensor_tgps:
- AltosSensorTGPS.provide_data(listener, link);
+ case idle_sensor_tgps1:
+ AltosSensorTGPS1.provide_data(listener, link);
+ break;
+ case idle_sensor_tgps2:
+ AltosSensorTGPS2.provide_data(listener, link);
break;
case idle_sensor_tmini3:
AltosSensorTMini3.provide_data(listener, link);
AltosIdler.idle_ms5607,
AltosIdler.idle_imu,
AltosIdler.idle_sensor_mega),
- new AltosIdler("TeleGPS",
+ new AltosIdler("TeleGPS-v1",
+ AltosIdler.idle_gps,
+ AltosIdler.idle_sensor_tgps1),
+ new AltosIdler("TeleGPS-v2",
AltosIdler.idle_gps,
- AltosIdler.idle_sensor_tgps),
+ AltosIdler.idle_sensor_tgps2),
};
AltosLink link;
+++ /dev/null
-/*
- * Copyright © 2015 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_13;
-
-import java.util.concurrent.TimeoutException;
-
-public class AltosSensorTGPS {
- public int tick;
- public int batt;
-
- static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException {
- try {
- AltosSensorTGPS sensor_tgps = new AltosSensorTGPS(link);
-
- if (sensor_tgps == null)
- return;
- listener.set_battery_voltage(AltosConvert.tele_gps_voltage(sensor_tgps.batt));
-
- } catch (TimeoutException te) {
- }
- }
-
- public AltosSensorTGPS(AltosLink link) throws InterruptedException, TimeoutException {
- String[] items = link.adc();
- for (int i = 0; i < items.length - 1;) {
- if (items[i].equals("tick:")) {
- tick = Integer.parseInt(items[i+1]);
- i += 2;
- continue;
- }
- if (items[i].equals("batt:")) {
- batt = Integer.parseInt(items[i+1]);
- i += 2;
- continue;
- }
- i++;
- }
- }
-}
-
--- /dev/null
+/*
+ * Copyright © 2015 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_13;
+
+import java.util.concurrent.TimeoutException;
+
+public class AltosSensorTGPS1 {
+ public int tick;
+ public int batt;
+
+ static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException {
+ try {
+ AltosSensorTGPS1 sensor_tgps = new AltosSensorTGPS1(link);
+
+ if (sensor_tgps == null)
+ return;
+ listener.set_battery_voltage(AltosConvert.tele_gps_1_voltage(sensor_tgps.batt));
+
+ } catch (TimeoutException te) {
+ }
+ }
+
+ public AltosSensorTGPS1(AltosLink link) throws InterruptedException, TimeoutException {
+ String[] items = link.adc();
+ for (int i = 0; i < items.length - 1;) {
+ if (items[i].equals("tick:")) {
+ tick = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("batt:")) {
+ batt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ i++;
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright © 2015 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altoslib_13;
+
+import java.util.concurrent.TimeoutException;
+
+public class AltosSensorTGPS2 {
+ public int tick;
+ public int batt;
+
+ static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException {
+ try {
+ AltosSensorTGPS2 sensor_tgps = new AltosSensorTGPS2(link);
+
+ if (sensor_tgps == null)
+ return;
+ listener.set_battery_voltage(AltosConvert.tele_gps_2_voltage(sensor_tgps.batt));
+
+ } catch (TimeoutException te) {
+ }
+ }
+
+ public AltosSensorTGPS2(AltosLink link) throws InterruptedException, TimeoutException {
+ String[] items = link.adc();
+ for (int i = 0; i < items.length - 1;) {
+ if (items[i].equals("tick:")) {
+ tick = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("batt:")) {
+ batt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ i++;
+ }
+ }
+}
+
listener.set_device_type(device_type());
cal_data.set_flight(flight());
cal_data.set_config(config_major(), config_minor(), flight_log_max());
- if (device_type() == AltosLib.product_telegps)
- listener.set_battery_voltage(AltosConvert.tele_gps_voltage(v_batt()));
- else
+ if (device_type() == AltosLib.product_telegps) {
+ int v_batt = v_batt();
+ double batt;
+ if (v_batt > 4095)
+ batt = AltosConvert.tele_gps_1_voltage(v_batt);
+ else
+ batt = AltosConvert.tele_gps_2_voltage(v_batt);
+ listener.set_battery_voltage(batt);
+ } else
cal_data.set_flight_params(apogee_delay() / 100.0, main_deploy());
cal_data.set_callsign(callsign());
AltosSensorTMini3.java \
AltosSensorMega.java \
AltosSensorMetrum.java \
- AltosSensorTGPS.java \
+ AltosSensorTGPS1.java \
+ AltosSensorTGPS2.java \
AltosState.java \
AltosStateName.java \
AltosStringInputStream.java \