So.. after boot all seems fine with my openEVSE:

IMG_20190611_171415-1

But when it starts charging this happens:

IMG_20190611_171928-1

This comes from this this code:

if (curstate == EVSE_STATE_C) {
    time_t elapsedTime = g_EvseController.GetElapsedChargeTime();
    if (elapsedTime != g_EvseController.GetElapsedChargeTimePrev()) {   
      int h = hour(elapsedTime);
      int m = minute(elapsedTime);
      int s = second(elapsedTime);
      sprintf(g_sTmp,"%02d:%02d:%02d",h,m,s);
      LcdPrint(1,g_sTmp);
    }
}

So I was suspecting the printf line, maybe the implementation changed or something. So I added this:

Serial.println(g_sTmp);

And watched the serial monitor:

Capture-1

So, it's not that. I started putting Serial.println almost everywhere, and everywhere it echoed the expected results.

At this time I started to suspect a hardware problem, also because of the nature of the display output (jibberisch).. Do I have an overlap in assigned pins or something? Plowed through the code for that, but could not find any. The charging pin is using D3, the CP D10, analog in A1, and the display m_Lcd(13,12,11,7,9,8) should be fine..

The only state change that might be causing this is the charge state, right?

To be sure I commented out all the lines at the point where the charging is enabled:

    else if (m_EvseState == EVSE_STATE_C) {
      //m_Pilot.SetPWM(m_CurrentCapacity);
      //chargingOn(); // turn on charging current
    }

And sure enough, the expected display output:

Capture-2

So I jumped into the SetPWM method, and there it is.. in the comments:

// outputting a 1KHz square wave to digital pin 11 via Timer 1
// 16MHz / 64 / (OCR1A+1) / 2 on digital 9
// 16MHz / 64 / (OCR1A+1) on digital 10
// 1KHz variable duty cycle on digital 10, 500Hz fixed 50% on digital 9
// pin 10 duty cycle = (OCR1B+1)/(OCR1A+1)

The pins D11 & D9 are not used in the schema's at all, but obviously it is not a good idea to use pin D9 and D11 for the display (and D10, but I got that from the schema already)

Not sure why this is the case, and looking at the code I would not have found this, but I'm moving my LCD pins, and all will be fine..