- if (remote) {
- link.set_radio_frequency(frequency);
- link.start_remote();
- } else
- link.flush_input();
- config_data = new AltosConfigData(link);
- if (config_data.product.startsWith("TeleMetrum")) {
- record = new AltosSensorTM(link, config_data);
- } else if (config_data.product.startsWith("MegaMetrum")) {
- AltosRecordMM record_mm = new AltosRecordMM();
- AltosSensorMM sensor = new AltosSensorMM(link);
- AltosMs5607 ms5607 = new AltosMs5607Query(link);
- AltosIMU imu = new AltosIMUQuery(link);
-
- record_mm.accel_plus_g = config_data.accel_cal_plus;
- record_mm.accel_minus_g = config_data.accel_cal_minus;
-
- record_mm.ground_accel = sensor.accel;
- record_mm.accel = sensor.accel;
- record_mm.ground_pres = ms5607.pa;
- record_mm.pres = ms5607.pa;
- record_mm.temp = ms5607.cc;
-
- record_mm.v_batt = sensor.v_batt;
- record_mm.v_pyro = sensor.v_pyro;
- record_mm.sense = sensor.sense;
-
- record_mm.imu = imu;
-
- record = record_mm;
- } else
- record = new AltosRecord();
-
- gps = new AltosGPSQuery(link, config_data);
-
- record.version = 0;
- record.callsign = config_data.callsign;
- record.serial = config_data.serial;
- record.flight = config_data.log_available() > 0 ? 255 : 0;
- record.status = 0;
- record.state = AltosLib.ao_flight_idle;
- record.gps = gps;
- record.new_gps = true;
- state = new AltosState (record, state);
+ start_link();
+ link.config_data();
+ if (state == null)
+ state = new AltosState(new AltosCalData(link.config_data()));
+ fetch.provide_data(state);
+ if (frequency != AltosLib.MISSING)
+ state.set_frequency(frequency);
+ if (!link.has_error && !link.reply_abort)
+ worked = true;