Versão limpa em 04/09/2014. Telnet funcionando.

Dependencies:   EthernetInterface mbed-rtos mbed NTPClient

Revision:
29:fcfcb31a6362
Parent:
2:628a25bb5d62
Child:
30:9bf44d2785d5
diff -r 463533ca610a -r fcfcb31a6362 Codes/EventDetector.cpp
--- a/Codes/EventDetector.cpp	Fri Mar 27 21:09:39 2015 +0000
+++ b/Codes/EventDetector.cpp	Tue Apr 28 14:19:03 2015 +0000
@@ -11,6 +11,7 @@
  #define MARCA 10
  #define GERAFUGA 0
  #define UMCICLO 16.666666667
+ #define ZEROMV 1
 
 CaptureMailbox EventDetector::m_EventMailbox;
 EventDetector EventDetector::m_Detector[NUMBER_OF_CHANNELS] = {0,1,2,3,4,5};
@@ -96,8 +97,27 @@
             printf("\n");
         }
         */    
-        if(rmsvalue > Settings::get_Limit(m_Channel))
+        if(rmsvalue > Settings::get_Limit(m_Channel))                
         {
+            if ( ZEROMV ) // verifica se é para retirar o VM
+            {
+                short int buf[NUMBER_OF_SAMPLES];
+                int i, newvm = 0;
+                Capture::CopyBufferSigned(m_Channel,buf);
+                
+                /* Retira o valorMedio de todas as amostras */
+                for(i=0; i < NUMBER_OF_SAMPLES; i++){
+                    buf[i] -= (int) mv2;
+                    newvm += buf[i];
+                }
+                if ( m_EventCounter == Settings::get_EventLimit() ){
+                    newvm /= NUMBER_OF_SAMPLES;
+                    printf("Novo valor medio %d\n", newvm);
+                }
+                    
+                rmsvalue = SignalProcessor::CalculateRMSSigned(buf, m_Channel);
+            }
+            
             if(!m_OutletTriggered)
             {
                 if(m_EventCounter < Settings::get_EventLimit())
@@ -311,7 +331,7 @@
    // ShowValues(event);       
            
     //and finally place the object in the mailbox queue.
-    GetMailbox().put(event);
+   // GetMailbox().put(event);
     //printf("Deu put no evento no mailBox\n");
 }