Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1969 → Rev 1970

/branches/dongfang_FC_rewrite/analog.c
117,7 → 117,7
/*
* Air pressure
*/
volatile uint8_t rangewidth = 106;
volatile uint8_t rangewidth = 105;
 
// Direct from sensor, irrespective of range.
// volatile uint16_t rawAirPressure;
/branches/dongfang_FC_rewrite/analog.h
212,11 → 212,34
/*
* Air pressure.
* The sensor has a sensitivity of 45 mV/kPa.
* An approximate p(h) formula is = p(h[m])[Pa] = p_0 - 11.95 * 10^-3 * h
* That is: dV = 45 mV * 11.95 * 10^-3 dh = 0.53775 mV / m.
* That is, with 1.024 / 3 steps per mV: 0.183552 steps / m
*/
#define AIRPRESSURE_SUMMATION_FACTOR 54
* An approximate p(h) formula is = p(h[m])[kPa] = p_0 - 11.95 * 10^-3 * h
* p(h[m])[kPa] = 101.3 - 11.95 * 10^-3 * h
* 11.95 * 10^-3 * h = 101.3 - p[kPa]
* h = (101.3 - p[kPa])/0.01195
* That is: dV = -45 mV * 11.95 * 10^-3 dh = -0.53775 mV / m.
* That is, with 38.02 * 1.024 / 3 steps per mV: -7 steps / m
 
Display pressures
4165 mV-->1084.7
4090 mV-->1602.4 517.7
3877 mV-->3107.8 1503.4
 
4165 mV-->1419.1
3503 mV-->208.1
Diff.: 1211.0
 
Calculated Vout = 5V(.009P-0.095) --> 5V .009P = Vout + 5V 0.095 --> P = (Vout + 5V 0.095)/(5V 0.009)
4165 mV = 5V(0.009P-0.095) P = 103.11 kPa h = -151.4m
4090 mV = 5V(0.009P-0.095) P = 101.44 kPa h = -11.7m 139.7m
3877 mV = 5V(0.009P-0.095) P = 96.7 kPa h = 385m 396.7m
 
4165 mV = 5V(0.009P-0.095) P = 103.11 kPa h = -151.4m
3503 mV = 5V(0.009P-0.095) P = 88.4 kPa h = 384m Diff: 1079.5m
Pressure at sea level: 101.3 kPa. voltage: 5V * (0.009P-0.095) = 4.0835V
This is OCR2 = 143.15 at 1.5V in --> simple pressure =
*/
 
#define AIRPRESSURE_SUMMATION_FACTOR 14
#define AIRPRESSURE_FILTER 8
// Minimum A/D value before a range change is performed.
#define MIN_RAWPRESSURE (200 * 2)
229,6 → 252,8
#define PRESSURE_EXTRAPOLATION_COEFF 25L
#define AUTORANGE_WAIT_FACTOR 1
 
#define ABS_ALTITUDE_OFFSET 108205
 
extern volatile uint16_t simpleAirPressure;
/*
* At saturation, the filteredAirPressure may actually be (simulated) negative.
/branches/dongfang_FC_rewrite/heightControl.c
86,9 → 86,10
}
}
}
 
// height, in meters (so the division factor is: 100)
debugOut.analog[30] = height / 10;
// debugOut.analog[30] = filteredAirPressure / 10;
debugOut.analog[30] = (125200 - filteredAirPressure) / 100;
}
 
// takes 180-200 usec (with integral term). That is too heavy!!!
/branches/dongfang_FC_rewrite/makefile
497,7 → 497,6
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
 
 
# Automatically generate C source code dependencies.
# (Code originally taken from the GNU make user manual and modified
# (See README.txt Credits).)
/branches/dongfang_FC_rewrite/uart0.c
152,7 → 152,7
"Airpress. Range ",
"DriftCompPitch ",
"DriftCompRoll ",
"AirpressFiltered", //30
"Altitude ", //30
"AirpressADC " };
 
/****************************************************************/