fix: add logic to control display time from c code and blink soc on display while charging
parent
bd226465f7
commit
8faece3cee
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'socTouchDisplay'.
|
||||
*
|
||||
* Model version : 1.111
|
||||
* Model version : 1.128
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Thu Nov 7 22:32:36 2024
|
||||
* C/C++ source code generated on : Fri Dec 27 18:51:07 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
|
|
@ -37,6 +37,7 @@ typedef struct {
|
|||
CAN_MESSAGE_BUS Selector; /* '<S3>/Selector' */
|
||||
CAN_MESSAGE_BUS SFunction; /* '<S3>/S-Function' */
|
||||
uint8_T In1[8]; /* '<S5>/In1' */
|
||||
boolean_T Compare; /* '<S7>/Compare' */
|
||||
} B_socTouchDisplay_T;
|
||||
|
||||
/* Block states (default storage) for system '<Root>' */
|
||||
|
|
@ -46,6 +47,7 @@ typedef struct {
|
|||
uint32_T temporalCounter_i1; /* '<Root>/Chart' */
|
||||
uint32_T durationCounter_1_g; /* '<Root>/Chart' */
|
||||
uint32_T durationCounter_2; /* '<Root>/Chart' */
|
||||
uint32_T durationCounter_3; /* '<Root>/Chart' */
|
||||
uint8_T is_active_c1_socTouchDisplay;/* '<Root>/Chart1' */
|
||||
uint8_T is_c1_socTouchDisplay; /* '<Root>/Chart1' */
|
||||
uint8_T is_active_c3_socTouchDisplay;/* '<Root>/Chart' */
|
||||
|
|
@ -123,6 +125,8 @@ extern RT_MODEL_socTouchDisplay_T *const socTouchDisplay_M;
|
|||
* '<S3>' : 'socTouchDisplay/canMsgDecode'
|
||||
* '<S4>' : 'socTouchDisplay/displayData'
|
||||
* '<S5>' : 'socTouchDisplay/canMsgDecode/Enabled Subsystem'
|
||||
* '<S6>' : 'socTouchDisplay/canMsgDecode/Enabled Subsystem1'
|
||||
* '<S7>' : 'socTouchDisplay/canMsgDecode/Enabled Subsystem1/Compare To Constant'
|
||||
*/
|
||||
#endif /* RTW_HEADER_socTouchDisplay_h_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'socTouchDisplay'.
|
||||
*
|
||||
* Model version : 1.104
|
||||
* Model version : 1.128
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Oct 28 16:04:13 2024
|
||||
* C/C++ source code generated on : Fri Dec 27 18:51:07 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'socTouchDisplay'.
|
||||
*
|
||||
* Model version : 1.104
|
||||
* Model version : 1.128
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Mon Oct 28 16:04:13 2024
|
||||
* C/C++ source code generated on : Fri Dec 27 18:51:07 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'socTouchDisplay'.
|
||||
*
|
||||
* Model version : 1.111
|
||||
* Model version : 1.128
|
||||
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
||||
* C/C++ source code generated on : Thu Nov 7 22:32:36 2024
|
||||
* C/C++ source code generated on : Fri Dec 27 18:51:07 2024
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
#include "socTouchDisplay_private.h"
|
||||
|
||||
/* Named constants for Chart: '<Root>/Chart' */
|
||||
#define socTouchDi_IN_waitTillNextTouch ((uint8_T)4U)
|
||||
#define socTouchDis_IN_touchNotDetected ((uint8_T)3U)
|
||||
#define socTouchDisplay_IN_displayError ((uint8_T)1U)
|
||||
#define socTouchDisplay_IN_displaySoc ((uint8_T)2U)
|
||||
#define socTouchDis_IN_touchNotDetected ((uint8_T)4U)
|
||||
#define socTouchDisp_IN_chargingDisplay ((uint8_T)1U)
|
||||
#define socTouchDisplay_IN_displayError ((uint8_T)2U)
|
||||
#define socTouchDisplay_IN_displaySoc ((uint8_T)3U)
|
||||
|
||||
/* Named constants for Chart: '<Root>/Chart1' */
|
||||
#define socTouchDisplay_IN_bmsPresent ((uint8_T)1U)
|
||||
|
|
@ -83,7 +83,7 @@ void socTouchDisplay_step(void)
|
|||
* Constant: '<S3>/Constant'
|
||||
* RelationalOperator: '<S3>/Equal1'
|
||||
*/
|
||||
if ((socTouchDisplay_B.SFunction.Data[0] == 2) && rtb_Equal) {
|
||||
if (rtb_Equal && (socTouchDisplay_B.SFunction.Data[0] == 2)) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
/* SignalConversion generated from: '<S5>/In1' */
|
||||
socTouchDisplay_B.In1[i] = socTouchDisplay_B.SFunction.Data[i];
|
||||
|
|
@ -96,6 +96,23 @@ void socTouchDisplay_step(void)
|
|||
/* DataTypeConversion: '<S3>/Cast' */
|
||||
rtb_Cast = socTouchDisplay_B.In1[2];
|
||||
|
||||
/* Outputs for Enabled SubSystem: '<S3>/Enabled Subsystem1' incorporates:
|
||||
* EnablePort: '<S6>/Enable'
|
||||
*/
|
||||
/* Logic: '<S3>/AND1' incorporates:
|
||||
* Constant: '<S3>/Constant1'
|
||||
* RelationalOperator: '<S3>/Equal2'
|
||||
*/
|
||||
if (rtb_Equal && (socTouchDisplay_B.SFunction.Data[0] == 1)) {
|
||||
/* RelationalOperator: '<S7>/Compare' incorporates:
|
||||
* Constant: '<S7>/Constant'
|
||||
*/
|
||||
socTouchDisplay_B.Compare = (socTouchDisplay_B.SFunction.Data[6] == 4);
|
||||
}
|
||||
|
||||
/* End of Logic: '<S3>/AND1' */
|
||||
/* End of Outputs for SubSystem: '<S3>/Enabled Subsystem1' */
|
||||
|
||||
/* Memory: '<S3>/Memory' */
|
||||
rtb_Memory = Memory_PreviousInput;
|
||||
|
||||
|
|
@ -152,6 +169,7 @@ void socTouchDisplay_step(void)
|
|||
|
||||
if (socTouchDisplay_DW.is_active_c3_socTouchDisplay == 0U) {
|
||||
socTouchDisplay_DW.is_active_c3_socTouchDisplay = 1U;
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_1_g = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay = socTouchDis_IN_touchNotDetected;
|
||||
|
|
@ -163,14 +181,34 @@ void socTouchDisplay_step(void)
|
|||
socTouchDisplay_Y.op_bErrorStatus = false;
|
||||
} else {
|
||||
switch (socTouchDisplay_DW.is_c3_socTouchDisplay) {
|
||||
case socTouchDisp_IN_chargingDisplay:
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = true;
|
||||
if (socTouchDisplay_DW.temporalCounter_i1 >= 20U) {
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_1_g = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay =
|
||||
socTouchDis_IN_touchNotDetected;
|
||||
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = false;
|
||||
|
||||
/* Outport: '<Root>/op_bErrorStatus' */
|
||||
socTouchDisplay_Y.op_bErrorStatus = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case socTouchDisplay_IN_displayError:
|
||||
/* Outport: '<Root>/op_bErrorStatus' */
|
||||
socTouchDisplay_Y.op_bErrorStatus = true;
|
||||
if ((uint32_T)((int32_T)socTouchDisplay_DW.temporalCounter_i1 * 100) >=
|
||||
(uint32_T)ceil(socTouchDisplay_U.ip_u32DisplayDuration_msec)) {
|
||||
socTouchDisplay_DW.temporalCounter_i1 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_1_g = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay =
|
||||
socTouchDi_IN_waitTillNextTouch;
|
||||
socTouchDis_IN_touchNotDetected;
|
||||
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = false;
|
||||
|
|
@ -185,9 +223,11 @@ void socTouchDisplay_step(void)
|
|||
socTouchDisplay_Y.op_bDisplayStatus = true;
|
||||
if ((uint32_T)((int32_T)socTouchDisplay_DW.temporalCounter_i1 * 100) >=
|
||||
(uint32_T)ceil(socTouchDisplay_U.ip_u32DisplayDuration_msec)) {
|
||||
socTouchDisplay_DW.temporalCounter_i1 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_1_g = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay =
|
||||
socTouchDi_IN_waitTillNextTouch;
|
||||
socTouchDis_IN_touchNotDetected;
|
||||
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = false;
|
||||
|
|
@ -197,8 +237,9 @@ void socTouchDisplay_step(void)
|
|||
}
|
||||
break;
|
||||
|
||||
case socTouchDis_IN_touchNotDetected:
|
||||
default:
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
/* case IN_touchNotDetected: */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = false;
|
||||
|
||||
/* Outport: '<Root>/op_bErrorStatus' */
|
||||
|
|
@ -229,24 +270,23 @@ void socTouchDisplay_step(void)
|
|||
|
||||
/* Outport: '<Root>/op_bErrorStatus' */
|
||||
socTouchDisplay_Y.op_bErrorStatus = true;
|
||||
} else {
|
||||
if (!socTouchDisplay_B.Compare) {
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
}
|
||||
|
||||
if ((socTouchDisplay_DW.durationCounter_3 > 20U) &&
|
||||
Memory_PreviousInput) {
|
||||
socTouchDisplay_DW.temporalCounter_i1 = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay =
|
||||
socTouchDisp_IN_chargingDisplay;
|
||||
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Outport: '<Root>/op_bDisplayStatus' */
|
||||
/* case IN_waitTillNextTouch: */
|
||||
socTouchDisplay_Y.op_bDisplayStatus = false;
|
||||
|
||||
/* Outport: '<Root>/op_bErrorStatus' */
|
||||
socTouchDisplay_Y.op_bErrorStatus = false;
|
||||
if (socTouchDisplay_DW.temporalCounter_i1 >= 100U) {
|
||||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
socTouchDisplay_DW.durationCounter_1_g = 0U;
|
||||
socTouchDisplay_DW.is_c3_socTouchDisplay =
|
||||
socTouchDis_IN_touchNotDetected;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,6 +298,12 @@ void socTouchDisplay_step(void)
|
|||
socTouchDisplay_DW.durationCounter_2 = 0U;
|
||||
}
|
||||
|
||||
if (socTouchDisplay_B.Compare) {
|
||||
socTouchDisplay_DW.durationCounter_3++;
|
||||
} else {
|
||||
socTouchDisplay_DW.durationCounter_3 = 0U;
|
||||
}
|
||||
|
||||
/* End of Chart: '<Root>/Chart' */
|
||||
|
||||
/* Outputs for Atomic SubSystem: '<Root>/displayData' */
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void vRTE_MatlabInit(void)
|
|||
void vRTE_MatlabRun(void)
|
||||
{
|
||||
socTouchDisplay_U.in_bTouchDetected = (u32MCAL_gpioRead(GPIOB, DL_GPIO_PIN_17) == DL_GPIO_PIN_17) ? 1 : 0;
|
||||
socTouchDisplay_U.ip_u32DisplayDuration_msec = 2000;
|
||||
socTouchDisplay_U.ip_u32DisplayDuration_msec = 10000;
|
||||
socTouchDisplay_U.ip_u32TouchDuration_msec = 100;
|
||||
socTouchDisplay_U.ip_u32canId = g_u32CanId;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ typedef enum
|
|||
// 1 - Basil Battery Smart
|
||||
// 2 - Basil
|
||||
// 3 - Battery Swapping Station
|
||||
#define UART_PIN_SELECTION 2 // Set the desired UART configuration here
|
||||
#define UART_PIN_SELECTION 1 // Set the desired UART configuration here
|
||||
|
||||
|
||||
volatile int i32TickCnt;
|
||||
|
|
|
|||
Loading…
Reference in New Issue