diff options
author | ymherklotz <ymherklotz@gmail.com> | 2018-03-08 12:41:10 +0000 |
---|---|---|
committer | ymherklotz <ymherklotz@gmail.com> | 2018-03-08 12:41:10 +0000 |
commit | eb65717dbacac3fee92c765c434bfaa0d1eb61d7 (patch) | |
tree | 63e65068e4dd168d171bf9cf42d2d09a945c35fb | |
parent | 3d0c2bcb8a8540f266097a0c5f9cf45b6db77e2f (diff) | |
download | NoiseSilencer-eb65717dbacac3fee92c765c434bfaa0d1eb61d7.tar.gz NoiseSilencer-eb65717dbacac3fee92c765c434bfaa0d1eb61d7.zip |
Fixed small issue with resetting
-rw-r--r-- | Project/RTDSP/.launches/RTDSP.launch | 2 | ||||
-rw-r--r-- | Project/RTDSP/enhance.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Project/RTDSP/.launches/RTDSP.launch b/Project/RTDSP/.launches/RTDSP.launch index c9206d9..a54495a 100644 --- a/Project/RTDSP/.launches/RTDSP.launch +++ b/Project/RTDSP/.launches/RTDSP.launch @@ -13,7 +13,7 @@ <stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_OPTION" value="full"/> <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8"?> <memoryBlockExpressionList/> "/> <stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out"/> -<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 12:18:55 GMT 2018" time_long="1519733935329"/> <module name="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Thu Mar 01 13:36:20 GMT 2018" time_long="1519911380476"/> <module name="C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 11:30:19 GMT 2018" time_long="1520249419272"/> <module name="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Thu Mar 08 11:58:04 GMT 2018" time_long="1520510284737"/> </modules> "/> +<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 12:18:55 GMT 2018" time_long="1519733935329"/> <module name="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Thu Mar 01 13:36:20 GMT 2018" time_long="1519911380476"/> <module name="C:\GIT\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Mon Mar 05 11:30:19 GMT 2018" time_long="1520249419272"/> <module name="C:\github\RTDSP\Project\RTDSP\Debug\RTDSP.out" time="Thu Mar 08 12:40:39 GMT 2018" time_long="1520512839256"/> </modules> "/> <stringAttribute key="CCEDebugOptions.CPU_NAME" value="Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTDSP"/> <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8"?> <globalVariableList/> "/> diff --git a/Project/RTDSP/enhance.c b/Project/RTDSP/enhance.c index 3aae46a..7094773 100644 --- a/Project/RTDSP/enhance.c +++ b/Project/RTDSP/enhance.c @@ -105,6 +105,7 @@ double avg = 0; MVal M[NUM_M]; float K; float time_constant = 50E-6; /* Time constant in ms */ +int started = 0; /******************************* Function prototypes *******************************/ void init_hardware(void); /* Initialize codec */ void init_HWI(void); /* Initialize hardware interrupts */ @@ -149,7 +150,7 @@ void main() for(i = 0; i < FFTLEN; ++i) { M[k].mag_spec[i] = MAX_FLOAT; } - M[k].sum = 0; + M[k].sum = MAX_FLOAT; } // initializing the value to estimate the low pass filter @@ -203,7 +204,7 @@ void write_spectrum(void) { M[m_ptr].sum = 0; for(k = 0; k < FFTLEN; ++k) { x_val = cabs(fft_out[k]); - if(M[m_ptr].mag_spec[k] > x_val) { + if(x_val < M[m_ptr].mag_spec[k] && x_val != 0) { M[m_ptr].mag_spec[k] = x_val; M[m_ptr].sum += x_val; } else { @@ -217,7 +218,7 @@ void get_noise(void) { int min_index = 0, k; for(k = 1; k < NUM_M; ++k) { - if (M[k].sum != 0 && M[k].sum < min_sum) { + if (M[k].sum < min_sum) { min_sum = M[k].sum; min_index = k; } @@ -332,6 +333,7 @@ void ISR_AIC(void) if (++io_ptr >= CIRCBUF) io_ptr=0; frame_ctr++; + started = 1; } /************************************************************************************/ |