static final int idle_sensor_metrum = 11;
static final int idle_sensor_mega = 12;
static final int idle_sensor_emini = 13;
+ static final int idle_sensor_tmini = 14;
public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
for (int idler : idlers) {
case idle_sensor_emini:
AltosSensorEMini.update_state(state, link, config_data);
break;
+ case idle_sensor_tmini:
+ AltosSensorTMini.update_state(state, link, config_data);
}
if (idle != null)
idle.update_state(state);
new AltosIdler("TeleMini-v2",
AltosIdler.idle_ms5607,
- AltosIdler.idle_sensor_tm),
+ AltosIdler.idle_sensor_tmini),
new AltosIdler("TeleMetrum-v1",
AltosIdler.idle_gps,
--- /dev/null
+/*
+ * Copyright © 2012 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; version 2 of the License.
+ *
+ * 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_2;
+
+import java.util.concurrent.TimeoutException;
+
+public class AltosSensorTMini {
+ public int tick;
+ public int apogee;
+ public int main;
+ public int batt;
+
+ static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) {
+ try {
+ AltosSensorTMini sensor_tmini = new AltosSensorTMini(link);
+
+ if (sensor_tmini == null)
+ return;
+ state.set_battery_voltage(AltosConvert.easy_mini_voltage(sensor_tmini.batt));
+ state.set_apogee_voltage(AltosConvert.easy_mini_voltage(sensor_tmini.apogee));
+ state.set_main_voltage(AltosConvert.easy_mini_voltage(sensor_tmini.main));
+
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ public AltosSensorTMini(AltosLink link) throws InterruptedException, TimeoutException {
+ 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("apogee:")) {
+ apogee = Integer.parseInt(items[i+1]);
+ i += 2;
+ continue;
+ }
+ if (items[i].equals("main:")) {
+ main = 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 © 2011 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; version 2 of the License.
+ *
+ * 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_2;
+
+
+public class AltosTelemetryMini extends AltosTelemetryStandard {
+ int state;
+
+ int v_batt;
+ int sense_a;
+ int sense_m;
+
+ int pres;
+ int temp;
+
+ int acceleration;
+ int speed;
+ int height;
+
+ int ground_pres;
+
+ public AltosTelemetryMini(int[] bytes) {
+ super(bytes);
+
+ state = int8(5);
+
+ v_batt = int16(6);
+ sense_a = int16(8);
+ sense_m = int16(10);
+
+ pres = int32(12);
+ temp = int16(16);
+
+ acceleration = int16(18);
+ speed = int16(20);
+ height = int16(22);
+
+ ground_pres = int32(24);
+ }
+
+ public void update_state(AltosState state) {
+ super.update_state(state);
+
+ state.set_state(this.state);
+
+ state.set_battery_voltage(AltosConvert.tele_mini_voltage(v_batt));
+ state.set_apogee_voltage(AltosConvert.tele_mini_voltage(sense_a));
+ state.set_main_voltage(AltosConvert.tele_mini_voltage(sense_m));
+
+ state.set_ground_pressure(ground_pres);
+
+ state.set_pressure(pres);
+ state.set_temperature(temp/100.0);
+
+ state.set_kalman(height, speed/16.0, acceleration/16.0);
+ }
+}
case packet_type_metrum_data:
telem = new AltosTelemetryMetrumData(bytes);
break;
+ case packet_type_mini:
+ telem = new AltosTelemetryMini(bytes);
+ break;
default:
telem = new AltosTelemetryRaw(bytes);
break;
AltosSensorMM.java \
AltosSensorEMini.java \
AltosSensorTM.java \
+ AltosSensorTMini.java \
AltosSensorMega.java \
AltosSensorMetrum.java \
AltosState.java \
AltosTelemetryMap.java \
AltosTelemetryMegaSensor.java \
AltosTelemetryMegaData.java \
+ AltosTelemetryMini.java \
AltosTelemetryMetrumSensor.java \
AltosTelemetryMetrumData.java \
AltosTelemetryReader.java \
telem.metrum_data.accel_plus_g,
telem.metrum_data.accel_minus_g);
break;
+ case AO_TELEMETRY_MINI:
+ printf ("state %1d v_batt %5d sense_a %5d sense_m %5d pres %9d temp %6.2f acceleration %6.2f speed %6.2f height %5d ground_pres %9d\n",
+ telem.mini.state,
+ telem.mini.v_batt,
+ telem.mini.sense_a,
+ telem.mini.sense_m,
+ telem.mini.pres,
+ telem.mini.temp / 100.0,
+ telem.mini.acceleration / 16.0,
+ telem.mini.speed / 16.0,
+ telem.mini.height,
+ telem.mini.ground_pres);
+ break;
default:
printf("\n");
}