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: SDFileSystem dspmodified mbed
Diff: merged_code.cpp
- Revision:
- 8:12b4c521c033
- Parent:
- 7:3d5fd645c11d
- Child:
- 9:7965c3bc3199
diff -r 3d5fd645c11d -r 12b4c521c033 merged_code.cpp
--- a/merged_code.cpp Tue Mar 03 07:07:01 2015 +0000
+++ b/merged_code.cpp Wed Mar 04 04:48:49 2015 +0000
@@ -48,6 +48,7 @@
char src[100]=""; // For FTPGET Function
char ftp_timestamp[100]=""; //For Timestamp.txt filename
char ftpputpathname[100]=""; // For FTPPUTHPATH NAME
+int maxfreq = 0; //FOR Timestamp Function
int m=0,mfinal;
int date, month, year, hour, minute, second,minuteold, secondold, temp = 0;
@@ -130,6 +131,7 @@
sprintf(time_stamp,"%02d%02d%02d%02d%02d%02d",year,month,date,hour,minute,second);
}
+
//--------------------------------------------------------------------------------------------------//
// Getting File Directories and names //
//--------------------------------------------------------------------------------------------------//
@@ -329,27 +331,20 @@
//fprintf(fp, "\r\n%s",timestamp);
for(int i=0; i<max_points_count; i++) {
fprintf(fp,"\r\n %d %d",index[i], int(maxima[i]));
+
}
- if(fft_type==0) fprintf(fp,"\r\n\r\n");
+ if(fft_type==0)
+ {
+ fprintf(fp,"\r\n\r\n");
+ maxfreq= index[1];
+ }
else fprintf(fp,"\r\nEOF");
fclose(fp);
}
}
-//---------------------------------------- TIMESTAMP FILE STORAGE ---------------------------------------------------------------------------
-void ftptimestamp()
-{
- char timestampname[100]="";
- sprintf(timestampname,"/sd/Timestamp%s%02d%02d%02d%02d.txt",sitename,year,month,date,hour);
- pc.printf("\r\n Timestampname is %s\r\n",timestampname);
- FILE *fp13 = fopen(timestampname,"a");
- fprintf(fp13,"\r\n%s",ftp_timestamp);
- fclose(fp13);
- pc.printf("\r\nTimestamp.txt Storage Done\n\r");
-
- }
-
+
//---------------------------------------- REMOVE THE FILE FROM THE DIRECTORY ------------------------------------------------------------------
void do_remove(const char *fsrc)
@@ -441,10 +436,12 @@
//pc.printf("\r\nfftstage1");
sprintf(filenamefft,"%sft.txt",filename);
+ //sprintf(ftp_timestamp,"%s",filename); // For FTP Timestamp
sprintf(pathfft,"%sft.txt",filepath);
//pc.printf("\r\nFilename-FFT\t%s", pathfft);
- ftptimestamp(); //For Timestamp.txt filename
+
+
int fft_segments=4;
int fft_start_index[4]= {0,760,1520,2280};
@@ -481,9 +478,22 @@
fprintf(fp, "\r\nAC-RMS %.0f",AC_rms_value);
fclose(fp);
}
+ //TIME STAMP FUNCTION
+ char timestampname[100]="";
+ sprintf(timestampname,"/sd/Timestamp%s%02d%02d%02d%02d.txt",sitename,year,month,date,hour);
+ pc.printf("\r\n Timestampname is %s\r\n",timestampname);
+ FILE *fp13 = fopen(timestampname,"a");
+ fprintf(fp13,"\r\n%02d%02d %d %.0f %d",minute,second,avg_dc_detect/100,AC_rms_value/100000,maxfreq);
+ //pc.printf("Value is \r\n%02d%02d %d %.0f %d",minute,second,avg_dc_detect,AC_rms_value,maxfreq);
+ fclose(fp13);
+ pc.printf("\r\nTimestamp.txt Storage Done\n\r");
+
+
fft(fft_points,0,1,1);
+
//pc.printf("\r\nfftdone");
prepare_fft_array(fft_start_index,fft_points_count,fft_maximas_required,fft_segments,0);
+ // pc.printf("Value is \r\n%02d%02d %d %.0f %d",minute,second,avg_dc_detect/100,AC_rms_value/100000,maxfreq);
//DC fft
for(int i=0; i<fft_points; i++) {
fft_array[i]=int(DCdata[i]);
@@ -521,6 +531,23 @@
// }
}
+//---------------------------------------- TIMESTAMP FILE STORAGE ---------------------------------------------------------------------------
+
+/*
+void ftptimestamp()
+{
+ char timestampname[100]="";
+ sprintf(timestampname,"/sd/Timestamp%s%02d%02d%02d%02d.txt",sitename,year,month,date,hour);
+ pc.printf("\r\n Timestampname is %s\r\n",timestampname);
+ FILE *fp13 = fopen(timestampname,"a");
+ fprintf(fp13,"\r\n%02d%02d %03d %03d %d",minute,second,avg_dc_detect,AC_rms_value,maxfreq);
+ fclose(fp13);
+ pc.printf("\r\nTimestamp.txt Storage Done\n\r");
+
+ }
+*/
+
+
//--------------------------------------------------------------------------------------------------//
// GSM Initialization //
//--------------------------------------------------------------------------------------------------//
@@ -866,6 +893,7 @@
while(1) {
sampling();
store();
+ //ftptimestamp(); //For Timestamp.txt filename
FTP_Fun();
downloadFTP(); // For FTPGET Function
pc.printf("\r\n Complete Done");