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 */ Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 56) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 57) @@ -243,4 +243,26 @@ //strcat( ( char * ) uip_appdata, ( char * ) "\r\n" ); + + + sprintf( cCountBuf, "HIST %u %u\r\n", + SOLAR_WATT_HISTORY_STEPSIZE, + SOLAR_WATT_HISTORYSIZE ); + strcat( uip_appdata, cCountBuf ); + + for (i = 0; i < SOLAR_WATT_HISTORYSIZE; i++) + { + sprintf( + cCountBuf, "SH %u %u %u %u\r\n", + (SOLAR_WATT_HISTORY_STEPSIZE * i), + SolarHistory[i][0], + SolarHistory[i][1], + SolarHistory[i][2] + ); + strcat( uip_appdata, cCountBuf ); + } /* for */ + + + + sprintf( cCountBuf, "
\r\nTSTmeter %u %u %u %u %u %u %u %u\r\n",
meterItems[METER_INDEX_TST].meterEnabled,
@@ -325,22 +347,4 @@
strcat( uip_appdata, cCountBuf );
-
- sprintf( cCountBuf, "HIST %u %u\r\n",
- SOLAR_WATT_HISTORY_STEPSIZE,
- SOLAR_WATT_HISTORYSIZE );
- strcat( uip_appdata, cCountBuf );
-
- for (i = 0; i < SOLAR_WATT_HISTORYSIZE; i++)
- {
- sprintf(
- cCountBuf, "SH %u %u %u %u\r\n",
- SOLAR_WATT_HISTORYSIZE,
-
- SolarHistory[i][0],
- SolarHistory[i][1],
- SolarHistory[i][2]
- );
- strcat( uip_appdata, cCountBuf );
- } /* for */
//strcat( ( char * ) uip_appdata, ( char * ) "1234test" );