Index: firmware/App/Controllers/AirPump.h =================================================================== diff -u -r1e806f55dd70e314a8bbb70c5233443dc807998a -r4ed766fe84660297858a9af1651e93ff0c4d71f1 --- firmware/App/Controllers/AirPump.h (.../AirPump.h) (revision 1e806f55dd70e314a8bbb70c5233443dc807998a) +++ firmware/App/Controllers/AirPump.h (.../AirPump.h) (revision 4ed766fe84660297858a9af1651e93ff0c4d71f1) @@ -43,7 +43,7 @@ //TODO: remove after validating air pump speed U32 fpgah12Rpm; ///< Air pump fpga speed in RPM. //TODO: remove after validating air pump speed - U08 scalarPower; ///< Scalar power + U32 scalarPower; ///< Scalar power } AIR_PUMP_PAYLOAD_T; #pragma pack(pop) Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -r1c2d9db3310c4924ba75ded55dd8960f272ac253 -r4ed766fe84660297858a9af1651e93ff0c4d71f1 --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 1c2d9db3310c4924ba75ded55dd8960f272ac253) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 4ed766fe84660297858a9af1651e93ff0c4d71f1) @@ -52,11 +52,20 @@ #define AIR_PUMP_MOTOR_FILL_PWM 60.0F ///< Power level setting (PWM) in percentage for H12 air pump to fill (raise level) the air trap. #define AIR_PUMP_MOTOR_LOWER_PWM 24.0F ///< Power level setting (PWM) in percentage for H12 air pump to lower the level of the air trap. +// keeping it here till i get the system team's test result +#ifndef AIR_PUMP_PERCENTAGE_DUTY_CYCLE /// LDT-2384 test formula for air trap lower events for air pump duty cycle based on venous pressure -/// air pump lowering duty cycle (% PWM) = 0.0005x^2 + 0.2313x + 63.667, where x is long filtered (60 sec) H14 venous pressure in mmHg before air pump lower event +/// air pump lowering scalar PWM = 0.0005x^2 + 0.2313x + 63.667, where x is long filtered (60 sec) H14 venous pressure in mmHg before air pump lower event #define QUADRATIC_COEFFICIENT 0.0005F ///< X2 quadratic coefficient #define LINEAR_COEFFICIENT 0.2313F ///< X linear coefficient #define CONSTANT_TERM 63.667F ///< Constant term +#else +/// LDT-2384 test formula for air trap lower events for air pump duty cycle based on venous pressure +/// air pump duty cycle (% PWM) = 0.0002x^2 + 0.0925x + 25.467, where x is long filtered H14 venous pressure in mmHg before air trap lower event +#define QUADRATIC_COEFFICIENT 0.0002F ///< X2 quadratic coefficient +#define LINEAR_COEFFICIENT 0.0925F ///< X linear coefficient +#define CONSTANT_TERM 25.467F ///< Constant term +#endif /// Defined states for the air trap controller state machine. typedef enum AirTrap_States @@ -340,13 +349,23 @@ F32 getCalculatedAirPumpDutyCycle( void ) { F32 h14Pressure = getLongFilteredVenousPressure(); +#ifndef AIR_PUMP_PERCENTAGE_DUTY_CYCLE /// LDT-2384 test formula for air trap lower events for air pump duty cycle based on venous pressure /// air pump lowering PWM (scalar PWM) = 0.0005x^2 + 0.2313x + 63.667, where x is long filtered (60 sec) H14 venous pressure in mmHg before air pump lower event F32 dutyCycle = ( ( QUADRATIC_COEFFICIENT * ( h14Pressure * h14Pressure ) ) - ( LINEAR_COEFFICIENT * ( h14Pressure ) ) ) + CONSTANT_TERM; // covert to percentage dutyCycle = ( dutyCycle / (F32)AIR_PUMP_MAX_PWM ) * FRACTION_TO_PERCENT_FACTOR; +#else + /// LDT-2384 test formula for air trap lower events for air pump duty cycle based on venous pressure + /// air pump duty cycle (% PWM) = 0.0002x^2 + 0.0925x + 25.467, where x is long filtered H14 venous pressure in mmHg before air trap lower event + F32 duticycleInPct = ( ( QUADRATIC_COEFFICIENT * ( h14Pressure * h14Pressure ) ) - ( LINEAR_COEFFICIENT * ( h14Pressure ) ) ) + CONSTANT_TERM; +#endif +#ifndef AIR_PUMP_PERCENTAGE_DUTY_CYCLE return dutyCycle; +#else + return duticycleInPct; +#endif } /*********************************************************************//** Index: firmware/App/Drivers/GLXferPump.c =================================================================== diff -u -r74fb4e00de266776cfc5d92163592ee895c23ed0 -r4ed766fe84660297858a9af1651e93ff0c4d71f1 --- firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 74fb4e00de266776cfc5d92163592ee895c23ed0) +++ firmware/App/Drivers/GLXferPump.c (.../GLXferPump.c) (revision 4ed766fe84660297858a9af1651e93ff0c4d71f1) @@ -103,9 +103,9 @@ * @details \b Outputs: scalarPowerLevel * @return Current set scalar power level of the air pump motor. *************************************************************************/ -F32 getAirPumpMotorScalarPower( void ) +U32 getAirPumpMotorScalarPower( void ) { - return scalarPowerLevel; + return (U32)scalarPowerLevel; } /*********************************************************************//** Index: firmware/App/Drivers/GLXferPump.h =================================================================== diff -u -r74fb4e00de266776cfc5d92163592ee895c23ed0 -r4ed766fe84660297858a9af1651e93ff0c4d71f1 --- firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision 74fb4e00de266776cfc5d92163592ee895c23ed0) +++ firmware/App/Drivers/GLXferPump.h (.../GLXferPump.h) (revision 4ed766fe84660297858a9af1651e93ff0c4d71f1) @@ -48,7 +48,7 @@ // TODO:remove after testing U16 getAirPumpMotorFPGARPM( void ); // TODO:remove after testing -F32 getAirPumpMotorScalarPower( void ); +U32 getAirPumpMotorScalarPower( void ); BOOL testSetAirPump( MESSAGE_T *message ); Index: firmware/App/TDCommon.h =================================================================== diff -u -r6a31b289d2e8e9c19dc08a721135b4f768ba5667 -r4ed766fe84660297858a9af1651e93ff0c4d71f1 --- firmware/App/TDCommon.h (.../TDCommon.h) (revision 6a31b289d2e8e9c19dc08a721135b4f768ba5667) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision 4ed766fe84660297858a9af1651e93ff0c4d71f1) @@ -29,6 +29,8 @@ // ********** development build switches ********** +#define AIR_PUMP_PERCENTAGE_DUTY_CYCLE + #ifndef _RELEASE_ #ifndef _VECTORCAST_ // #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing