Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed NTPClient
Revision 43:69afea5f5a4d, committed 2016-01-18
- Comitter:
- rebonatto
- Date:
- Mon Jan 18 18:26:03 2016 +0000
- Parent:
- 42:d6f9ce115eaf
- Commit message:
- Aquisi??o sem DMA, 256 amostras.; Buffer simples com copia de buffer para calculo da FFT.; Com telnetr e TFTP ativos. Telnet funcionando sem travar.; Vers?o com WhatDog.
Changed in this revision
--- a/Codes/Capture.cpp Mon Jan 18 18:01:59 2016 +0000
+++ b/Codes/Capture.cpp Mon Jan 18 18:26:03 2016 +0000
@@ -7,7 +7,7 @@
#include "Capture.h"
-__attribute((section("AHBSRAM1"),aligned)) float Capture::m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES*2];// __attribute__((section("AHBSRAM0")));
+__attribute((section("AHBSRAM1"),aligned)) float Capture::m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES];// __attribute__((section("AHBSRAM0")));
bool Capture::flag_capture = 0;
int Capture::cnt_buffer=0;
--- a/Codes/EventDetector.cpp Mon Jan 18 18:01:59 2016 +0000
+++ b/Codes/EventDetector.cpp Mon Jan 18 18:26:03 2016 +0000
@@ -48,21 +48,20 @@
void EventDetector::ProcessEvent(float rmsvalue, float mv2, int under, int over)
{
int i, tempofuga = 0;
- //float buf[NUMBER_OF_SAMPLES*2], newvm;
- float newvm, aux;
+ float buf[NUMBER_OF_SAMPLES*2];
+ float newvm;
if(rmsvalue > Settings::get_Limit(m_Channel))
{
/* Retira o VM das amostras */
//pega os dados da captura atual
newvm = 0;
- //Capture::CopyBufferFloat(m_Channel,buf);
+ Capture::CopyBuffer(m_Channel,buf);
/* Retira o valorMedio de todas as amostras */
for(i=0; i < NUMBER_OF_SAMPLES; i++){
- aux = Capture::GetValue(i, m_Channel) - mv2;
- Capture::PutValue(i, m_Channel, aux) ;
- newvm += aux;
+ buf[i] -= mv2;
+ newvm += buf[i];
}
if ( m_EventCounter == Settings::get_EventLimit() ){
@@ -70,7 +69,7 @@
//printf("Novo valor medio %f RMS original %f\n", mv2, rmsvalue);
}
- rmsvalue = SignalProcessor::CalculateRMSFloat(&Capture::m_AdcBuffers[m_Channel][0], m_Channel);
+ rmsvalue = SignalProcessor::CalculateRMSFloat(buf, m_Channel);
if(!m_OutletTriggered)
{
@@ -88,7 +87,7 @@
//OnTrigger(buf, rmsvalue, mv2, under, over, 0); //TODO: must change the parameter of this function call
- SendMessage(0, rmsvalue, mv2, under, over, 0);
+ SendMessage(buf, rmsvalue, mv2, under, over, 0);
m_EventCounter = 0;
}
@@ -118,7 +117,7 @@
tempofuga = 0;
m_OutletTriggered = false;
- SendMessage(0, rmsvalue, mv2, under, over, tempofuga);
+ SendMessage(buf, rmsvalue, mv2, under, over, tempofuga);
//printf("===> contliga %d contdesliga %d\n", contliga, contdesl);
m_EventCounter = 0;
@@ -154,12 +153,13 @@
void EventDetector::ExternalTrigger()
{
// Ajustar valores de mv2, under, over e duration na chamada!!!
- SendMessage(1, 0, 0, 0, 0, 0);
+ SendMessage(NULL, 0, 0, 0, 0, 0);
}
//void EventDetector::SendMessage(int ext,float rmsvalue)
-void EventDetector::SendMessage(int ext, float rmsvalue, float mv2, int under, int over, int duration)
+void EventDetector::SendMessage(float *buffer, float rmsvalue, float mv2, int under, int over, int duration)
{
+ int ext=0;// So para compatibilidade, foram retirada as mensagem externas
int flagrfid = 0;
float seno[NUMBER_OF_HARMONICS+1],coss[NUMBER_OF_HARMONICS+1],mv;
int type=0,outlet_number=0, aux=0;
@@ -226,7 +226,7 @@
if (type == 1 || type == 2 || type == 4) // Calula FFT s nos eventos de fuga, acompanhamento de fuga (diferencial) e liga
- SignalProcessor::CalculateFFT(&Capture::m_AdcBuffers[m_Channel][0],seno,coss,&mv,1, m_Channel);
+ SignalProcessor::CalculateFFT(buffer,seno,coss,&mv,1, m_Channel);
else
for(int i=0; i < Settings::get_MaxHarmonics(); i++)
seno[i] = coss[i] = 0;
--- a/Headers/Capture.h Mon Jan 18 18:01:59 2016 +0000
+++ b/Headers/Capture.h Mon Jan 18 18:26:03 2016 +0000
@@ -30,7 +30,7 @@
public:
//Usa buffe r de 256 * 2 valores para usar na FFT
- static float m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES*2];
+ static float m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES];
public:
--- a/Headers/EventDetector.h Mon Jan 18 18:01:59 2016 +0000
+++ b/Headers/EventDetector.h Mon Jan 18 18:26:03 2016 +0000
@@ -71,7 +71,7 @@
Timer m_tempo;
//void SendMessage(int ext,float rmsvalue);
- void SendMessage(int ext, float rmsvalue, float mv2, int under, int over, int duration);
+ void SendMessage(float *buffer, float rmsvalue, float mv2, int under, int over, int duration);
int TimeDelay(int t);
--- a/main.cpp Mon Jan 18 18:01:59 2016 +0000
+++ b/main.cpp Mon Jan 18 18:26:03 2016 +0000
@@ -98,7 +98,7 @@
Thread telnetserver(TelnetServer::TelnetServer_Thread);
//Start TFTP Service
- //Thread tftpsrv(tftpsrv::tftpsrv_Thread);
+ Thread tftpsrv(tftpsrv::tftpsrv_Thread);
//Start NTP Client for refresh time
//Thread ntpc(ntpc::ntpc_Thread);
