diff --git a/CHANGELOG b/CHANGELOG index 328ed0cd..50c61359 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ Change Log +SCL20150605 +-> promote to v3.9.0 in stable branch -vD3.9.0 SCL 20150604 +vD3.9.0 SCL 20150604-5 - split out Gfi/J1772Pilot/J1772EvseController into separate files - add support for changing I2C frequency - increase I2C bus from 100KHz -> 200KHz @@ -21,6 +23,13 @@ vD3.9.0 SCL 20150604 EVSE in Sleep state - send $WF WIFI_MODE_AP_DEFAULT instead of WIFI_MODE_AP to client on very long button press +- fix RAPI bug: $GF was returning FF as trip counts if zero. New max value for + any trip count = FE +- fix documentation for $SC & $GG +- got rid of superfluous AUTOSTART_MENU and MANUALSTART code +- fixes for TEMPERATURE_MONITORING from CraigK +- fix bugs in Charging screen when KWH_RECORDING or TEMPERATURE_MONITORING not defined + v3.8.4 SCL 20150526 -> pushed to stable branch diff --git a/J1772EvseController.cpp b/J1772EvseController.cpp index ed50be7a..324ef9aa 100644 --- a/J1772EvseController.cpp +++ b/J1772EvseController.cpp @@ -18,7 +18,11 @@ */ #include "open_evse.h" - +#ifdef FT_ENDURANCE +int g_CycleCnt = -1; +long g_CycleHalfStart; +uint8_t g_CycleState; +#endif THRESH_DATA g_DefaultThreshData = {875,780,690,0,260}; @@ -354,19 +358,6 @@ void J1772EVSEController::EnableAutoSvcLevel(uint8_t tf) #endif // ADVPWR -// Functions to support Auto Start feature - GoldServe -#ifdef MANUALSTART -void J1772EVSEController::EnableAutoStart(uint8_t tf) -{ - if (tf) { - m_wFlags &= ~ECF_AUTO_START_DISABLED; - } - else { - m_wFlags |= ECF_AUTO_START_DISABLED; - } - SaveEvseFlags(); -} -#endif //#ifdef MANUALSTART void J1772EVSEController::EnableSerDbg(uint8_t tf) { if (tf) { @@ -902,15 +893,11 @@ void J1772EVSEController::Init() SetSvcLevel(svclvl); - // Start Manual Start Feature - GoldServe -#ifdef MANUALSTART - if (AutoStartEnabled()){ - Enable(); - } else { +#ifdef DELAYTIMER + if (g_DelayTimer.IsTimerEnabled()) { Sleep(); } -#endif //#ifdef MANUALSTART - // End Manual Start Feature - GoldServe +#endif g_OBD.SetGreenLed(0); } @@ -993,7 +980,7 @@ void J1772EVSEController::Update() chargingOff(); // open the relay - if ((prevevsestate != EVSE_STATE_NO_GROUND) && (m_NoGndTripCnt < 254)) { + if ((prevevsestate != EVSE_STATE_NO_GROUND) && (m_NoGndTripCnt < 253)) { m_NoGndTripCnt++; eeprom_write_byte((uint8_t*)EOFS_NOGND_TRIP_CNT,m_NoGndTripCnt); } @@ -1043,7 +1030,7 @@ void J1772EVSEController::Update() ((curms - m_StuckRelayStartTimeMS) > STUCK_RELAY_DELAY) ) || // start delay de-bounce (prevevsestate == EVSE_STATE_STUCK_RELAY) ) { // already in error state // stuck relay - if ((prevevsestate != EVSE_STATE_STUCK_RELAY) && (m_StuckRelayTripCnt < 254)) { + if ((prevevsestate != EVSE_STATE_STUCK_RELAY) && (m_StuckRelayTripCnt < 253)) { m_StuckRelayTripCnt++; eeprom_write_byte((uint8_t*)EOFS_STUCK_RELAY_TRIP_CNT,m_StuckRelayTripCnt); } @@ -1063,7 +1050,7 @@ void J1772EVSEController::Update() m_EvseState = EVSE_STATE_GFCI_FAULT; if (prevevsestate != EVSE_STATE_GFCI_FAULT) { // state transition - if (m_GfiTripCnt < 254) { + if (m_GfiTripCnt < 253) { m_GfiTripCnt++; eeprom_write_byte((uint8_t*)EOFS_GFI_TRIP_CNT,m_GfiTripCnt); } @@ -1367,19 +1354,23 @@ void J1772EVSEController::Update() #ifdef TEMPERATURE_MONITORING if (m_ElapsedChargeTime != m_ElapsedChargeTimePrev) { + uint8_t currcap = eeprom_read_byte((uint8_t*) ((GetCurSvcLevel() == 2) ? EOFS_CURRENT_CAPACITY_L2 : EOFS_CURRENT_CAPACITY_L1)); + uint8_t setit = 0; g_TempMonitor.Read(); if (!g_TempMonitor.OverTemperature() && ((g_TempMonitor.m_TMP007_temperature >= TEMPERATURE_INFRARED_THROTTLE_DOWN ) || // any sensor reaching threshold trips action (g_TempMonitor.m_MCP9808_temperature >= TEMPERATURE_AMBIENT_THROTTLE_DOWN ) || (g_TempMonitor.m_DS3231_temperature >= TEMPERATURE_AMBIENT_THROTTLE_DOWN ))) { // Throttle back the L2 current advice to the EV g_TempMonitor.SetOverTemperature(1); - SetCurrentCapacity(g_TempMonitor.m_ampacity / 2,0,1); // set L2 to the throttled back level + currcap /= 2; // set to the throttled back level + setit = 1; } if (g_TempMonitor.OverTemperature() && ((g_TempMonitor.m_TMP007_temperature <= TEMPERATURE_INFRARED_RESTORE_AMPERAGE ) && // all sensors need to show return to lower levels (g_TempMonitor.m_MCP9808_temperature <= TEMPERATURE_AMBIENT_RESTORE_AMPERAGE ) && (g_TempMonitor.m_DS3231_temperature <= TEMPERATURE_AMBIENT_RESTORE_AMPERAGE ))) { // restore the original L2 current advice to the EV g_TempMonitor.SetOverTemperature(0); - SetCurrentCapacity(g_TempMonitor.m_ampacity,0,1); // set L2 to the user's original setting for L2 current + + setit = 1; // set to the user's original setting for current } @@ -1387,16 +1378,24 @@ void J1772EVSEController::Update() (g_TempMonitor.m_MCP9808_temperature >= TEMPERATURE_AMBIENT_SHUTDOWN ) || (g_TempMonitor.m_DS3231_temperature >= TEMPERATURE_AMBIENT_SHUTDOWN ))) { // Throttle back the L2 current advice to the EV g_TempMonitor.SetOverTemperatureShutdown(1); - SetCurrentCapacity(g_TempMonitor.m_ampacity / 4,0,1); + currcap /= 4; + setit = 1; } if (g_TempMonitor.OverTemperatureShutdown() && ((g_TempMonitor.m_TMP007_temperature <= TEMPERATURE_INFRARED_THROTTLE_DOWN ) && // all sensors need to show return to lower levels (g_TempMonitor.m_MCP9808_temperature <= TEMPERATURE_AMBIENT_THROTTLE_DOWN ) && (g_TempMonitor.m_DS3231_temperature <= TEMPERATURE_AMBIENT_THROTTLE_DOWN ))) { // restore the throttled down current advice to the EV since things have cooled down again g_TempMonitor.SetOverTemperatureShutdown(0); - SetCurrentCapacity(g_TempMonitor.m_ampacity / 2,0,1); // set L2 to the throttled back level - m_Pilot.SetPWM(m_CurrentCapacity); + + currcap /= 2; // set to the throttled back level + setit = 1; } + if (setit) { + SetCurrentCapacity(currcap,0,1); + if (m_Pilot.GetState() != PILOT_STATE_PWM) { + m_Pilot.SetPWM(m_CurrentCapacity); + } + } } #endif // TEMPERATURE_MONITORING #ifdef CHARGE_LIMIT diff --git a/J1772EvseController.h b/J1772EvseController.h index 7ace3f50..25ae741d 100644 --- a/J1772EvseController.h +++ b/J1772EvseController.h @@ -273,6 +273,7 @@ class J1772EVSEController { #ifdef GFI void SetGfiTripped(); uint8_t GfiTripped() { return m_bVFlags & ECVF_GFI_TRIPPED; } + uint8_t GetGfiTripCnt() { return m_GfiTripCnt; } #ifdef GFI_SELFTEST uint8_t GfiSelfTestEnabled() { return (m_wFlags & ECF_GFI_TEST_DISABLED) ? 0 : 1; @@ -283,13 +284,6 @@ class J1772EVSEController { uint8_t SerDbgEnabled() { return (m_wFlags & ECF_SERIAL_DBG) ? 1 : 0; } - // Function to suppport Auto Start feature - GoldServe -#ifdef MANUALSTART - void EnableAutoStart(uint8_t tf); - uint8_t AutoStartEnabled() { - return (m_wFlags & ECF_AUTO_START_DISABLED) ? 0 : 1; - } -#endif //ifdef MANUALSTART void EnableSerDbg(uint8_t tf); #ifdef RGBLCD int SetBacklightType(uint8_t t,uint8_t update=1); // BKL_TYPE_XXX @@ -344,6 +338,16 @@ class J1772EVSEController { #ifdef SHOW_DISABLED_TESTS void ShowDisabledTests(); #endif +#ifdef ADVPWR + uint8_t GetNoGndTripCnt() { return m_NoGndTripCnt; } + uint8_t GetStuckRelayTripCnt() { return m_StuckRelayTripCnt; } +#endif // ADVPWR }; +#ifdef FT_ENDURANCE +extern int g_CycleCnt; +extern long g_CycleHalfStart; +extern uint8_t g_CycleState; +#endif + extern J1772EVSEController g_EvseController; diff --git a/open_evse.h b/open_evse.h index 686d3056..7c0e7f33 100644 --- a/open_evse.h +++ b/open_evse.h @@ -99,15 +99,16 @@ #define GFI_SELFTEST #endif //UL_GFI_SELFTEST - -// Temperature monitoring support // comment out both TEMPERATURE_MONITORING and KWH_RECORDING to have the elapsed time and time of day displayed on the second line of the LCD -#define TEMPERATURE_MONITORING +#define TEMPERATURE_MONITORING // Temperature monitoring support #ifdef AMMETER // kWh Recording feature depends upon #AMMETER support +// comment out KWH_RECORDING to have the elapsed time and time of day displayed on the second line of the LCD #define KWH_RECORDING +#ifdef KWH_RECORDING // stop charging after a certain kWh reached #define CHARGE_LIMIT +#endif // KWH_RECORDING #endif //AMMETER //Adafruit RGBLCD (MCP23017) - can have RGB or monochrome backlight @@ -162,19 +163,10 @@ // Option for Delay Timer - GoldServe #define DELAYTIMER -// Option for AutoStart Menu. If defined, ManualStart feature is also defined by default - GoldServe -//#define AUTOSTART_MENU - #if defined(DELAYTIMER) && defined(BTN_MENU) #define DELAYTIMER_MENU #endif -// AutoStart feature must be defined if Delay Timers are used - GoldServe -#if defined(DELAYTIMER)||defined(AUTOSTART_MENU) -// Option for AutoStart Enable/Disable - GoldServe -#define MANUALSTART -#endif - #endif // RTC // if defined, this pin goes HIGH when the EVSE is sleeping, and LOW otherwise @@ -750,8 +742,6 @@ class TempMonitor { #ifdef TMP007_IS_ON_I2C Adafruit_TMP007 m_tmp007; #endif //TMP007_IS_ON_I2C - - uint8_t m_ampacity; // using this to keep track of the user's original ampacity to restore after temperature monitoring has throttled it to a lower value // these three temperatures need to be signed integers int16_t m_MCP9808_temperature; // 230 means 23.0C Using an integer to save on floating point library use int16_t m_DS3231_temperature; // the DS3231 RTC has a built in temperature sensor @@ -923,16 +913,6 @@ class BklTypeMenu : public Menu { }; #endif // RGBLCD -#ifdef AUTOSTART_MENU -class AutoStartMenu : public Menu { -public: - AutoStartMenu(); - void Init(); - void Next(); - Menu *Select(); -}; -#endif //#ifdef AUTOSTART_MENU - #if defined(DELAYTIMER) class RTCMenu : public Menu { public: @@ -1139,6 +1119,9 @@ extern char g_sSpace[]; #define g_sSpace " " +#ifdef DELAYTIMER +extern DelayTimer g_DelayTimer; +#endif #ifdef BTN_MENU extern BtnHandler g_BtnHandler; extern SettingsMenu g_SettingsMenu; diff --git a/open_evse.ino b/open_evse.ino index 192f0f7b..53023151 100644 --- a/open_evse.ino +++ b/open_evse.ino @@ -76,9 +76,6 @@ RlyChkMenu g_RlyChkMenu; #endif // ADVPWR ResetMenu g_ResetMenu; // Instantiate additional Menus - GoldServe -#ifdef AUTOSTART_MENU -AutoStartMenu g_AutoStartMenu; -#endif //#ifdef AUTOSTART_MENU #if defined(DELAYTIMER_MENU) RTCMenu g_RTCMenu; RTCMenuMonth g_RTCMenuMonth; @@ -111,9 +108,6 @@ Menu *g_SettingsMenuList[] = { #ifdef DELAYTIMER_MENU &g_DelayMenu, #endif // DELAYTIMER_MENU -#ifdef AUTOSTART_MENU - &g_AutoStartMenu, -#endif // AUTOSTART_MENU &g_SetupMenu, &g_ResetMenu, NULL @@ -191,11 +185,6 @@ unsigned long g_WattHours_accumulated; unsigned long g_WattSeconds; #endif // KWH_RECORDING -#ifdef FT_ENDURANCE -int g_CycleCnt = -1; -long g_CycleHalfStart; -uint8_t g_CycleState; -#endif //-- end global variables @@ -268,8 +257,6 @@ void TempMonitor::Init() #ifdef TMP007_IS_ON_I2C m_tmp007.begin(); #endif // TMP007_IS_ON_I2C - - m_ampacity = g_EvseController.GetCurrentCapacity(); // Need to keep track of the user's original ampacity setting since temperature monitoring will throttle it back and need to later restore it } void TempMonitor::Read() @@ -376,7 +363,7 @@ void OnboardDisplay::Init() #else LcdPrint_P(0,PSTR("Open EVSE")); #endif - LcdPrint_P(0,1,PSTR("Version ")); + LcdPrint_P(0,1,PSTR("Ver. ")); LcdPrint_P(VERSTR); delay(1500); WDT_RESET(); @@ -454,7 +441,7 @@ void OnboardDisplay::Update(int8_t updmode) if (g_EvseController.StateTransition() || (updmode != OBD_UPD_NORMAL)) { curms += 1000; // trigger periodic update code below - + sprintf(g_sTmp,g_sRdyLAstr,(int)svclvl,currentcap); switch(curstate) { case EVSE_STATE_A: // not connected @@ -474,11 +461,11 @@ void OnboardDisplay::Update(int8_t updmode) #ifdef KWH_RECORDING sprintf(g_sTmp,"%5luWh",(g_WattSeconds / 3600) ); LcdPrint(0,1,g_sTmp); - + sprintf(g_sTmp,"%6lukWh",(g_WattHours_accumulated / 1000)); // display accumulated kWh LcdPrint(7,1,g_sTmp); #endif // KWH_RECORDING - + #endif //Adafruit RGB LCD // n.b. blue LED is off break; @@ -505,17 +492,17 @@ void OnboardDisplay::Update(int8_t updmode) #endif //#ifdef DELAYTIMER LcdPrint_P(g_psEvConnected); LcdPrint(10,0,g_sTmp); - + #ifdef KWH_RECORDING sprintf(g_sTmp,"%5luWh",(g_WattSeconds / 3600) ); LcdPrint(0,1,g_sTmp); - + sprintf(g_sTmp,"%6lukWh",(g_WattHours_accumulated / 1000)); // Display accumulated kWh LcdPrint(7,1,g_sTmp); #endif // KWH_RECORDING - + #endif //Adafruit RGB LCD - // n.b. blue LED is off + // n.b. blue LED is off break; case EVSE_STATE_C: // charging SetGreenLed(0); @@ -542,29 +529,29 @@ void OnboardDisplay::Update(int8_t updmode) #endif //Adafruit RGB LCD // n.b. blue LED is on break; - case EVSE_STATE_D: // vent required - SetGreenLed(0); - SetRedLed(1); + case EVSE_STATE_D: // vent required + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); - LcdMsg_P(g_psEvseError,g_psVentReq); + LcdSetBacklightColor(RED); + LcdMsg_P(g_psEvseError,g_psVentReq); #endif //Adafruit RGB LCD - // n.b. blue LED is off - break; - case EVSE_STATE_DIODE_CHK_FAILED: - SetGreenLed(0); - SetRedLed(1); + // n.b. blue LED is off + break; + case EVSE_STATE_DIODE_CHK_FAILED: + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); - LcdMsg_P(g_psEvseError,g_psDiodeChkFailed); + LcdSetBacklightColor(RED); + LcdMsg_P(g_psEvseError,g_psDiodeChkFailed); #endif //Adafruit RGB LCD - // n.b. blue LED is off - break; - case EVSE_STATE_GFCI_FAULT: - SetGreenLed(0); - SetRedLed(1); + // n.b. blue LED is off + break; + case EVSE_STATE_GFCI_FAULT: + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); + LcdSetBacklightColor(RED); if (updmode == OBD_UPD_HARDFAULT) { LcdMsg_P(g_psEvseError,g_psGfciFault); } @@ -573,23 +560,23 @@ void OnboardDisplay::Update(int8_t updmode) LcdPrint_P(0,g_psGfciFault); } #endif //Adafruit RGB LCD - // n.b. blue LED is off - break; + // n.b. blue LED is off + break; #ifdef TEMPERATURE_MONITORING - case EVSE_STATE_OVER_TEMPERATURE: // overtemp message in Red on the RGB LCD - SetGreenLed(0); - SetRedLed(1); + case EVSE_STATE_OVER_TEMPERATURE: // overtemp message in Red on the RGB LCD + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); - LcdMsg_P(g_psSvcReq,g_psTemperatureFault); // SERVICE REQUIRED OVER TEMPERATURE + LcdSetBacklightColor(RED); + LcdMsg_P(g_psSvcReq,g_psTemperatureFault); // SERVICE REQUIRED OVER TEMPERATURE #endif - break; + break; #endif //TEMPERATURE_MONITORING - case EVSE_STATE_NO_GROUND: - SetGreenLed(0); - SetRedLed(1); + case EVSE_STATE_NO_GROUND: + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); + LcdSetBacklightColor(RED); if (updmode == OBD_UPD_HARDFAULT) { LcdMsg_P(g_psEvseError,g_psNoGround); } @@ -598,50 +585,50 @@ void OnboardDisplay::Update(int8_t updmode) LcdPrint_P(0,g_psNoGround); } #endif //Adafruit RGB LCD - // n.b. blue LED is off - break; - case EVSE_STATE_STUCK_RELAY: - SetGreenLed(0); - SetRedLed(1); + // n.b. blue LED is off + break; + case EVSE_STATE_STUCK_RELAY: + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD - LcdSetBacklightColor(RED); - LcdMsg_P(updmode == OBD_UPD_HARDFAULT ? g_psSvcReq : g_psEvseError,g_psStuckRelay); + LcdSetBacklightColor(RED); + LcdMsg_P(updmode == OBD_UPD_HARDFAULT ? g_psSvcReq : g_psEvseError,g_psStuckRelay); #endif //Adafruit RGB LCD - // n.b. blue LED is off - break; - case EVSE_STATE_DISABLED: - SetGreenLed(0); - SetRedLed(1); + // n.b. blue LED is off + break; + case EVSE_STATE_DISABLED: + SetGreenLed(0); + SetRedLed(1); #ifdef LCD16X2 - LcdSetBacklightColor(VIOLET); - LcdClear(); - LcdSetCursor(0,0); - LcdPrint_P(g_psDisabled); - LcdPrint(10,0,g_sTmp); + LcdSetBacklightColor(VIOLET); + LcdClear(); + LcdSetCursor(0,0); + LcdPrint_P(g_psDisabled); + LcdPrint(10,0,g_sTmp); #endif // LCD16X2 - break; - case EVSE_STATE_GFI_TEST_FAILED: - SetGreenLed(0); - SetRedLed(1); - LcdSetBacklightColor(RED); - LcdMsg_P(g_psTestFailed,g_psGfci); - break; - case EVSE_STATE_SLEEPING: - SetGreenLed(1); - SetRedLed(1); + break; + case EVSE_STATE_GFI_TEST_FAILED: + SetGreenLed(0); + SetRedLed(1); + LcdSetBacklightColor(RED); + LcdMsg_P(g_psTestFailed,g_psGfci); + break; + case EVSE_STATE_SLEEPING: + SetGreenLed(1); + SetRedLed(1); #ifdef LCD16X2 - LcdSetBacklightColor(VIOLET); - LcdClear(); - LcdSetCursor(0,0); - LcdPrint_P(g_psSleeping); - LcdPrint(10,0,g_sTmp); + LcdSetBacklightColor(VIOLET); + LcdClear(); + LcdSetCursor(0,0); + LcdPrint_P(g_psSleeping); + LcdPrint(10,0,g_sTmp); #endif // LCD16X2 - break; - default: - SetGreenLed(0); - SetRedLed(1); - // n.b. blue LED is off - } + break; + default: + SetGreenLed(0); + SetRedLed(1); + // n.b. blue LED is off + } } // @@ -659,7 +646,7 @@ void OnboardDisplay::Update(int8_t updmode) sprintf(g_sTmp+sizeof(g_sTmp)-6,g_sHHMMfmt,resetsec / 60,resetsec % 60); strcat(g_sTmp,g_sTmp+sizeof(g_sTmp)-6); LcdPrint(1,g_sTmp); - } + } return; } @@ -667,8 +654,8 @@ void OnboardDisplay::Update(int8_t updmode) g_CurrTime = g_RTC.now(); #endif - -#if defined(AMMETER) && defined(LCD16X2) +#ifdef LCD16X2 +#if defined(AMMETER) if (((curstate == EVSE_STATE_C) || g_EvseController.AmmeterCalEnabled()) && AmmeterIsDirty()) { SetAmmeterDirty(0); @@ -690,7 +677,6 @@ void OnboardDisplay::Update(int8_t updmode) } #endif // AMMETER -#ifdef LCD16X2 if (curstate == EVSE_STATE_C) { time_t elapsedTime = g_EvseController.GetElapsedChargeTime(); @@ -716,8 +702,6 @@ void OnboardDisplay::Update(int8_t updmode) sprintf(g_sTmp,"%6lukWh",(g_WattHours_accumulated / 1000)); // display accumulated kWh LcdPrint(7,1,g_sTmp); #endif // VOLTMETER -#else // ! KWH_RECORDING - LcdClearLine(0); #endif // KWH_RECORDING #ifdef TEMPERATURE_MONITORING @@ -750,7 +734,7 @@ void OnboardDisplay::Update(int8_t updmode) SetRedLed(1); #ifdef LCD16X2 //Adafruit RGB LCD LcdSetBacklightColor(RED); -#endif //Adafruit RGB LCD +#endif //Adafruit RGB LCD } else { g_TempMonitor.SetBlinkAlarm(1); // toggle the alarm flag so we can blink @@ -765,23 +749,26 @@ void OnboardDisplay::Update(int8_t updmode) #ifdef LCD16X2 //Adafruit RGB LCD LcdSetBacklightColor(TEAL); #endif - } -#else // !TEMPERATURE_MONITORING + } + if (!(g_TempMonitor.OverTemperature() || TEMPERATURE_DISPLAY_ALWAYS)) { +#endif // TEMPERATURE_MONITORING #ifndef KWH_RECORDING int h = hour(elapsedTime); // display the elapsed charge time int m = minute(elapsedTime); int s = second(elapsedTime); -#ifdef DELAYTIMER - sprintf(g_sTmp,"%02d:%02d:%02d %02d:%02d",h,m,s,(int)((g_CurrTime.hour() <= 23) ? g_CurrTime.hour() : 0),(int)((g_CurrTime.hour() <= 23) ? g_CurrTime.minute() : 0)); -#else sprintf(g_sTmp,"%02d:%02d:%02d",h,m,s); -#endif //#ifdef DELAYTIMER - +#ifdef RTC + g_sTmp[8]=' '; + g_sTmp[9]=' '; + g_sTmp[10]=' '; + sprintf(g_sTmp+11,g_sHHMMfmt,(int)g_CurrTime.hour(),(int)g_CurrTime.minute()); +#endif //RTC LcdPrint(1,g_sTmp); #endif // KWH_RECORDING +#ifdef TEMPERATURE_MONITORING + } #endif // TEMPERATURE_MONITORING - } - + } // curstate == EVSE_STATE_C // Display a new stopped LCD screen with Delay Timers enabled - GoldServe #ifdef DELAYTIMER else if (curstate == EVSE_STATE_SLEEPING) { @@ -1169,7 +1156,7 @@ void MaxCurrentMenu::Init() if (cursvclvl == 1) { m_MinCurrent = MIN_CURRENT_CAPACITY_L1; m_MaxCurrent = MAX_CURRENT_CAPACITY_L1; - } + } else { m_MinCurrent = MIN_CURRENT_CAPACITY_L2; m_MaxCurrent = MAX_CURRENT_CAPACITY_L2; @@ -1178,13 +1165,20 @@ void MaxCurrentMenu::Init() sprintf(g_sTmp,g_sMaxCurrentFmt,(cursvclvl == 1) ? "L1" : "L2"); g_OBD.LcdPrint(0,g_sTmp); m_CurIdx = g_EvseController.GetCurrentCapacity(); + if (m_CurIdx < m_MinCurrent) m_CurIdx = m_MinCurrent; sprintf(g_sTmp,"+%dA",m_CurIdx); g_OBD.LcdPrint(1,g_sTmp); } void MaxCurrentMenu::Next() { - m_CurIdx += 2; + if ((g_EvseController.GetCurSvcLevel() == 1) || + (m_CurIdx >= 78)) { // n.b. some cars can't do 80A, so allow 79A + m_CurIdx ++; + } + else { + m_CurIdx += 2; + } if (m_CurIdx > m_MaxCurrent) { m_CurIdx = m_MinCurrent; } @@ -1797,44 +1791,6 @@ Menu *DelayMenuStopMin::Select() return &g_SettingsMenu; } #endif // DELAYTIMER_MENU -#ifdef AUTOSTART_MENU -// Menus for Auto Start feature - GoldServe -AutoStartMenu::AutoStartMenu() -{ - m_Title = g_psAutoStart; -} -void AutoStartMenu::Init() -{ - g_OBD.LcdPrint_P(0,g_psAutoStart); - m_CurIdx = !g_EvseController.AutoStartEnabled(); - sprintf(g_sTmp,"+%s",g_YesNoMenuItems[m_CurIdx]); - g_OBD.LcdPrint(1,g_sTmp); -} -void AutoStartMenu::Next() -{ - - if (++m_CurIdx >= 2) { - m_CurIdx = 0; - } - g_OBD.LcdClearLine(1); - g_OBD.LcdSetCursor(0,1); - uint8_t dce = g_EvseController.AutoStartEnabled(); - if ((dce && !m_CurIdx) || (!dce && m_CurIdx)) { - g_OBD.LcdPrint(g_sPlus); - } - g_OBD.LcdPrint(g_YesNoMenuItems[m_CurIdx]); - -} -Menu *AutoStartMenu::Select() -{ - g_OBD.LcdPrint(0,1,g_sPlus); - g_OBD.LcdPrint(g_YesNoMenuItems[m_CurIdx]); - g_EvseController.EnableAutoStart((m_CurIdx == 0) ? 1 : 0); - g_EvseController.SaveEvseFlags(); - delay(500); - return &g_SettingsMenu; -} -#endif //#ifdef AUTOSTART_MENU #ifdef CHARGE_LIMIT #define MAX_CHARGE_LIMIT 40 @@ -1862,7 +1818,7 @@ void ChargeLimitMenu::showCurSel(uint8_t plus) void ChargeLimitMenu::Init() { m_CurIdx = g_EvseController.GetChargeLimit(); - + g_OBD.LcdPrint_P(0,g_psChargeLimit); showCurSel(1); } @@ -1930,7 +1886,7 @@ void TimeLimitMenu::showCurSel(uint8_t plus) void TimeLimitMenu::Init() { m_CurIdx = g_EvseController.GetTimeLimit(); - + g_OBD.LcdPrint_P(0,g_psTimeLimit); showCurSel(1); } @@ -2013,11 +1969,11 @@ void BtnHandler::ChkBtn() m_CurMenu->Init(); if ((m_CurMenu == &g_SettingsMenu)||(m_CurMenu == &g_SetupMenu)) { if (curidx > 0) { - // restore prev menu item - m_CurMenu->m_CurIdx = curidx-1; - m_CurMenu->Next(); + // restore prev menu item + m_CurMenu->m_CurIdx = curidx-1; + m_CurMenu->Next(); + } } - } } else { // exit @@ -2026,32 +1982,32 @@ void BtnHandler::ChkBtn() } else { #if defined(DELAYTIMER) - if (!g_DelayTimer.IsTimerEnabled()){ - g_EvseController.Enable(); - } + if (!g_DelayTimer.IsTimerEnabled()){ + g_EvseController.Enable(); + } #else - g_EvseController.Enable(); + g_EvseController.Enable(); #endif - g_OBD.DisableUpdate(0); - g_OBD.LcdSetBacklightType(m_SavedLcdMode); // exiting menus - restore LCD mode - g_OBD.Update(OBD_UPD_FORCE); + g_OBD.DisableUpdate(0); + g_OBD.LcdSetBacklightType(m_SavedLcdMode); // exiting menus - restore LCD mode + g_OBD.Update(OBD_UPD_FORCE); + } } } - } else { #if defined(CHARGE_LIMIT) || defined(TIME_LIMIT) - g_SettingsMenu.CheckSkipLimits(); + g_SettingsMenu.CheckSkipLimits(); #endif // CHARGE_LIMIT - m_SavedLcdMode = g_OBD.IsLcdBacklightMono() ? BKL_TYPE_MONO : BKL_TYPE_RGB; - g_OBD.LcdSetBacklightColor(WHITE); + m_SavedLcdMode = g_OBD.IsLcdBacklightMono() ? BKL_TYPE_MONO : BKL_TYPE_RGB; + g_OBD.LcdSetBacklightColor(WHITE); + g_OBD.DisableUpdate(1); if (infaultstate) { m_CurMenu = &g_SetupMenu; } else { - g_OBD.DisableUpdate(1); g_EvseController.Sleep(); m_CurMenu = &g_SettingsMenu; - } + } m_CurMenu->Init(); } } @@ -2109,12 +2065,12 @@ void DelayTimer::CheckTime() if (!g_EvseController.InFaultState() && IsTimerEnabled() && IsTimerValid()) { - unsigned long curms = millis(); - if ((curms - m_LastCheck) > 1000ul) { + unsigned long curms = millis(); + if ((curms - m_LastCheck) > 1000ul) { g_CurrTime = g_RTC.now(); m_CurrHour = g_CurrTime.hour(); m_CurrMin = g_CurrTime.minute(); - + uint16_t startTimerMinutes = m_StartTimerHour * 60 + m_StartTimerMin; uint16_t stopTimerMinutes = m_StopTimerHour * 60 + m_StopTimerMin; uint16_t currTimeMinutes = m_CurrHour * 60 + m_CurrMin; @@ -2158,7 +2114,6 @@ void DelayTimer::CheckTime() void DelayTimer::Enable(){ m_DelayTimerEnabled = 0x01; eeprom_write_byte((uint8_t*)EOFS_TIMER_FLAGS, m_DelayTimerEnabled); - g_EvseController.EnableAutoStart(0); g_EvseController.SaveSettings(); CheckTime(); g_OBD.Update(OBD_UPD_FORCE); @@ -2166,7 +2121,6 @@ void DelayTimer::Enable(){ void DelayTimer::Disable(){ m_DelayTimerEnabled = 0x00; eeprom_write_byte((uint8_t*)EOFS_TIMER_FLAGS, m_DelayTimerEnabled); - g_EvseController.EnableAutoStart(1); g_EvseController.SaveSettings(); g_OBD.Update(OBD_UPD_FORCE); } diff --git a/rapi_proc.cpp b/rapi_proc.cpp index e1187d95..7b34d0d5 100644 --- a/rapi_proc.cpp +++ b/rapi_proc.cpp @@ -383,9 +383,9 @@ int EvseRapiProcessor::processCmd() bufCnt = 1; // flag response text output break; case 'F': // get fault counters - u1.u = eeprom_read_byte((uint8_t*)EOFS_GFI_TRIP_CNT); - u2.u = eeprom_read_byte((uint8_t*)EOFS_NOGND_TRIP_CNT); - u3.u = eeprom_read_byte((uint8_t*)EOFS_STUCK_RELAY_TRIP_CNT); + u1.u = g_EvseController.GetGfiTripCnt(); + u2.u = g_EvseController.GetNoGndTripCnt(); + u3.u = g_EvseController.GetStuckRelayTripCnt(); sprintf(buffer,"%x %x %x",u1.u,u2.u,u3.u); bufCnt = 1; // flag response text output break; diff --git a/rapi_proc.h b/rapi_proc.h index 11c8d2e3..9720db9d 100644 --- a/rapi_proc.h +++ b/rapi_proc.h @@ -89,6 +89,8 @@ S2 0|1 - disable/enable ammeter calibration mode - ammeter is read even when not S3 cnt - set charge time limit to cnt*15 minutes (0=disable, max=255) SA currentscalefactor currentoffset - set ammeter settings SC amps - set current capacity + if amps < minimum current capacity, will set to minimum and return $NK + if amps > maximum current capacity, will set to maximum and return $NK SD 0|1 - disable/enable diode check $SD 0*0B $SD 1*0C @@ -139,11 +141,12 @@ GE - get settings $GE*B0 GF - get fault counters response: OK gfitripcnt nogndtripcnt stuckrelaytripcnt (all values hex) + maximum trip count = 0xFE for any counter $GF*B1 GG - get charging current and voltage response: OK milliamps millivolts - AMMETER must be defined in order to get amps, otherwise returns 0 amps - VOLTMETER must be defined in order to get voltage, otherwise returns 0 volts + AMMETER must be defined in order to get amps, otherwise returns -1 amps + VOLTMETER must be defined in order to get voltage, otherwise returns -1 volts $GG*B2 GH - get cHarge limit response: OK kWh diff --git a/serialcli.cpp b/serialcli.cpp index e59ba82c..09b982fe 100644 --- a/serialcli.cpp +++ b/serialcli.cpp @@ -94,11 +94,6 @@ void CLI::getInput() print_P(PSTR("Stuck Relay Check: ")); println_P(g_EvseController.StuckRelayChkEnabled() ? g_psEnabled : g_psDisabled); #endif // ADVPWR - // Option to disable auto start - GoldServe -#ifdef MANUALSTART - print_P(PSTR("Auto Start: ")); - println_P(g_EvseController.AutoStartEnabled() ? g_psEnabled : g_psDisabled); -#endif //#ifdef MANUALSTART // Start Delay Timer feature - GoldServe #ifdef DELAYTIMER print_P(PSTR("Delay Timer: ")); @@ -157,11 +152,6 @@ void CLI::getInput() println_P(PSTR("gndchk on/off - turn ground check on/off")); println_P(PSTR("rlychk on/off - turn stuck relay check on/off")); #endif // ADVPWR - // Start Delay Timer feature - GoldServe -#ifdef MANUALSTART - println_P(PSTR("autostart on/off - enable/disable autostart")); -#endif //#ifdef MANUALSTART - // End Delay Timer feature - GoldServe println_P(PSTR("sdbg on/off - turn serial debugging on/off")); } else if (strncmp_P(m_CLIinstr, PSTR("set "),4) == 0) { @@ -202,22 +192,6 @@ void CLI::getInput() println_P(g_psDisabled); } } - // Start Delay Timer feature - GoldServe -#ifdef MANUALSTART - else if (!strncmp_P(p,PSTR("autostart "),10)) { - p += 10; - print_P(PSTR("autostart ")); - if (!strcmp_P(p,g_pson)) { - g_EvseController.EnableAutoStart(1); - println_P(g_psEnabled); - } - else { - g_EvseController.EnableAutoStart(0); - println_P(g_psDisabled); - } - } -#endif //#ifdef MANUALSTART - // End Delay Timer feature - GoldServe #ifdef ADVPWR else if (!strncmp_P(p,PSTR("gndchk "),7)) { p += 7; diff --git a/strings.cpp b/strings.cpp index fb5069c4..f3f0c24f 100644 --- a/strings.cpp +++ b/strings.cpp @@ -49,9 +49,6 @@ const char g_psResetNow[] PROGMEM = "Restart Now?"; const char g_psReset[] PROGMEM = "Restart"; const char g_psExit[] PROGMEM = "Exit"; // Add additional strings - GoldServe -#ifdef AUTOSTART_MENU -const char g_psAutoStart[] PROGMEM = "Auto Start"; -#endif //#ifdef AUTOSTART_MENU #ifdef DELAYTIMER_MENU const char g_psRTC[] PROGMEM = "Date/Time"; const char g_psRTC_Month[] PROGMEM = "Month"; diff --git a/strings.h b/strings.h index 33fc94b0..95f21152 100644 --- a/strings.h +++ b/strings.h @@ -51,9 +51,6 @@ extern const char g_psResetNow[] PROGMEM; extern const char g_psReset[] PROGMEM; extern const char g_psExit[] PROGMEM; // Add additional strings - GoldServe -#ifdef AUTOSTART_MENU -extern const char g_psAutoStart[] PROGMEM; -#endif //#ifdef AUTOSTART_MENU #ifdef DELAYTIMER_MENU extern const char g_psRTC[] PROGMEM; extern const char g_psRTC_Month[] PROGMEM;