This commit is contained in:
hamza
2024-07-10 01:39:38 +03:00
parent 4375bfce48
commit a86985bfc9
11 changed files with 217 additions and 41 deletions

View File

@ -11,22 +11,11 @@
#include <stdint.h>
#include <stdbool.h>
#include "ADBMS_LL_Driver.h"
#include "AMS_HighLevel.h"
#include "errors.h"
#include "PWM_control.h"
#include "TMP1075.h"
// Time to wait after reaching 95% of battery voltage before exiting precharge
// Set this to 1000 in scruti to demonstrate the voltage on the multimeter
#define PRECHARGE_DURATION 5000 // ms
// Time to wait for discharge
#define DISCHARGE_DURATION 5000 // ms
// Time to wait for charger voltage before going to TS_ERROR
#define MAX_CHARGING_CHECK_DURATION 2000 // ms
// Time to wait between closing relays
#define RELAY_CLOSE_WAIT 10 // ms
// Max time to wait for CAN messages. If we reach it then we emergency shutdown.
#define CAN_TIMEOUT 100000
#include <AMS_HighLevel.h>
#include <errors.h>
#include <PWM_control.h>
#include <status_LED.h>
#include <TMP1075.h>
typedef enum { // states -> 3 bit. valid transitions: (all could transition to error)
STATE_INACTIVE, // INACTIVE -> PRECHARGE, CHARGING, ERROR