Skip to content

Commit

Permalink
Merge pull request #96 from lenvm/feature/add-define-for-contactor-pa…
Browse files Browse the repository at this point in the history
…rameters

Add defines for contactor parameters
  • Loading branch information
lenvm authored Nov 14, 2023
2 parents 1202038 + ea64785 commit 224d2da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,25 @@ const uint8_t maxBrightness = 100;
uint8_t LEDcolor = GREEN;

// Contactor parameters
#ifdef CONTACTOR_CONTROL
enum State { DISCONNECTED, PRECHARGE, NEGATIVE, POSITIVE, PRECHARGE_OFF, COMPLETED, SHUTDOWN_REQUESTED };
State contactorStatus = DISCONNECTED;

#define MAX_ALLOWED_FAULT_TICKS 500
#define PRECHARGE_TIME_MS 160
#define NEGATIVE_CONTACTOR_TIME_MS 1000
#define POSITIVE_CONTACTOR_TIME_MS 2000
#ifdef PWM_CONTACTOR_CONTROL
#define PWM_Freq 20000 // 20 kHz frequency, beyond audible range
#define PWM_Res 10 // 10 Bit resolution 0 to 1023, maps 'nicely' to 0% 100%
#define PWM_Hold_Duty 250
#define POSITIVE_PWM_Ch 0
#define NEGATIVE_PWM_Ch 1
#endif
unsigned long prechargeStartTime = 0;
unsigned long negativeStartTime = 0;
unsigned long timeSpentInFaultedMode = 0;
#endif
uint8_t batteryAllowsContactorClosing = 0;
uint8_t inverterAllowsContactorClosing = 1;

Expand Down

0 comments on commit 224d2da

Please sign in to comment.