PECO update
This commit is contained in:
@ -52,7 +52,7 @@
|
|||||||
// Description: Definition of local constants (visible by this module only).
|
// Description: Definition of local constants (visible by this module only).
|
||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
#define REFRESH 1000 // Refresh rate in ms
|
#define REFRESH 100 // Refresh rate in ms
|
||||||
|
|
||||||
#define EVENT_TIMER_UPDATE ((U32)(1<<0))
|
#define EVENT_TIMER_UPDATE ((U32)(1<<0))
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ LOCAL CONST osThreadAttr_t stTaskAttribute =
|
|||||||
0, // size of provided memory for control block
|
0, // size of provided memory for control block
|
||||||
NULL, // memory for stack
|
NULL, // memory for stack
|
||||||
1024, // size of stack
|
1024, // size of stack
|
||||||
osPriorityNormal, // initial thread priority (default: osPriorityNormal)
|
osPriorityHigh, // initial thread priority (default: osPriorityNormal)
|
||||||
0, // TrustZone module identifier
|
0, // TrustZone module identifier
|
||||||
0, // reserved (must be 0)
|
0, // reserved (must be 0)
|
||||||
};
|
};
|
||||||
@ -176,21 +176,6 @@ BOOL PECO_boInitializeModule( VOID )
|
|||||||
return( boOK );
|
return( boOK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
|
||||||
// Function: PECO_boSetTemperature
|
|
||||||
// Description: Sets the Peltier Controller to a Specific Temperature
|
|
||||||
// Parameters: None
|
|
||||||
// Returns: Boolean TRUE if successful
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
|
||||||
BOOL PECO_boSetTemperature( S16 Temperature ){
|
|
||||||
BOOL boOK = TRUE;
|
|
||||||
|
|
||||||
boOK &= boSetPeltierVoltage( Temperature );
|
|
||||||
|
|
||||||
return( boOK );
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
// Function: PECO_Enable
|
// Function: PECO_Enable
|
||||||
// Description: Enables the Peltier Controller Output
|
// Description: Enables the Peltier Controller Output
|
||||||
@ -231,7 +216,7 @@ VOID vTask( PVOID arg )
|
|||||||
|
|
||||||
FLOAT last_error = 0;
|
FLOAT last_error = 0;
|
||||||
FLOAT integral = 0;
|
FLOAT integral = 0;
|
||||||
FLOAT dT = REFRESH; // 1s
|
FLOAT dT = REFRESH / 1000.0f; // 1s
|
||||||
|
|
||||||
while ( TRUE )
|
while ( TRUE )
|
||||||
{
|
{
|
||||||
@ -243,6 +228,9 @@ VOID vTask( PVOID arg )
|
|||||||
|
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
|
|
||||||
|
if ( PECO_isEnabled() )
|
||||||
|
{
|
||||||
|
|
||||||
if ( VARH_u32GetVariableData( VARH_eMode ) == PECO_eConstTemp )
|
if ( VARH_u32GetVariableData( VARH_eMode ) == PECO_eConstTemp )
|
||||||
{
|
{
|
||||||
// TODO: check the measurements, everything ok?
|
// TODO: check the measurements, everything ok?
|
||||||
@ -279,8 +267,10 @@ VOID vTask( PVOID arg )
|
|||||||
// limitter
|
// limitter
|
||||||
if ( output > max ){
|
if ( output > max ){
|
||||||
output = max;
|
output = max;
|
||||||
|
integral = 0;
|
||||||
} else if ( output < min ){
|
} else if ( output < min ){
|
||||||
output = min;
|
output = min;
|
||||||
|
integral = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boSetPeltierVoltage( output ); // set the output
|
boSetPeltierVoltage( output ); // set the output
|
||||||
@ -288,8 +278,13 @@ VOID vTask( PVOID arg )
|
|||||||
} else if ( VARH_u32GetVariableData( VARH_eMode ) == PECO_eConst_Voltage )
|
} else if ( VARH_u32GetVariableData( VARH_eMode ) == PECO_eConst_Voltage )
|
||||||
{
|
{
|
||||||
boSetPeltierVoltage( VARH_flGetVariableData( VARH_eControlVoltage ) ); // set the output
|
boSetPeltierVoltage( VARH_flGetVariableData( VARH_eControlVoltage ) ); // set the output
|
||||||
|
last_error = 0;
|
||||||
|
integral = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
last_error = 0;
|
||||||
|
integral = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ typedef enum {
|
|||||||
//=================================================================================================
|
//=================================================================================================
|
||||||
|
|
||||||
BOOL PECO_boInitializeModule( VOID );
|
BOOL PECO_boInitializeModule( VOID );
|
||||||
BOOL PECO_boSetTemperature( S16 Temperature );
|
|
||||||
VOID PECO_Enable( BOOL Enable );
|
VOID PECO_Enable( BOOL Enable );
|
||||||
BOOL PECO_isEnabled( VOID );
|
BOOL PECO_isEnabled( VOID );
|
||||||
|
|
||||||
|
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [3.15.2] date: [Thu Jul 07 18:17:37 CEST 2022]
|
# File automatically-generated by tool: [projectgenerator] version: [3.15.2] date: [Tue Sep 06 08:17:33 CEST 2022]
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user