Pump voltage check and disabling mechanism if high
This commit is contained in:
parent
e081882ad7
commit
71b468cc6e
|
|
@ -60,7 +60,6 @@ void AnalogMeasurementReadData(uint32 channel_u32, uint32 *adcValue_pu32)
|
|||
{
|
||||
return; /* Prevent dereferencing NULL pointer */
|
||||
}
|
||||
__disable_irq();
|
||||
switch (channel_u32)
|
||||
{
|
||||
case PS1_ADC_CHANNEL: *adcValue_pu32 = adcBuffer_u32[0]; break;
|
||||
|
|
@ -76,7 +75,6 @@ void AnalogMeasurementReadData(uint32 channel_u32, uint32 *adcValue_pu32)
|
|||
case FM4_ADC_CHANNEL: *adcValue_pu32 = adcBuffer_u32[8]; break;
|
||||
default: *adcValue_pu32 = 0uL; break;
|
||||
}
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
/******************************************************************************
|
||||
* Private function Declarations
|
||||
******************************************************************************/
|
||||
static uint32 GrundfosPmpReadVoltage(uint8 channel_u8);
|
||||
static float32 GrundfosPmpReadVoltage(uint8 channel_u8);
|
||||
|
||||
/******************************************************************************
|
||||
* Extern Function Definitions
|
||||
|
|
@ -45,9 +45,9 @@ void GrundfosPmpEnable(uint8 state_u8)
|
|||
}
|
||||
|
||||
|
||||
uint32 GrundfosPmpFeedbackSpeed(uint8 channel_u8)
|
||||
float32 GrundfosPmpFeedback(uint8 channel_u8)
|
||||
{
|
||||
uint32 feedbackSpeed_u32 = (GrundfosPmpReadVoltage(channel_u8)) * 360uL;
|
||||
float32 feedbackSpeed_u32 = (GrundfosPmpReadVoltage(channel_u8)) * 0.32f;
|
||||
|
||||
return feedbackSpeed_u32;
|
||||
}
|
||||
|
|
@ -90,12 +90,13 @@ bool GrundfosPmpSetSpeed(float32 setSpeed_f32)
|
|||
* @return ADC output voltage based on sensor reading.
|
||||
*
|
||||
*/
|
||||
static uint32 GrundfosPmpReadVoltage(uint8 channel_u8)
|
||||
static float32 GrundfosPmpReadVoltage(uint8 channel_u8)
|
||||
{
|
||||
/* Convert ADC value to voltage (assuming 12-bit resolution and 3.3V reference) */
|
||||
float32 voltage_f32 = 0.0f;
|
||||
uint32 adcVal_u32 = 0uL;
|
||||
AnalogMeasurementReadData(channel_u8, &adcVal_u32);
|
||||
float32 voltage_f32 = (float32)adcVal_u32 * (ANALOG_MEAS_ADC_REF_VOLTAGE / ANALOG_MEAS_ADC_RESOLUTION);
|
||||
voltage_f32 = (float32)adcVal_u32 * (ANALOG_MEAS_ADC_REF_VOLTAGE / ANALOG_MEAS_ADC_RESOLUTION);
|
||||
|
||||
return voltage_f32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ typedef struct
|
|||
/******************************************************************************
|
||||
* Extern Function Declarations
|
||||
******************************************************************************/
|
||||
uint32 GrundfosPmpFeedbackSpeed(uint8 channel_u8);
|
||||
float32 GrundfosPmpFeedback(uint8 channel_u8);
|
||||
void GrundfosPmpEnable(uint8_t state_u8);
|
||||
bool GrundfosPmpSetSpeed(float setSpeed_f);
|
||||
#endif /* GRUNDFOS_H_ */
|
||||
|
|
|
|||
|
|
@ -173,9 +173,9 @@ void ProcessBoardRun(void)
|
|||
******************************************************************************/
|
||||
static void ProcessBoardGrundfosPumpHandler(void)
|
||||
{
|
||||
static uint32 pmpSpeed_u32 = 0uL;
|
||||
static uint8 speed_u8 = 0u;
|
||||
static uint64 startTime_u64 = 0uLL;
|
||||
static float32 pmpSpeed_f32 = 0.0f;
|
||||
static uint8 speed_u8 = 0u;
|
||||
static uint64 startTime_u64 = 0uLL;
|
||||
uint64 currentTimeMs_u64;
|
||||
|
||||
HalSystemGetRunTimeMs(¤tTimeMs_u64);
|
||||
|
|
@ -201,15 +201,14 @@ static void ProcessBoardGrundfosPumpHandler(void)
|
|||
GrundfosPmpSetSpeed(speed_u8);
|
||||
|
||||
startTime_u64 = currentTimeMs_u64;
|
||||
}
|
||||
|
||||
/* Grundfos Pump feedback speed OUT */
|
||||
pmpSpeed_u32 = GrundfosPmpFeedbackSpeed(PMP_ADC_CHANNEL);
|
||||
/* Grundfos Pump feedback speed OUT */
|
||||
pmpSpeed_f32 = GrundfosPmpFeedback(PMP_ADC_CHANNEL);
|
||||
|
||||
/* To be verified */
|
||||
if (pmpSpeed_u32 > PU_PUMP_MAX_SPEED)
|
||||
{
|
||||
GrundfosPmpEnable(PU_PMP_DISABLE);
|
||||
}
|
||||
if (pmpSpeed_f32 > 3.3f)
|
||||
{
|
||||
GrundfosPmpEnable(PU_PMP_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user