summaryrefslogtreecommitdiff
path: root/altoslib/AltosMs5607.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-02-06 04:45:17 -0800
committerKeith Packard <keithp@keithp.com>2015-02-06 04:45:17 -0800
commit66e7a8081c07d0d96a31ae34963d430f06dccdfb (patch)
treedb49f2712df6883cb4049f84f0576ad28156287e /altoslib/AltosMs5607.java
parent14d524782af4f06d7f3722dcc852772ec493c2cc (diff)
altoslib: Store MS5607 data in AltosConfigData for use by AltosMs5607
When doing 'Monitor Idle', we fetch new config data each iteration and pass that to each of the readers, including ms5607. Instead of re-fetching the config data there, just store the ms5607 parameters when we fetch it the first time and copy it over. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMs5607.java')
-rw-r--r--altoslib/AltosMs5607.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/altoslib/AltosMs5607.java b/altoslib/AltosMs5607.java
index 97e17164..056a8490 100644
--- a/altoslib/AltosMs5607.java
+++ b/altoslib/AltosMs5607.java
@@ -127,7 +127,7 @@ public class AltosMs5607 implements Serializable {
static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException {
try {
- AltosMs5607 ms5607 = new AltosMs5607(link);
+ AltosMs5607 ms5607 = new AltosMs5607(link, config_data);
if (ms5607 != null) {
state.set_ms5607(ms5607);
@@ -144,9 +144,17 @@ public class AltosMs5607 implements Serializable {
cc = AltosLib.MISSING;
}
- public AltosMs5607 (AltosLink link) throws InterruptedException, TimeoutException {
+ public AltosMs5607 (AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException {
this();
- link.printf("c s\nB\n");
+ reserved = config_data.ms5607_reserved;
+ sens = config_data.ms5607_sens;
+ off = config_data.ms5607_off;
+ tcs = config_data.ms5607_tcs;
+ tco = config_data.ms5607_tco;
+ tref = config_data.ms5607_tref;
+ tempsens = config_data.ms5607_tempsens;
+ crc = config_data.ms5607_crc;
+ link.printf("B\n");
for (;;) {
String line = link.get_reply_no_dialog(5000);
if (line == null) {