case imu_type_easymega_v2:
return counts_per_g_mpu;
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return counts_per_g_bmx;
default:
return AltosLib.MISSING;
case imu_type_easymega_v1:
case imu_type_easymega_v2:
return counts_per_degree_mpu;
- case imu_type_telemega_v4:
+ case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return counts_per_degree_bmx;
default:
return AltosLib.MISSING;
case imu_type_easymega_v2:
return counts_per_gauss_mpu;
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return 100.0;
default:
return AltosLib.MISSING;
public static final int imu_type_easymega_v1 = 3; /* MPU6000 */
public static final int imu_type_easymega_v2 = 4; /* MPU9250 */
+ public static final int imu_type_easytimer_v1 = 5; /* BMX160 */
+
private int accel_across(int imu_type) {
switch (imu_type) {
case imu_type_telemega_v1_v2:
return accel_x;
case imu_type_easymega_v2:
return -accel_y;
- case imu_type_telemega_v4:
+ case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return -accel_y;
default:
return AltosLib.MISSING;
return accel_y;
case imu_type_easymega_v2:
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return accel_x;
default:
return AltosLib.MISSING;
return gyro_y;
case imu_type_easymega_v2:
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return gyro_x;
default:
return AltosLib.MISSING;
case imu_type_easymega_v2:
return -gyro_y;
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return -gyro_y;
default:
return AltosLib.MISSING;
case imu_type_telemega_v3:
case imu_type_easymega_v1:
return imu_axis_x;
- case imu_type_telemega_v4:
case imu_type_easymega_v2:
+ case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return imu_axis_y;
default:
return AltosLib.MISSING;
case imu_type_easymega_v2:
return -mag_y;
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return mag_y;
default:
return AltosLib.MISSING;
return imu_axis_y;
case imu_type_easymega_v2:
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return imu_axis_x;
default:
return AltosLib.MISSING;
return mag_y;
case imu_type_easymega_v2:
case imu_type_telemega_v4:
+ case imu_type_easytimer_v1:
return mag_x;
default:
return AltosLib.MISSING;
static final int idle_imu_tm_v4 = 3;
static final int idle_imu_em_v1 = 4;
static final int idle_imu_em_v2 = 5;
- static final int idle_mag = 6;
- static final int idle_mma655x = 7;
- static final int idle_ms5607 = 8;
- static final int idle_adxl375 = 9;
-
- static final int idle_sensor_tm = 10;
- static final int idle_sensor_metrum = 11;
- static final int idle_sensor_mega = 12;
- 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_tgps1 = 16;
- static final int idle_sensor_tgps2 = 17;
- static final int idle_sensor_tmini3 = 18;
+ static final int idle_imu_et_v1 = 6;
+ static final int idle_mag = 7;
+ static final int idle_mma655x = 8;
+ static final int idle_ms5607 = 9;
+ static final int idle_adxl375 = 10;
+
+ static final int idle_sensor_tm = 100;
+ static final int idle_sensor_metrum = 101;
+ static final int idle_sensor_mega = 102;
+ static final int idle_sensor_emini1 = 103;
+ static final int idle_sensor_emini2 = 104;
+ static final int idle_sensor_tmini2 = 105;
+ static final int idle_sensor_tgps1 = 106;
+ static final int idle_sensor_tgps2 = 107;
+ static final int idle_sensor_tmini3 = 108;
+ static final int idle_sensor_easytimer1 = 109;
public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException, TimeoutException, AltosUnknownProduct {
for (int idler : idlers) {
case idle_imu_em_v2:
AltosIMU.provide_data(listener, link, AltosIMU.imu_type_easymega_v2);
break;
+ case idle_imu_et_v1:
+ AltosIMU.provide_data(listener, link, AltosIMU.imu_type_easytimer_v1);
+ break;
case idle_mag:
AltosMag.provide_data(listener, link);
break;
case idle_sensor_tmini3:
AltosSensorTMini3.provide_data(listener, link);
break;
+ case idle_sensor_easytimer1:
+ AltosSensorEasyTimer1.provide_data(listener, link);
+ break;
}
}
}
new AltosIdler("TeleGPS-v2",
AltosIdler.idle_gps,
AltosIdler.idle_sensor_tgps2),
+ new AltosIdler("EasyTimer-v1",
+ AltosIdler.idle_imu_et_v1,
+ AltosIdler.idle_sensor_easytimer1),
};
AltosLink link;
--- /dev/null
+/*
+ * Copyright © 2020 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_14;
+
+import java.util.concurrent.TimeoutException;
+
+class AltosSensorEasyTimer1 {
+ int tick;
+ int[] sense;
+ int v_batt;
+ int v_pbatt;
+ int temp;
+
+ public AltosSensorEasyTimer1() {
+ sense = new int[2];
+ }
+
+ public AltosSensorEasyTimer1(AltosLink link) throws InterruptedException, TimeoutException {
+ this();
+ String[] items = link.adc();
+ for (int i = 0; i < items.length;) {
+ if (items[i].equals("tick:")) {
+ tick = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("A:")) {
+ sense[0] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("B:")) {
+ sense[1] = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("batt:")) {
+ v_batt = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ i++;
+ }
+ }
+
+ static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException {
+ try {
+ AltosSensorEasyTimer1 sensor_easytimer1 = new AltosSensorEasyTimer1(link);
+
+ listener.set_battery_voltage(AltosConvert.mega_battery_voltage(sensor_easytimer1.v_batt));
+
+ double[] igniter_voltage = new double[2];
+ for (int i = 0; i < 2; i++)
+ igniter_voltage[i] = AltosConvert.mega_pyro_voltage(sensor_easytimer1.sense[i]);
+ listener.set_igniter_voltage(igniter_voltage);
+
+ } catch (TimeoutException te) {
+ }
+ }
+}
+
AltosUsbId.java \
AltosSensorMM.java \
AltosSensorEMini.java \
+ AltosSensorEasyTimer1.java \
AltosSensorTM.java \
AltosSensorTMini2.java \
AltosSensorTMini3.java \