- /**
+/**
  * Medida de Temperatura usando LM35 e Termopar MTK-01
  * 
  * @authors Rafael, Camila, Pamella
- * @version 0.12 'Teste Leitura multiplos sensores'
+ * @version 0.9 'Filtros Implementados'
  */
 
 // Bibliotecas ---------------------------------------------------------------------------------

float bufferAvgFilter[SIZE_BUFFER];
float bufferMvAvgFilter[SIZE_BUFFER];
float bufferMvAvgExpFilter[SIZE_BUFFER];

float pMvAvgExpFilter[4]; // Pesos Filtro Média Móvel Ponderada

// Setup ---------------------------------------------------------------------------------


  bufferMvAvgExpFilter[k] += buffer[a1]*pMvAvgExpFilter[2];
  bufferMvAvgExpFilter[k] += buffer[k]*pMvAvgExpFilter[3];
}

/**
 * Filtro de Kalman
 * 
 * @author Rafael Lima
 */
 void filterKalman(float buffer[],int k){
    // Calcula Endereços
    int a1 = (k>0)?k-1:SIZE_BUFFER_F-1;
  
    float m = KALMAN_A*bufferKalmanFilter[a1] + KALMAN_B*KALMAN_CONTROL;
    float S = KALMAN_A*kalman_cov*KALMAN_A + KALMAN_R;
    float K = S*KALMAN_C/(KALMAN_C*S*KALMAN_C + KALMAN_Q);
    
    bufferKalmanFilter[k] = m + K*(buffer[k] - KALMAN_C*m);
    kalman_cov = (1 - K*KALMAN_C)*S;
 }
