Index: /webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c (revision 37) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c (revision 39) @@ -104,4 +104,9 @@ +portTickType xLastSolarStateChangeTime; + + +int solarReadErrors = 0; + /* pototype section */ @@ -134,4 +139,5 @@ void initSolarFSM(void) { + xLastSolarStateChangeTime = xTaskGetTickCount(); xLastReadTime = xTaskGetTickCount(); solarState = SOL_NO_INIT; @@ -315,4 +321,14 @@ getUart3RxData(); + /* did the SolarFSM get stuck during reading? */ + if (xTaskGetTickCount() > xLastSolarStateChangeTime + 5000) + { + /* something has gone wrong (possible Rx Timeout). restart, state SOL_NO_INIT */ + xLastSolarStateChangeTime = xTaskGetTickCount(); + initSolarFSM(); + solarReadErrors++; + } + + switch (solarState) { @@ -323,4 +339,5 @@ /* send init 1 */ send_uart3((unsigned char *)init1, sizeof(init1)); + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_SENT_INIT; /* now wait for reply */ break; @@ -341,4 +358,5 @@ /* now ready to query channel 0 data in next state */ + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_CHAN; } @@ -377,4 +395,5 @@ case 6: /* we are through with all the channels, ready to send next init for next query round */ + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_FINISHED; break; @@ -384,4 +403,5 @@ if (solarState != SOL_FINISHED) { + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_CHAN_WAIT_REPLY; /* wait for reply if not finished */ } /* if */ @@ -443,4 +463,5 @@ currentChannel++; /* now ready to query channel data for next channel */ + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_CHAN; } @@ -448,4 +469,5 @@ { /* we received the finishing sequence */ + xLastSolarStateChangeTime = xTaskGetTickCount(); solarState = SOL_NO_INIT; /* restart the measurement cycle */ } Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/http-strings.c =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/http-strings.c (revision 14) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/http-strings.c (revision 39) @@ -38,4 +38,9 @@ /* "/index.html" */ {0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; + +//const char http_solar_html[12] = +///* "/solar.html" */ +//{0x2f, 0x73, 0x6f, 0x6c, 0x61, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; + const char http_404_html[10] = /* "/404.html" */ Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 38) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 39) @@ -54,4 +54,9 @@ #include #include + + +extern unsigned char chanVolt[6]; /* holds the voltages measured on channel 0 to 5 */ +extern int chanWatt[6]; /* holds the wattages measured on channel 0 to 5 */ +extern int solarReadErrors; HTTPD_CGI_CALL(file, "file-stats", file_stats); @@ -212,6 +217,19 @@ { lRefreshCount++; - sprintf( cCountBuf, "


Refresh count = %d", lRefreshCount ); - vTaskList( uip_appdata ); + sprintf( cCountBuf, "


Refresh count = %d\r\nVoltages %d %d %d %d\r\n\ +Wattages %d %d %d %d\r\nSolarReadErr %d\r\n", lRefreshCount, + chanVolt[0], chanVolt[1], chanVolt[2], chanVolt[3], + chanWatt[0], chanWatt[1], chanWatt[2], chanWatt[3], + solarReadErrors + ); + strcat( uip_appdata, cCountBuf ); + + //vTaskList( uip_appdata ); + + (( char *)uip_appdata)[ 0 ] = (char) 0x00; + strcat( ( char * ) uip_appdata, ( char * ) "\r\n" ); + + + strcat( uip_appdata, cCountBuf ); Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 37) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 39) @@ -14,5 +14,5 @@ - + @@ -20,4 +20,7 @@ + + + @@ -39,8 +42,8 @@ - + + - - + @@ -55,16 +58,19 @@ - - + + + - - - + + + - - - - - + + + + + + + @@ -72,18 +78,21 @@ - + - + - + - - - - - - + + + + + + + + +