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

Dependencies:   EthernetInterface mbed-rtos mbed NTPClient

Files at this revision

API Documentation at this revision

Comitter:
rebonatto
Date:
Sun May 03 22:31:53 2015 +0000
Parent:
32:8b108d8089e8
Child:
34:f1927c94cf8f
Commit message:
Retirado Valor medio. Calculada fft com valores float j? indo em mA.; Resulta muitos valores pequenos.

Changed in this revision

Codes/EventDetector.cpp Show annotated file Show diff for this revision Revisions of this file
Codes/SignalProcessor.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Codes/EventDetector.cpp	Fri May 01 21:52:57 2015 +0000
+++ b/Codes/EventDetector.cpp	Sun May 03 22:31:53 2015 +0000
@@ -103,12 +103,29 @@
             //pega os dados da captura atual
             newvm = 0;
             Capture::CopyBufferFloat(m_Channel,buf);
-            
-            /* Retira o valorMedio de todas as amostras */
+            /*                        
+            if ( m_EventCounter == Settings::get_EventLimit() ){                    
+                printf("Valores originais\n");
+                for(i=0; i < NUMBER_OF_SAMPLES; i++){
+                    printf("%.2f,", buf[i]);
+                }
+            } 
+            */               
+            /* Retira o valorMedio de todas as amostras */                                    
             for(i=0; i < NUMBER_OF_SAMPLES; i++){
                 buf[i] -= mv2;
                 newvm += buf[i];
             }
+            /*
+            if ( m_EventCounter == Settings::get_EventLimit() ){                    
+                printf("\nSem valor medio\n");
+                for(i=0; i < NUMBER_OF_SAMPLES; i++){
+                    printf("%.2f,", buf[i]);
+                }
+                printf("\n");
+            }
+            */
+            
             if ( m_EventCounter == Settings::get_EventLimit() ){                    
                 mv2 = newvm / NUMBER_OF_SAMPLES;
                 //printf("Novo valor medio %f RMS original %f\n", mv2, rmsvalue);
@@ -176,7 +193,7 @@
             else
                 m_EventCounter = 0;
         }
-    } // Final gerafuga
+    } // Final gerafuga    
 }
             
 void EventDetector::ShowValues(CaptureEvent* e)
@@ -332,10 +349,10 @@
     event->Setup(rfid,type,outlet_number,mv,mv2, rmsvalue,under, over, Settings::get_Gain(m_Channel),Settings::get_Offset(m_Channel),duration, seno,coss);
                 
     //printf("\n\nDuration: %d\n\n", duration);
-   // ShowValues(event);       
+    //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");
 }
 
--- a/Codes/SignalProcessor.cpp	Fri May 01 21:52:57 2015 +0000
+++ b/Codes/SignalProcessor.cpp	Sun May 03 22:31:53 2015 +0000
@@ -62,8 +62,7 @@
     int nSample;
     
     for(nSample=0;nSample<NUMBER_OF_SAMPLES;nSample++)
-    {
-        
+    {        
         unsigned short int v = buffer[nSample];
         float val = (float)v;
                                                // cada ponto   
@@ -160,12 +159,12 @@
         sen[i-1] = buffer[i*2+1];
     }
     
-    /*
+    
     for(int i=0;i<Settings::get_MaxHarmonics();i++)
     {
         printf("[%dHz]\tsen %.4f\tcos %.4f\n", (i+1)*60, sen[i], cos[i]);
     }
-    */
+    
     
     //free(fft);    
     
@@ -196,7 +195,7 @@
     */
     //printf("DEpois malloc\n");    
     
-    //DisplayRAMBanks();
+    // DisplayRAMBanks();
     
     //put the real array in a complex array
     //the complex part is filled with 0's
@@ -229,7 +228,7 @@
     met=NUMBER_OF_SAMPLES-1;    
     for(n=NUMBER_OF_SAMPLES*2-1; n > 0; n--){
         if (n % 2 == 0){
-            data[n] = data[met];
+            data[n] = data[met] / Settings::get_Gain(ch);
             met--;
         }
         else
--- a/main.cpp	Fri May 01 21:52:57 2015 +0000
+++ b/main.cpp	Sun May 03 22:31:53 2015 +0000
@@ -96,8 +96,10 @@
             t.reset();
             */
             //Thread::wait(1000); //1000
+            
             PmedLog::Mark();
-            wait(1);
+            
+            //wait(1);
         }
     }
 }
@@ -133,7 +135,7 @@
 int main() {
     PmedLog::WriteEntry(PMEDLOG_INITIALIZING);
 
-    printf("\r\nNova versao 57 ( 20150327.1 )...\r\n");
+    printf("\r\nNova versao 60 ( 20150327.1 )...\r\n");
     FILE *f;
     //Set Highest Priority
     //osThreadSetPriority(osThreadGetId(),osPriorityHigh);