Changeset 58 for webserver

Show
Ignore:
Timestamp:
03/07/10 13:35:12 (15 years ago)
Author:
phil
Message:

- solar history now in reverse direction
- do not invalidate whole history on read error, only recent data item

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c

    r57 r58  
    250250      strcat( uip_appdata, cCountBuf ); 
    251251 
    252       for (i = 0; i < SOLAR_WATT_HISTORYSIZE; i++
     252      for (i = SOLAR_WATT_HISTORYSIZE; i > 0; i--
    253253      { 
     254          /* print history in reverse direction */ 
    254255          sprintf(  
    255256            cCountBuf, "SH %u %u %u %u\r\n", 
    256              (SOLAR_WATT_HISTORY_STEPSIZE * i), 
    257             SolarHistory[i][0], 
    258             SolarHistory[i][1], 
    259             SolarHistory[i][2] 
     257             ((SOLAR_WATT_HISTORY_STEPSIZE) * (i-1)), 
     258            SolarHistory[i-1][0], 
     259            SolarHistory[i-1][1], 
     260            SolarHistory[i-1][2] 
    260261          ); 
    261262          strcat( uip_appdata, cCountBuf ); 
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r57 r58  
    165165  int i; 
    166166  xLastSolarStateChangeTime = xTaskGetTickCount(); 
    167   xLastSolarHistoryAdvance = xTaskGetTickCount(); 
    168167  xLastReadTime = xTaskGetTickCount(); 
    169168  solarState = SOL_NO_INIT; 
     
    172171  currentChannel = 0; 
    173172 
    174   /* set data to invalid value */ 
     173  /* set recent data item to invalid value */ 
    175174  chanWatt[0] = SOLAR_FSM_INVALID_VALUE; 
    176175  chanWatt[1] = SOLAR_FSM_INVALID_VALUE; 
    177176  chanWatt[2] = SOLAR_FSM_INVALID_VALUE; 
    178177 
    179   /* invalidate history */ 
    180   for (i = 0; i < SOLAR_WATT_HISTORYSIZE; i++) 
    181   { 
    182             SolarHistory[i][0] = SOLAR_FSM_INVALID_VALUE; 
    183             SolarHistory[i][1] = SOLAR_FSM_INVALID_VALUE; 
    184             SolarHistory[i][2] = SOLAR_FSM_INVALID_VALUE; 
    185   } 
     178  /* do not invalidate history here so we do not lose all data */ 
     179 
    186180 
    187181} /* initSolarFSM */ 
     
    711705static portTASK_FUNCTION( vSolar_Task, pvParameters ) 
    712706{ 
     707  int i; 
    713708 
    714709  init_serial3(); 
     710 
     711  /* invalidate history */ 
     712  for (i = 0; i < SOLAR_WATT_HISTORYSIZE; i++) 
     713  { 
     714            SolarHistory[i][0] = SOLAR_FSM_INVALID_VALUE; 
     715            SolarHistory[i][1] = SOLAR_FSM_INVALID_VALUE; 
     716            SolarHistory[i][2] = SOLAR_FSM_INVALID_VALUE; 
     717  } 
     718 
     719  xLastSolarHistoryAdvance = xTaskGetTickCount(); 
     720 
    715721  initSolarFSM(); 
    716722