Index: webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c =================================================================== --- webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c (revision 56) +++ webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c (revision 57) @@ -381,4 +381,5 @@ { advanceHistoryArray(); + xLastSolarHistoryAdvance = xTaskGetTickCount(); /* update timer */ } else if (xTaskGetTickCount() < xLastSolarHistoryAdvance) @@ -561,10 +562,10 @@ /* advance entries by 1. we do not care about data locking here. */ - for (i = 0; i < (SOLAR_WATT_HISTORYSIZE-1); i++) + for (i = SOLAR_WATT_HISTORYSIZE-1; i > 0; i--) { portENTER_CRITICAL(); - SolarHistory[i+1][0] = SolarHistory[i][0]; - SolarHistory[i+1][1] = SolarHistory[i][1]; - SolarHistory[i+1][2] = SolarHistory[i][2]; + SolarHistory[i][0] = SolarHistory[i-1][0]; + SolarHistory[i][1] = SolarHistory[i-1][1]; + SolarHistory[i][2] = SolarHistory[i-1][2]; portEXIT_CRITICAL(); } /* for */