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/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