Skip to content

Commit

Permalink
Force canmonitor check time to be 250ms
Browse files Browse the repository at this point in the history
Keep if clause commented since not working properly
Even if canmonitor params are not passed by icub-main
the memory remains dirty and a value different from zero
is passed to the EMS. So we need to force the default config value
and check better the CAN monitor behaviour
  • Loading branch information
MSECode committed Jan 8, 2024
1 parent 96cf51e commit 3004c10
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 153 deletions.
2 changes: 2 additions & 0 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ extern uint16_t time_delay;

extern uint8_t can_message;

extern uint8_t TX_ENABLED;

extern __IO ITStatus UartReady;

extern uint32_t VTH[7];
Expand Down
2 changes: 2 additions & 0 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/global_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ extern uint16_t time_delay;

extern uint8_t can_message;

extern uint8_t TX_ENABLED;

#endif
6 changes: 4 additions & 2 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "BAT_B.h"

char Firmware_vers = 1;
char Revision_vers = 3;
char Build_number = 2;
char Revision_vers = 9;
char Build_number = 9;

uint32_t vtol=100; // voltage tolerance for hysteresis
uint32_t vhyst=0; // voltage hysteresis
Expand Down Expand Up @@ -73,6 +73,8 @@ int32_t Current_board_in_fault = 0;
int32_t Current_HSM_in_fault = 0;
int32_t Current_motor_in_fault = 0;

uint8_t TX_ENABLED = 0;

uint8_t V12board_bdc = 1; // +++++++++++++++++++++++++++++++++++++++++++++ da cambiare logica ++++++++++++++++++
uint8_t V12motor_bdc = 1; // +++++++++++++++++++++++++++++++++++++++++++++ da cambiare logica ++++++++++++++++++

Expand Down
12 changes: 11 additions & 1 deletion emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ uint32_t TxMailbox;
// in the struct we can define the data, which have the same type for all the packets,
// what changes is only the value
// then there'll be a getInstance() sort of method for retrieving the struct
// following the signleton usage in OOP
// following the singleton usage in OOP
// this will help to make code cleaner and avoid duplications
// Instantiate data regarding info of battery pack
CAN_TxHeaderTypeDef TxHeader_620;
Expand Down Expand Up @@ -145,11 +145,21 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
/* Reception Error */
Error_Handler();
}

/* Enable - Disable CAN Transmission from EMS */
if( (RxHeader.IDE == CAN_ID_STD) && ((RxHeader.StdId & 0x700) >> 8) == 2 ) // GOT MESSAGE FROM CLASS ICUBCANPROTO_CLASS_POLLING_ANALOGSENSOR
{
if((RxData[0] & 0x7F) == 7) // GOT MESSAGE OF TYPE ICUBCANPROTO_POL_AS_CMD__SET_TXMODE
{
TX_ENABLED = (RxData[1] == 0) ? 1 : 0;
}
}

/* Display LEDx */
if ((RxHeader.StdId == 0x621) && (RxHeader.IDE == CAN_ID_STD) && (RxHeader.DLC == 8))
{
//LED_Display(RxData[0]);
//ubKeyNumber = RxData[0];
}

}
2 changes: 2 additions & 0 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
}
if(htim->Instance==TIM16){ // timer 100ms
toggle_100ms = toggle_100ms^1;
if(TX_ENABLED == 0)
return;
CANBUS();
}
if(htim->Instance==TIM17){ // timer 1s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR (VERSION_MAJOR_OFFSET+3)
// <o> minor <0-255>
// <o> minor <0-255>
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 82
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 99

// </h>version

Expand Down
Loading

0 comments on commit 3004c10

Please sign in to comment.