X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosTelemetryCompanion.java;h=f3283c32847962cbd4b7c6c3e2c9485bc39fe26d;hp=96125acabe1a779e8d52abc2957a60f896dd55ba;hb=dcf533d5befffa4c9c872f3c3d21d11ffeb61307;hpb=7064bc685aebeef07711e525dea4d5fbe33d235b diff --git a/altoslib/AltosTelemetryCompanion.java b/altoslib/AltosTelemetryCompanion.java index 96125aca..f3283c32 100644 --- a/altoslib/AltosTelemetryCompanion.java +++ b/altoslib/AltosTelemetryCompanion.java @@ -3,7 +3,8 @@ * * 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. + * 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 @@ -15,24 +16,19 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_8; +package org.altusmetrum.altoslib_11; public class AltosTelemetryCompanion extends AltosTelemetryStandard { - AltosCompanion companion; - - static final public int max_channels = 12; - - public AltosTelemetryCompanion(int[] bytes) { - super(bytes); + AltosCompanion companion() { int channels = uint8(7); if (channels > max_channels) channels = max_channels; - companion = new AltosCompanion(channels); + AltosCompanion companion = new AltosCompanion(channels); - companion.tick = tick; + companion.tick = tick(); companion.board_id = uint8(5); companion.update_period = uint8(6); @@ -44,11 +40,17 @@ public class AltosTelemetryCompanion extends AltosTelemetryStandard { for (int i = 0; i < channels; i++) companion.companion_data[i] = uint16(8 + i * 2); } + return companion; } - public void update_state(AltosState state) { - super.update_state(state); + static final public int max_channels = 12; + + public AltosTelemetryCompanion(int[] bytes) throws AltosCRCException { + super(bytes); + } - state.set_companion(companion); + public void provide_data(AltosDataListener listener, AltosCalData cal_data) { + super.provide_data(listener, cal_data); + listener.set_companion(companion()); } }