Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r4d0c621f5994e1de8bf7d3337678f7835292ce73 -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 4d0c621f5994e1de8bf7d3337678f7835292ce73) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file BloodFlow.c * -* @author (last) Sean Nash -* @date (last) 10-Aug-2023 +* @author (last) Dara Navaei +* @date (last) 09-Oct-2023 * * @author (original) Sean Nash * @date (original) 07-Nov-2019 @@ -158,10 +158,10 @@ #define DIR_CAN3_PORT_MASK 0x00000002 ///< (Rx - re-purposed as output GPIO for blood pump direction signal) #define BP_ROTOR_HALL_SENSOR_NHET_ID 0x0000000C ///< NHET pin number associated with BP rotor hall sensor input // Blood pump stop and direction macros -#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal high. -#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal low. -#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} ///< Macro to set blood pump stop signal (active low). -#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} ///< Macro to clear blood pump stop signal (active low). +#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal high (forward). +#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} ///< Macro to set blood pump direction signal low (reverse). +#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} ///< Macro to set blood pump disable signal low (active low). +#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} ///< Macro to set blood pump disable signal high (active low). // ********** private data ********** @@ -308,7 +308,15 @@ bloodPumpControlMode = mode; // Set PWM duty cycle target to an estimated initial target to ramp to based on target flow rate - then we will control to flow when ramp completed bloodPumpPWMDutyCyclePct = BP_PWM_FROM_ML_PER_MIN((F32)flowRate); // ~ 8% per 100 mL/min with a 10% zero offset added in (e.g. 100 mL/min = 8+10 = 18%) +#ifndef _VECTORCAST_ + /* + * This range check was disabled in VectorCAST since all of its branches cannot be covered. + * This if statement is only executed if the flow rate is less than 700 mL/min and the required duty cycle for that will be 88% and not 90% and above. + * Also the blood flow to PWM conversion macro will have a minimum of 10% duty cycle and therefore, duty cycles below 10% cannot be achieved. + * This range check will stay in the actual code in case there was a memory stomp or other catastrophic cases + */ bloodPumpPWMDutyCyclePct = RANGE( bloodPumpPWMDutyCyclePct, MIN_BLOOD_PUMP_PWM_DUTY_CYCLE, MAX_BLOOD_PUMP_PWM_DUTY_CYCLE ); +#endif switch ( bloodPumpState ) {