diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-09 00:16:36 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-09 00:16:36 -0700 | 
| commit | c17b78e60c340c8a3e3d6f9b875667c66216647a (patch) | |
| tree | e179809049594ad032c237d5021b97f87d00f3ad /altoslib/AltosEepromFireTwo.java | |
| parent | d97c4d2f6de2981c2efd7bfbc9f5f9649987b854 (diff) | |
altoslib: Add Ms5607 constructor that just takes config_data
Use for making Ms5607 from eeprom files.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosEepromFireTwo.java')
| -rw-r--r-- | altoslib/AltosEepromFireTwo.java | 13 | 
1 files changed, 9 insertions, 4 deletions
| diff --git a/altoslib/AltosEepromFireTwo.java b/altoslib/AltosEepromFireTwo.java index 14a026a9..16019c8c 100644 --- a/altoslib/AltosEepromFireTwo.java +++ b/altoslib/AltosEepromFireTwo.java @@ -49,13 +49,11 @@ public class AltosEepromFireTwo extends AltosEeprom {  	private static final double r_below = 10000.0;  	private static final double v_adc = 3.3; -	private static double -	firetwo_adc(int raw) { +	private static double firetwo_adc(int raw) {  		return raw / 4095.0;  	} -	private static double -	adc_to_pa(int adc) { +	public static double adc_to_pa(int adc) {  		/* raw adc to processor voltage, then back through the  		 * voltage divider to the sensor voltage @@ -71,6 +69,13 @@ public class AltosEepromFireTwo extends AltosEeprom {  		return AltosConvert.psi_to_pa(psi);  	} +	public static double adc_to_n(int adc) { +		double v = firetwo_adc(adc); + +		/* this is a total guess */ +		return AltosConvert.lb_to_n(v * 298 * 9.807); +	} +  	public void update_state(AltosState state) {  		super.update_state(state); | 
