Skip to content

Commit

Permalink
replace ECVF_AMMETER_CAL with ECVF_MENNEKES_MANUAL
Browse files Browse the repository at this point in the history
  • Loading branch information
lincomatic committed Dec 2, 2021
1 parent 45a004e commit 5dde798
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion firmware/open_evse/J1772EvseController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,11 @@ if (TempChkEnabled()) {
ReadVoltmeter();
#endif // VOLTMETER
#ifdef AMMETER
if (((m_EvseState == EVSE_STATE_C) && (m_CurrentScaleFactor > 0)) || AmmeterCalEnabled()) {
if (((m_EvseState == EVSE_STATE_C) && (m_CurrentScaleFactor > 0))
#ifdef ECVF_AMMETER_CAL
|| AmmeterCalEnabled()
#endif
) {

#ifndef FAKE_CHARGING_CURRENT
readAmmeter();
Expand Down
4 changes: 3 additions & 1 deletion firmware/open_evse/J1772EvseController.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ typedef uint8_t (*EvseStateTransitionReqFunc)(uint8_t prevPilotState,uint8_t cur
#define ECVF_TIMER_ON 0x1000 // delay timer enabled
#define ECVF_CHARGE_LIMIT 0x2000
// reserved #define ECVF_BOOT_LOCK 0x4000 // locked at boot
#define ECVF_AMMETER_CAL 0x8000
#define ECVF_MENNEKES_MANUAL 0x8000 // Mennekes lock manual mode
#if defined(AUTH_LOCK) && (AUTH_LOCK != 0)
#define ECVF_DEFAULT ECVF_AUTH_LOCKED|ECVF_SESSION_ENDED
#else
Expand Down Expand Up @@ -470,13 +470,15 @@ int GetHearbeatTrigger();
m_CurrentScaleFactor = scale;
eeprom_write_word((uint16_t*)EOFS_CURRENT_SCALE_FACTOR,scale);
}
#ifdef ECVF_AMMETER_CAL
uint8_t AmmeterCalEnabled() {
return vFlagIsSet(ECVF_AMMETER_CAL);
}
void EnableAmmeterCal(uint8_t tf) {
if (tf) setVFlags(ECVF_AMMETER_CAL);
else clrVFlags(ECVF_AMMETER_CAL);
}
#endif // ECVF_AMMETER_CAL
void ZeroChargingCurrent() { m_ChargingCurrent = 0; }
uint8_t GetInstantaneousChargingAmps() {
readAmmeter();
Expand Down
6 changes: 5 additions & 1 deletion firmware/open_evse/open_evse.ino
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,11 @@ void OnboardDisplay::Update(int8_t updmode)

#ifdef LCD16X2
#if defined(AMMETER)
if (((curstate == EVSE_STATE_C) || g_EvseController.AmmeterCalEnabled()) && AmmeterIsDirty()) {
if (((curstate == EVSE_STATE_C)
#ifdef ECVF_AMMETER_CAL
|| g_EvseController.AmmeterCalEnabled()
#endif
) && AmmeterIsDirty()) {
SetAmmeterDirty(0);

uint32_t current = g_EvseController.GetChargingCurrent();
Expand Down
4 changes: 2 additions & 2 deletions firmware/open_evse/rapi_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,14 @@ int EvseRapiProcessor::processCmd()
}
break;
#endif // RTC
#ifdef AMMETER
#if defined(AMMETER) && defined(ECVF_AMMETER_CAL)
case '2': // ammeter calibration mode
if (tokenCnt == 2) {
g_EvseController.EnableAmmeterCal((*tokens[1] == '1') ? 1 : 0);
rc = 0;
}
break;
#endif // AMMETER
#endif // AMMETER && ECVF_AMMETER_CAL
#ifdef TIME_LIMIT
case '3': // set time limit
if (tokenCnt == 2) {
Expand Down

0 comments on commit 5dde798

Please sign in to comment.