This commit is contained in:
hamza
2024-07-07 18:52:54 +03:00
parent e7b5054e02
commit a4a856eb31
14 changed files with 126 additions and 260 deletions

View File

@ -1,3 +1,10 @@
/*
* state_machine.h
*
* Created on: 07.07.2024
* Author: Hamza
*/
#ifndef INC_STATE_MACHINE_H
#define INC_STATE_MACHINE_H
@ -8,17 +15,12 @@
#include "errors.h"
#include "PWM_control.h"
#include "TMP1075.h"
#include <math.h>
// Minimum vehicle side voltage to exit precharge
#define MIN_VEHICLE_SIDE_VOLTAGE 150000 // mV
// 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 3000 // ms
// Time to wait for discharge
#define DISCHARGE_DURATION 3000 // ms
// Time to wait after there is no more error condition before exiting TS_ERROR
#define NO_ERROR_TIME 1000 // 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
@ -91,5 +93,6 @@ void sm_handle_ams_in(const uint8 *data);
void sm_check_errors();
void sm_set_error(ErrorKind error_kind, bool is_errored);
void sm_test_cycle_states();
void sm_error_source();
#endif /* "INC_STATE_MACHINE_H" */