diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-28 13:58:05 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-28 13:58:05 -0700 | 
| commit | 9e1295ff74d03f940fc68e6795bf30687162a440 (patch) | |
| tree | 4fe999263ae48bbab7ba932fe8f87f4b7498226d /altoslib/AltosConfigData.java | |
| parent | e4407afb514437ccd8db79ae29c6fa203140fa07 (diff) | |
altoslib: Extract a few more values from config to cal_data
Make it possible to display model/version data in the flight stats table.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosConfigData.java')
| -rw-r--r-- | altoslib/AltosConfigData.java | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 1972ca0f..cb46b6c6 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -33,6 +33,7 @@ public class AltosConfigData {  	public int	log_space;  	public String	version;  	public int	altitude_32; +	public int	config_major, config_minor;  	/* Config information */  	/* HAS_FLIGHT*/ @@ -236,6 +237,8 @@ public class AltosConfigData {  		log_format = AltosLib.AO_LOG_FORMAT_UNKNOWN;  		log_space = AltosLib.MISSING;  		version = "unknown"; +		config_major = AltosLib.MISSING; +		config_minor = AltosLib.MISSING;  		main_deploy = AltosLib.MISSING;  		apogee_delay = AltosLib.MISSING; @@ -283,6 +286,7 @@ public class AltosConfigData {  	}  	public void parse_line(String line) { +  		/* Version replies */  		try { manufacturer = get_string(line, "manufacturer"); } catch (Exception e) {}  		try { product = get_string(line, "product"); } catch (Exception e) {} @@ -306,6 +310,21 @@ public class AltosConfigData {  		/* Config show replies */ +		try { +			if (line.startsWith("Config version")) { +				String[] bits = line.split("\\s+"); +				if (bits.length >= 3) { +					String[] cfg = bits[2].split("\\."); + +					if (cfg.length >= 2) { +						System.out.printf("major %s minor %s\n", cfg[0], cfg[1]); +						config_major = Integer.parseInt(cfg[0]); +						config_minor = Integer.parseInt(cfg[1]); +					} +				} +			} +		} catch (Exception e) {} +  		/* HAS_FLIGHT */  		try { main_deploy = get_int(line, "Main deploy:"); } catch (Exception e) {}  		try { apogee_delay = get_int(line, "Apogee delay:"); } catch (Exception e) {} | 
