Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7847df8
SFT-121 Generating code for aux bms v2
badeniran Jul 25, 2020
e1bbfa4
SFT 167. Defined and initialized variables
badeniran Jul 25, 2020
5095c64
Merge pull request #164 from UCSolarCarTeam/user/embedded/SFT-167-Def…
badeniran Aug 8, 2020
837f399
SFT-175. Contactor control code and unit tests.
badeniran Aug 8, 2020
20cdd23
Merge pull request #168 from UCSolarCarTeam/user/embedded/SFT-175-Cre…
badeniran Sep 12, 2020
1e807d8
SFT-189 CAN Interrupt and Filter Config
badeniran Sep 12, 2020
fd03b21
Merge pull request #169 from UCSolarCarTeam/user/embedded/SFT-189-Do-…
badeniran Sep 12, 2020
be0972a
Implemeted Read Aux Voltage Task
badeniran Sep 26, 2020
cc10aaa
SFT-190. Create functions and unit tests for orion work.
badeniran Sep 12, 2020
fd3a335
Merge pull request #175 from UCSolarCarTeam/user/embedded/SFT-190-cre…
badeniran Nov 3, 2020
b1473fa
SFT 200. Creating tasks relating to CAN Tx work.
badeniran Sep 26, 2020
3add054
Merge branch 'feature/aux-bms-rearchitecture' into user/embedded/SFT-…
badeniran Nov 8, 2020
e1df3c1
Merge pull request #177 from UCSolarCarTeam/user/embedded/SFT-200-Cre…
badeniran Nov 8, 2020
e5b4e3a
Merge branch 'feature/aux-bms-rearchitecture' of https://github.com/U…
badeniran Nov 8, 2020
24f746d
Finished dev work. Need to do unit tests
badeniran Nov 27, 2020
4e8ffcc
SFT 202. Functions and tests for aux voltage read.
badeniran Nov 27, 2020
a79efd9
Merge pull request #178 from UCSolarCarTeam/user/embedded/SFT-202-Cre…
badeniran Nov 28, 2020
22b52da
Adding unit tests
badeniran Nov 28, 2020
3ddc09c
Merge pull request #179 from UCSolarCarTeam/user/embedded/SFT-202-Cre…
badeniran Nov 28, 2020
1487dbb
SFT 203. Implementing error handling
badeniran Nov 28, 2020
e34e603
Merge pull request #181 from UCSolarCarTeam/user/embedded/SFT-203/imp…
badeniran Nov 28, 2020
8469703
SFT 204. Implemented memory debug task
badeniran Nov 28, 2020
c4cf94f
Merge pull request #182 from UCSolarCarTeam/user/embedded/SFT-204/imp…
badeniran Nov 28, 2020
1ce5656
Removed magic numbers. Added unit tests to travis.
badeniran Dec 5, 2020
2a5fa76
Changing travis for auxbmsv2
badeniran Dec 5, 2020
ac31247
Changed travis back. Trying using our own round function
badeniran Dec 5, 2020
c01fa81
made round function comment clearer
badeniran Dec 5, 2020
b3e8388
Merge pull request #184 from UCSolarCarTeam/user/badeniran/aux-bms-cl…
badeniran Jan 8, 2021
b03ae6f
Initial fixes done. At a stable state
badeniran Jan 29, 2021
f8297c1
Pushed up to OrionInterfaceTaskTest. Need to generate mocks for Trip.c
badeniran Jan 30, 2021
1bda236
remocked trip.c, fix Trip and OrionInterface tests
JessieG123 Jan 30, 2021
129f555
created test for updateAuxTrip
JessieG123 Jan 30, 2021
005e8ff
Fix TripTest.c
Feb 5, 2021
4c79f8b
Add two more tests for updateAuxTrip
Feb 5, 2021
c285b92
Fix unneccessary way of calling checkProtectionTrip
Feb 5, 2021
ebd6589
Run remaining tests
Feb 5, 2021
3fe947c
Split tripDuetoHighTempAndCurrent into two variables
Feb 26, 2021
6b59276
Removing checkProtectionTrip()
Mar 5, 2021
4aeea47
Simplify checkDischargeTrip and checkChargeTrip
Mar 5, 2021
af152c3
add mocks for trip
JessieG123 Mar 5, 2021
cd74684
Redoing OrionInterfaceTest
Mar 13, 2021
6e3c5a7
Add shouldDisconnectContactors test
Mar 13, 2021
fac559f
Initial fixes done. At a stable state
badeniran Jan 29, 2021
06c8b73
Pushed up to OrionInterfaceTaskTest. Need to generate mocks for Trip.c
badeniran Jan 30, 2021
da4ffd0
remocked trip.c, fix Trip and OrionInterface tests
JessieG123 Jan 30, 2021
d9c53db
created test for updateAuxTrip
JessieG123 Jan 30, 2021
91412c6
Fix TripTest.c
Feb 5, 2021
cd549f2
Add two more tests for updateAuxTrip
Feb 5, 2021
cb0ac31
Fix unneccessary way of calling checkProtectionTrip
Feb 5, 2021
083cb37
Run remaining tests
Feb 5, 2021
ec21b70
Split tripDuetoHighTempAndCurrent into two variables
Feb 26, 2021
74d4ead
Removing checkProtectionTrip()
Mar 5, 2021
d6fb466
Simplify checkDischargeTrip and checkChargeTrip
Mar 5, 2021
e3d966f
add mocks for trip
JessieG123 Mar 5, 2021
813bdda
Redoing OrionInterfaceTest
Mar 13, 2021
64cc882
Add shouldDisconnectContactors test
Mar 13, 2021
76dca24
Finish tests
Mar 14, 2021
6e0db6b
Change to contactorControlEvenFlags to defined macros
Mar 14, 2021
9a692dd
Merge branch 'feature/aux-bms-rearchitecture' into user/embedded/pull…
duan-le Mar 14, 2021
7170db6
Merge pull request #188 from UCSolarCarTeam/user/embedded/pull-reques…
duan-le Mar 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ STM32L152-Discovery.elf.launch
*.tmp

# Other
.tags
.tags*
*swap
.fuse*
.vscode/
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ script:
- (cd EpsilonDriverControls && make)
- (cd EpsilonCCS && make)
- (cd EpsilonAuxBMS && ./make.sh)
- (cd EpsilonAuxBmsV2 && ./make.sh)
- "! (./format.sh EpsilonCCS | grep Formatted)"
- "! (./format.sh EpsilonLights | grep Formatted)"
- "! (./format.sh EpsilonDriverControls | grep Formatted)"
- "! (./format.sh EpsilonAuxBMS | grep Formatted)"
- "! (./format.sh EpsilonAuxBmsV2 | grep Formatted)"

language: c
225 changes: 115 additions & 110 deletions EpsilonAuxBMS/Tests/mocks/MockStateFunctionsShared.c

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/AuxBmsConstants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

static const unsigned int MUTEX_TIMEOUT = 100; // 100ms
static const unsigned int TASK_QUEUE_PUT_TIMEOUT = 0; // 0ms
static const unsigned int IRQ_QUEUE_PUT_TIMEOUT = 0; // 0ms

#define AUX_BMS_SPI_BUFFER_SIZE 2U // Done so that the arrays don't complain about variable array size
8 changes: 8 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/ContactorEventFlags.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#define COMMON_CLOSED (0x1 << 0) // 000001
#define COMMON_OPENED (0x1 << 1) // 000010
#define CHARGE_CLOSED (0x1 << 2) // 000100
#define CHARGE_OPENED (0x1 << 3) // 001000
#define DISCHARGE_CLOSED (0x1 << 4) // 010000
#define DISCHARGE_OPENED (0x1 << 5) // 100000
162 changes: 162 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/* USER CODE BEGIN Header */
/*
* FreeRTOS Kernel V10.2.1
* Portion Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Portion Copyright (C) 2019 StMicroelectronics, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/* USER CODE END Header */

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* These parameters and more are described within the 'configuration' section of the
* FreeRTOS API documentation available on the FreeRTOS.org web site.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/

/* USER CODE BEGIN Includes */
/* Section where include file can be added */
/* USER CODE END Includes */

/* Ensure definitions are only used by the compiler, and not by the assembler. */
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
#include <stdint.h>
extern uint32_t SystemCoreClock;
#endif
#define configENABLE_FPU 0
#define configENABLE_MPU 0

#define configUSE_PREEMPTION 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES ( 56 )
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)15360)
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configRECORD_STACK_HIGH_ADDRESS 1
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
/* Defaults to size_t for backward compatibility, but can be changed
if lengths will always be less than the number of bytes in a size_t. */
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
/* USER CODE END MESSAGE_BUFFER_LENGTH_TYPE */

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH 256

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
#define INCLUDE_eTaskGetState 1

/*
* The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
* by the application thus the correct define need to be enabled below
*/
#define USE_FreeRTOS_HEAP_4

/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 4
#endif

/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15

/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5

/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
/* USER CODE BEGIN 1 */
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
/* USER CODE END 1 */

/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler

/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */

#define xPortSysTickHandler SysTick_Handler

/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
/* USER CODE END Defines */

#endif /* FREERTOS_CONFIG_H */
15 changes: 15 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/CanRxInterruptParserTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "cmsis_os.h"
#include "CanRxQueueData.h"
#include "OrionCanInfo.h"

extern osMessageQueueId_t orionInterfaceQueue;
extern osMessageQueueId_t canRxParserQueue;

// CAN Rx STDIDs
static const uint32_t ORION_HIGH_LOW_VOLTAGES_STDID = 0x305;
static const uint32_t ORION_TEMP_INFO_STDID = 0x304;
static const uint32_t ORION_PACK_INFO_STDID = 0x302;

void canRxInterruptParserTask(void* arg);
void canRxInterruptParser(OrionCanInfo* queueData, CanRxQueueData* canQueueData);
7 changes: 7 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/CanTxGatekeeperTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once
#include "cmsis_os.h"
#include "SendCan.h"
void canTxGatekeeperTask(void* arg);
void canTxGatekeeper(CanTxGatekeeperQueueData* canTxQueueData);

extern CAN_HandleTypeDef hcan1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "ContactorGatekeeper.h"

extern osThreadId_t chargeContactorGatekeeperTaskHandle;

void closeChargeContactor();
void openChargeContactor();
void chargeContactorGatekeeperTask(void* arg);
void chargeContactorGatekeeper();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "ContactorGatekeeper.h"

extern osThreadId_t commonContactorGatekeeperTaskHandle;

void commonContactorGatekeeperTask(void* arg);
void commonContactorGatekeeper();
void closeCommonContactor();
void openCommonContactor();
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once
#include "main.h"
#include "ContactorState.h"

uint8_t isContactorError( uint8_t contactorSense, ContactorState contactorState);
11 changes: 11 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/ContactorFunctions/CheckCurrent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once
#include "stm32f4xx_hal.h"

extern ADC_HandleTypeDef hadc1;

static const float CURRENT_SENSE_RESISTOR = 0.001; // 1 mOhm
static const int GAIN = 250;
static const float CURRENT_LOWER_THRESHOLD = 0.25; // Lower current threshold (A)
static const uint32_t ADC_POLL_TIMEOUT = 10;

uint8_t isCurrentLow(uint8_t numContactorsClosed);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#include "cmsis_os.h"
#include "ContactorEventFlags.h"
#include "ContactorState.h"

extern osEventFlagsId_t contactorControlEventBits;
extern AuxBmsContactorState auxBmsContactorState;
extern osThreadId_t commonContactorGatekeeperTaskHandle;
extern osThreadId_t chargeContactorGatekeeperTaskHandle;
extern osThreadId_t dischargeContactorGatekeeperTaskHandle;

void disconnectContactors();
11 changes: 11 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/ContactorGatekeeper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once
#include "cmsis_os.h"
#include "CheckCurrent.h"
#include "ContactorState.h"
#include "ContactorEventFlags.h"
#include "main.h"

extern osEventFlagsId_t contactorControlEventBits;
extern AuxBmsContactorState auxBmsContactorState;

static const unsigned int CONTACTOR_DELAY = 1000; // 1s
17 changes: 17 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/ContactorStatusUpdateTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include "cmsis_os.h"
#include "ContactorState.h"
#include "ContactorEventFlags.h"
#include "DisconnectContactors.h"
#include "AuxStatus.h"
#include "main.h"
#include "CheckContactorError.h"

static const int CONTACTOR_STATUS_UPDATE_FREQ = 100; //100ms 10HZ
extern AuxBmsContactorState auxBmsContactorState;
extern osMutexId_t auxStatusContactorStatusUpdateMutex;
extern AuxStatus auxStatus;

void contactorStatusUpdateTask(void* arg);

void contactorStatusUpdate(uint32_t* prevWakeTime);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "ContactorGatekeeper.h"

extern osThreadId_t dischargeContactorGatekeeperTaskHandle;

void dischargeContactorGatekeeperTask(void* arg);
void closeDischargeContactor();
void openDischargeContactor();
void dischargeContactorGatekeeper();
20 changes: 20 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/MemoryDebugTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "cmsis_os.h"
#include "main.h"

void memoryDebugTask(void* arg);

static const unsigned int MEMORY_DEBUG_TASK_FREQ = 1000; // 1s

extern osThreadId_t startupTaskHandle;
extern osThreadId_t canRxInterruptParserTaskHandle;
extern osThreadId_t orionInterfaceTaskHandle;
extern osThreadId_t canTxGatekeeperTaskHandle;
extern osThreadId_t sendAuxStatusTaskHandle;
extern osThreadId_t sendAuxTripTaskHandle;
extern osThreadId_t sendHeartbeatTaskHandle;
extern osThreadId_t commonContactorGatekeeperTaskHandle;
extern osThreadId_t chargeContactorGatekeeperTaskHandle;
extern osThreadId_t dischargeContactorGatekeeperTaskHandle;
extern osThreadId_t contactorStatusUpdateTaskHandle;
extern osThreadId_t readAuxVoltageTaskHandle;
15 changes: 15 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/OrionFunctions/OrionConstants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
// These values are subject to change based on what regulations say
// Ask electrical if any issues
static const float ORION_MAX_CELL_VOLTAGE = 4.20; // Much match orion bms value
static const float ORION_MIN_CELL_VOLTAGE = 2.55;
static const float AUX_BMS_MAX_CELL_VOLTAGE = 4.15;
static const float AUX_BMS_MIN_CELL_VOLTAGE = 2.60;

static const float DEFAULT_VOLTAGE_UNITS = 0.0001; // From: https://www.orionbms.com/manuals/utility/

static const int ORION_MAX_CHARGE_TEMP = 44;
static const short ORION_MAX_CHARGE_CURRENT = -47;

static const int ORION_MAX_DISCHARGE_TEMP = 59;
static const short ORION_MAX_DISCHARGE_CURRENT = 229;
9 changes: 9 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/OrionFunctions/Trip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "main.h"
#include "OrionCanInfo.h"
#include "AuxTrip.h"
#include "OrionConstants.h"

void updateAuxTrip(OrionCanInfo* message, AuxTrip* auxTripToUpdate);
uint8_t checkDischargeTrip(AuxTrip auxTrip);
uint8_t checkChargeTrip(AuxTrip auxTrip);
25 changes: 25 additions & 0 deletions EpsilonAuxBmsV2/Core/Inc/Tasks/OrionInterfaceTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
#include "cmsis_os.h"
#include "ContactorGatekeeper.h"
#include "OrionCanInfo.h"
#include "AuxStatus.h"
#include "AuxTrip.h"
#include "DisconnectContactors.h"
#include "Trip.h"

void orionInterfaceTask(void* arg);
void orionInterface(OrionCanInfo* message);
void updateAuxStatus(AuxStatus* auxStatusToRead);
void updateAllowChargeAndAllowDischarge(OrionCanInfo* message, AuxStatus* auxStatusToUpdate);

AuxStatus localAuxStatus;
AuxTrip localAuxTrip;

extern osMessageQueueId_t orionInterfaceQueue;
extern AuxStatus auxStatus;
extern AuxTrip auxTrip;
extern AuxBmsContactorState auxBmsContactorState;
extern osMutexId_t auxStatusOrionInterfaceMutex;
extern osMutexId_t auxTripMutex;

static const uint32_t ORION_QUEUE_TIMEOUT = 400; // 400ms. We expect CAN messages from Orion every 200ms, so if we miss 2 messages, we can timeout the wait
Loading