New sensor (bmi088) support, plus other changes as needed. Also found
some places missing TeleMega-v5 support?
Signed-off-by: Keith Packard <keithp@keithp.com>
return 4095 - value;
/* fall through */
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
return 4095 - value;
/* fall through */
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_EASYMOTOR:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_EASYMOTOR:
return -value;
default:
if (product.startsWith("EasyTimer-"))
return -value;
default:
if (product.startsWith("EasyTimer-"))
return true;
if (product.startsWith("TeleMega-v4"))
return true;
return true;
if (product.startsWith("TeleMega-v4"))
return true;
+ if (product.startsWith("TeleMega-v5"))
+ return true;
+ if (product.startsWith("TeleMega-v6"))
+ return true;
if (product.startsWith("EasyMotor-v2"))
return true;
if (product.startsWith("EasyMotor-v3"))
if (product.startsWith("EasyMotor-v2"))
return true;
if (product.startsWith("EasyMotor-v3"))
return AltosAdxl375.X_AXIS;
if (product.startsWith("TeleMega-v4"))
return AltosAdxl375.X_AXIS;
return AltosAdxl375.X_AXIS;
if (product.startsWith("TeleMega-v4"))
return AltosAdxl375.X_AXIS;
+ if (product.startsWith("TeleMega-v5"))
+ return AltosAdxl375.X_AXIS;
+ if (product.startsWith("TeleMega-v6"))
+ return AltosAdxl375.X_AXIS;
if (product.startsWith("EasyMotor-v2"))
return AltosAdxl375.X_AXIS;
if (product.startsWith("EasyMotor-v3"))
if (product.startsWith("EasyMotor-v2"))
return AltosAdxl375.X_AXIS;
if (product.startsWith("EasyMotor-v3"))
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
return data32(16);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(14);
return data32(16);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(14);
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
return data32(20);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(16);
return data32(20);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(16);
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
return data32(24);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(18);
return data32(24);
case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
return data16(18);
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
return AltosLib.model_mpu6000;
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
return AltosLib.model_mpu6000;
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
+ return AltosLib.model_bmi088;
}
return AltosLib.MISSING;
}
}
return AltosLib.MISSING;
}
private boolean sensor_normalized() {
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
private boolean sensor_normalized() {
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
return true;
}
return false;
return true;
}
return false;
private int mag_model() {
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
private int mag_model() {
switch (log_format) {
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
return AltosLib.model_mmc5983;
}
return AltosLib.MISSING;
return AltosLib.model_mmc5983;
}
return AltosLib.MISSING;
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
case AltosLib.AO_LOG_FORMAT_EASYMEGA_2:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_4:
case AltosLib.AO_LOG_FORMAT_TELEMEGA_5:
+ case AltosLib.AO_LOG_FORMAT_TELEMEGA_6:
record = new AltosEepromRecordMega(eeprom);
break;
case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
record = new AltosEepromRecordMega(eeprom);
break;
case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
public static final double counts_per_g_mpu = 2048.0;
public static final double counts_per_g_bmx = 2048.0;
public static final double counts_per_g_adxl = 20.5;
public static final double counts_per_g_mpu = 2048.0;
public static final double counts_per_g_bmx = 2048.0;
public static final double counts_per_g_adxl = 20.5;
+ public static final double counts_per_g_bmi088 = 1365.0;
private static double counts_per_g(int imu_type, int imu_model) {
switch (imu_model) {
private static double counts_per_g(int imu_type, int imu_model) {
switch (imu_model) {
return counts_per_g_adxl;
case AltosLib.model_bmx160:
return counts_per_g_bmx;
return counts_per_g_adxl;
case AltosLib.model_bmx160:
return counts_per_g_bmx;
+ case AltosLib.model_bmi088:
+ return counts_per_g_bmi088;
public static final double GYRO_FULLSCALE_DEGREES_BMX = 2000.0;
public static final double GYRO_COUNTS_BMX = 32767.0;
public static final double counts_per_degree_bmx = GYRO_COUNTS_BMX / GYRO_FULLSCALE_DEGREES_BMX;
public static final double GYRO_FULLSCALE_DEGREES_BMX = 2000.0;
public static final double GYRO_COUNTS_BMX = 32767.0;
public static final double counts_per_degree_bmx = GYRO_COUNTS_BMX / GYRO_FULLSCALE_DEGREES_BMX;
+ public static final double counts_per_degree_bmi088 = 16.384;
private static double counts_per_degree(int imu_type, int imu_model) {
switch (imu_model) {
private static double counts_per_degree(int imu_type, int imu_model) {
switch (imu_model) {
return counts_per_degree_mpu;
case AltosLib.model_bmx160:
return counts_per_degree_bmx;
return counts_per_degree_mpu;
case AltosLib.model_bmx160:
return counts_per_degree_bmx;
+ case AltosLib.model_bmi088:
+ return counts_per_degree_bmi088;
+ if (line.startsWith("BMI088:")) {
+ String[] items = line.split("\\s+");
+
+ imu_model = AltosLib.model_bmi088;
+
+ if (items.length >= 7) {
+ accel_along = Integer.parseInt(items[1]);
+ accel_across = Integer.parseInt(items[2]);
+ accel_through = Integer.parseInt(items[3]);
+ gyro_roll = Integer.parseInt(items[4]);
+ gyro_pitch = Integer.parseInt(items[5]);
+ gyro_yaw = Integer.parseInt(items[6]);
+ }
+ return true;
+ }
AltosIdler.idle_ms5607,
AltosIdler.idle_imu, AltosIdler.idle_mag,
AltosIdler.idle_sensor_mega),
AltosIdler.idle_ms5607,
AltosIdler.idle_imu, AltosIdler.idle_mag,
AltosIdler.idle_sensor_mega),
+ new AltosIdler("TeleMega-v6",
+ AltosIdler.idle_gps,
+ AltosIdler.idle_adxl375,
+ AltosIdler.idle_ms5607,
+ AltosIdler.idle_imu, AltosIdler.idle_mag,
+ AltosIdler.idle_sensor_mega),
new AltosIdler("EasyMega-v1",
AltosIdler.idle_mma655x,
AltosIdler.idle_ms5607,
new AltosIdler("EasyMega-v1",
AltosIdler.idle_mma655x,
AltosIdler.idle_ms5607,
public static final int AO_LOG_FORMAT_TELEMEGA_4 = 19;
public static final int AO_LOG_FORMAT_EASYMOTOR = 20;
public static final int AO_LOG_FORMAT_TELEMEGA_5 = 21;
public static final int AO_LOG_FORMAT_TELEMEGA_4 = 19;
public static final int AO_LOG_FORMAT_EASYMOTOR = 20;
public static final int AO_LOG_FORMAT_TELEMEGA_5 = 21;
+ public static final int AO_LOG_FORMAT_TELEMEGA_6 = 22;
public static final int AO_LOG_FORMAT_NONE = 127;
public static final int model_mpu6000 = 0;
public static final int AO_LOG_FORMAT_NONE = 127;
public static final int model_mpu6000 = 0;
public static final int model_bmx160 = 3;
public static final int model_hmc5883 = 4;
public static final int model_mmc5983 = 5;
public static final int model_bmx160 = 3;
public static final int model_hmc5883 = 4;
public static final int model_mmc5983 = 5;
+ public static final int model_bmi088 = 6;
public static boolean isspace(int c) {
switch (c) {
public static boolean isspace(int c) {
switch (c) {
return product_easymotor;
case AO_LOG_FORMAT_TELEMEGA_5:
return product_telemega;
return product_easymotor;
case AO_LOG_FORMAT_TELEMEGA_5:
return product_telemega;
+ case AO_LOG_FORMAT_TELEMEGA_6:
+ return product_telemega;
case AO_LOG_FORMAT_NONE:
return product_altusmetrum;
default:
case AO_LOG_FORMAT_NONE:
return product_altusmetrum;
default:
final static int packet_type_mini3 = 0x11;
final static int packet_type_mega_sensor_bmx160 = 0x12;
final static int packet_type_mega_norm_mpu6000_mmc5983 = 0x13;
final static int packet_type_mini3 = 0x11;
final static int packet_type_mega_sensor_bmx160 = 0x12;
final static int packet_type_mega_norm_mpu6000_mmc5983 = 0x13;
+ final static int packet_type_mega_norm_bmi088_mmc5983 = 0x14;
static AltosTelemetry parse_hex(String hex) throws ParseException, AltosCRCException {
AltosTelemetry telem = null;
static AltosTelemetry parse_hex(String hex) throws ParseException, AltosCRCException {
AltosTelemetry telem = null;
case packet_type_mega_norm_mpu6000_mmc5983:
telem = new AltosTelemetryMegaNorm(bytes, AltosLib.model_mpu6000, AltosLib.model_mmc5983);
break;
case packet_type_mega_norm_mpu6000_mmc5983:
telem = new AltosTelemetryMegaNorm(bytes, AltosLib.model_mpu6000, AltosLib.model_mmc5983);
break;
+ case packet_type_mega_norm_bmi088_mmc5983:
+ telem = new AltosTelemetryMegaNorm(bytes, AltosLib.model_bmi088, AltosLib.model_mmc5983);
+ break;
default:
telem = new AltosTelemetryRaw(bytes);
break;
default:
telem = new AltosTelemetryRaw(bytes);
break;
Declare new USB ids
Declare new Product name
Add item to product_name function
Declare new USB ids
Declare new Product name
Add item to product_name function
+ Add entry in product_id_from_log_format
+ Declare new sensor model