diff --git a/Software/src/charger/CHEVY-VOLT-CHARGER.cpp b/Software/src/charger/CHEVY-VOLT-CHARGER.cpp index 817c606b..36c48b65 100644 --- a/Software/src/charger/CHEVY-VOLT-CHARGER.cpp +++ b/Software/src/charger/CHEVY-VOLT-CHARGER.cpp @@ -19,12 +19,9 @@ */ /* CAN cycles and timers */ -static const int interval30ms = 30; // 30ms cycle for keepalive frames -static const int interval200ms = 200; // 200ms cycle for commanding I/V targets -static const int interval5000ms = 5000; // 5s status printout to serial -static unsigned long previousMillis30ms = 0; -static unsigned long previousMillis200ms = 0; -static unsigned long previousMillis5000ms = 0; +static unsigned long previousMillis30ms = 0; // 30ms cycle for keepalive frames +static unsigned long previousMillis200ms = 0; // 200ms cycle for commanding I/V targets +static unsigned long previousMillis5000ms = 0; // 5s status printout to serial /* voltage and current settings. Validation performed to set ceiling of 3300w vol*cur */ extern volatile float charger_setpoint_HV_VDC; @@ -125,7 +122,7 @@ void send_can_chevyvolt_charger() { uint8_t charger_mode = MODE_DISABLED; /* Send keepalive with mode every 30ms */ - if (currentMillis - previousMillis30ms >= interval30ms) { + if (currentMillis - previousMillis30ms >= INTERVAL_30_MS) { previousMillis30ms = currentMillis; if (charger_HV_enabled) { @@ -148,7 +145,7 @@ void send_can_chevyvolt_charger() { } /* Send current targets every 200ms */ - if (currentMillis - previousMillis200ms >= interval200ms) { + if (currentMillis - previousMillis200ms >= INTERVAL_200_MS) { previousMillis200ms = currentMillis; /* These values should be and are validated elsewhere, but adjust if needed @@ -186,7 +183,7 @@ void send_can_chevyvolt_charger() { #ifdef DEBUG_VIA_USB /* Serial echo every 5s of charger stats */ - if (currentMillis - previousMillis5000ms >= interval5000ms) { + if (currentMillis - previousMillis5000ms >= INTERVAL_5_S) { previousMillis5000ms = currentMillis; Serial.printf("Charger AC in IAC=%fA VAC=%fV\n", charger_stat_ACcur, charger_stat_ACvol); Serial.printf("Charger HV out IDC=%fA VDC=%fV\n", charger_stat_HVcur, charger_stat_HVvol); diff --git a/Software/src/charger/NISSAN-LEAF-CHARGER.cpp b/Software/src/charger/NISSAN-LEAF-CHARGER.cpp index f4925b4e..3318ab4c 100644 --- a/Software/src/charger/NISSAN-LEAF-CHARGER.cpp +++ b/Software/src/charger/NISSAN-LEAF-CHARGER.cpp @@ -20,8 +20,6 @@ */ /* CAN cycles and timers */ -static const uint8_t interval10ms = 10; -static const uint8_t interval100ms = 100; static unsigned long previousMillis10ms = 0; static unsigned long previousMillis100ms = 0; @@ -184,7 +182,7 @@ void send_can_nissanleaf_charger() { unsigned long currentMillis = millis(); /* Send keepalive with mode every 10ms */ - if (currentMillis - previousMillis10ms >= interval10ms) { + if (currentMillis - previousMillis10ms >= INTERVAL_10_MS) { previousMillis10ms = currentMillis; mprun10++; @@ -251,7 +249,7 @@ void send_can_nissanleaf_charger() { } /* Send messages every 100ms here */ - if (currentMillis - previousMillis100ms >= interval100ms) { + if (currentMillis - previousMillis100ms >= INTERVAL_100_MS) { previousMillis100ms = currentMillis; mprun100++;