altoslib: Replace EasyMotor v2 code with v3
[fw/altos] / altoslib / AltosConvert.java
index 099ea04859337bb14e0799df62d607eabc97f9d8..3e1796b2c194bfbeb212a9adbe675a0917642201 100644 (file)
@@ -323,6 +323,16 @@ public class AltosConvert {
                return (voltage - base) / (max - base) * full_scale_pressure;
        }
 
+       static double easy_motor_3_adc(double raw) {
+               return raw / 32767.0;
+       }
+
+       static double easy_motor_3_voltage(int sensor) {
+               double  supply = 3.3;
+
+               return easy_motor_3_adc(sensor) * supply * 15.6 / 10.0;
+       }
+
        static double easy_motor_2_motor_pressure(int sensor, double ground_sensor) {
                double  supply = 3.3;
                double  ground_voltage = easy_mini_2_adc(ground_sensor) * supply * 15.6 / 10.0;
@@ -331,6 +341,14 @@ public class AltosConvert {
                return motor_pressure(voltage) - motor_pressure(ground_voltage);
        }
 
+       static double easy_motor_3_motor_pressure(int sensor, double ground_sensor) {
+               double  supply = 3.3;
+               double  ground_voltage = easy_motor_3_adc(ground_sensor) * supply * 15.6 / 10.0;
+               double  voltage = easy_motor_3_adc(sensor) * supply * 15.6 / 10.0;
+
+               return motor_pressure(voltage) - motor_pressure(ground_voltage);
+       }
+
        public static double radio_to_frequency(int freq, int setting, int cal, int channel) {
                double  f;