@@ -64,6 +64,7 @@ extern "C" {
6464 #include " ch32v003fun.h"
6565 void RCmonCtrl (uint8_t enable);
6666 void delay (uint32_t ms);
67+ void testRCMON (void );
6768}
6869extern void CheckRS485Comm (void );
6970#endif
@@ -144,7 +145,6 @@ uint8_t Switch = SWITCH; // E
144145 // 3:Smart-Solar B / 4:Smart-Solar S / 5: Grid Relay
145146 // 6:Custom B / 7:Custom S)
146147 // B=momentary push <B>utton, S=toggle <S>witch
147- uint8_t RCmon = RC_MON; // Residual Current Monitor (0:Disable / 1:Enable)
148148uint8_t AutoUpdate = AUTOUPDATE; // Automatic Firmware Update (0:Disable / 1:Enable)
149149uint16_t StartCurrent = START_CURRENT;
150150uint16_t StopTime = STOP_TIME;
@@ -220,6 +220,7 @@ uint8_t ConfigChanged = 0;
220220
221221uint16_t SolarStopTimer = 0 ;
222222#ifdef SMARTEVSE_VERSION // ESP32 v3 and v4
223+ uint8_t RCmon = RC_MON; // Residual Current Monitor (0:Disable / 1:Enable)
223224uint8_t DelayedRepeat; // 0 = no repeat, 1 = daily repeat
224225uint8_t LCDlock = LCD_LOCK; // 0 = LCD buttons operational, 1 = LCD buttons disabled
225226uint16_t BacklightTimer = 0 ; // Backlight timer (sec)
@@ -824,6 +825,12 @@ void setState(uint8_t NewState) { //c
824825 break ;
825826 case STATE_C: // State C2
826827 ActivationMode = 255 ; // Disable ActivationMode
828+ #ifdef SMARTEVSE_VERSION // v3
829+ LCDTimer = 0 ;
830+ #else // CH32
831+ printf (" @LCDTimer:0\n " );
832+ // testRCMON();
833+ #endif
827834
828835 if (Switching_Phases_C2 == GOING_TO_SWITCH_1P) {
829836 CONTACTOR2_OFF;
@@ -845,11 +852,6 @@ void setState(uint8_t NewState) { //c
845852 if (!Force_Single_Phase_Charging ()) { // in AUTO mode we start with 3phases
846853 CONTACTOR2_ON; // Contactor2 ON
847854 }
848- #ifdef SMARTEVSE_VERSION // v3
849- LCDTimer = 0 ;
850- #else // CH32
851- printf (" @LCDTimer:0\n " );
852- #endif
853855 break ;
854856 case STATE_C1:
855857#ifdef SMARTEVSE_VERSION // v3
@@ -2270,6 +2272,7 @@ void CheckSerialComm(void) {
22702272 CALL_ON_RECEIVE_PARAM (CalcBalancedCurrent:, CalcBalancedCurrent)
22712273 CALL_ON_RECEIVE_PARAM (setPilot:,setPilot)
22722274 CALL_ON_RECEIVE_PARAM (PowerPanicCtrl:, PowerPanicCtrl)
2275+ CALL_ON_RECEIVE_PARAM (RCmon:, RCmonCtrl);
22732276 CALL_ON_RECEIVE (setStatePowerUnavailable)
22742277 CALL_ON_RECEIVE (OneWireReadCardId)
22752278 CALL_ON_RECEIVE_PARAM (setErrorFlags:, setErrorFlags)
@@ -2292,7 +2295,6 @@ void CheckSerialComm(void) {
22922295 SET_ON_RECEIVE (MinCurrent:, MinCurrent)
22932296 SET_ON_RECEIVE (MaxCircuit:, MaxCircuit)
22942297 SET_ON_RECEIVE (Switch:, Switch)
2295- SET_ON_RECEIVE (RCmon:, RCmon)
22962298 SET_ON_RECEIVE (StartCurrent:, StartCurrent)
22972299 SET_ON_RECEIVE (StopTime:, StopTime)
22982300 SET_ON_RECEIVE (ImportCurrent:, ImportCurrent)
@@ -3224,7 +3226,7 @@ void Timer10ms_singlerun(void) {
32243226 case COMM_STATUS_REQ: // Ready to receive status from mainboard
32253227 CommTimeout = 10 ;
32263228 Serial1.printf (" @PowerPanicCtrl:0\n " );
3227- Serial1.printf (" @RCmonCtrl :%u\n " , RCmon);
3229+ Serial1.printf (" @RCmon :%u\n " , RCmon);
32283230 CommState = COMM_STATUS_RSP;
32293231 }
32303232 }
@@ -3345,16 +3347,14 @@ uint8_t setItemValue(uint8_t nav, uint16_t val) {
33453347#endif
33463348 LoadBl = val;
33473349 break ;
3348- case MENU_RCMON:
3349- RCmon = val;
3350- #if !defined(SMARTEVSE_VERSION) // CH32
3351- RCmonCtrl (RCmon);
3352- #endif
3353- break ;
33543350 case MENU_EMCUSTOM_DATATYPE:
33553351 EMConfig[EM_CUSTOM].DataType = (mb_datatype)val;
33563352 break ;
33573353#ifdef SMARTEVSE_VERSION
3354+ case MENU_RCMON:
3355+ RCmon = val;
3356+ Serial1.printf (" @RCmon:%u\n " , RCmon);
3357+ break ;
33583358 case MENU_WIFI:
33593359 WIFImode = val;
33603360 break ;
@@ -3436,8 +3436,6 @@ uint16_t getItemValue(uint8_t nav) {
34363436 return Lock;
34373437 case MENU_SWITCH:
34383438 return Switch;
3439- case MENU_RCMON:
3440- return RCmon;
34413439 case MENU_GRID:
34423440 return Grid;
34433441 case MENU_SB2_WIFI:
@@ -3503,6 +3501,8 @@ uint16_t getItemValue(uint8_t nav) {
35033501 case STATUS_TEMP:
35043502 return (signed int )TempEVSE;
35053503#ifdef SMARTEVSE_VERSION // not on CH32
3504+ case MENU_RCMON:
3505+ return RCmon;
35063506 case STATUS_SERIAL:
35073507 return serialnr;
35083508#endif
0 commit comments