Skip to content

Commit

Permalink
Feature/fw updater bat (robotology#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSECode committed Jan 22, 2024
1 parent 6611c34 commit c24e3eb
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace embot { namespace app { namespace eth {
.property =
{
Process::eApplication,
{1, 8},
{2023, Month::Dec, Day::fourteen, 18, 45}
{1, 9},
{2024, Month::Jan, Day::eight, 18, 00}
},
.OStick = 1000*embot::core::time1microsec,
.OSstacksizeinit = 10*1024,
Expand Down
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
4 changes: 3 additions & 1 deletion 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 @@ -11,7 +11,7 @@

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

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,21 +81,21 @@ 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 83

// </h>version

// <h> build date
// <o> year <2010-2030>
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2023
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2024
// <o> month <1-12>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 11
#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 1
// <o> day <1-31>
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 29
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 8
// <o> hour <0-23>
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 13
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 18
// <o> minute <0-59>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 49
#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 00
// </h>build date
// </h>Info

Expand Down
Loading

0 comments on commit c24e3eb

Please sign in to comment.