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:
- 26:256bf8284cb6
- Parent:
- 25:236d7a498f38
- Child:
- 27:4eb9687ab6c2
--- a/merged_code.cpp Thu Jun 25 13:44:04 2015 +0000
+++ b/merged_code.cpp Fri Jun 26 08:51:50 2015 +0000
@@ -2,6 +2,8 @@
Designed to work from year 2015 to 2020
*/
+//Timestamp store bug in fft file pending
+
#include "mbed.h"
#include "arm_math.h"
#include "SDFileSystem.h"
@@ -9,7 +11,7 @@
#define freq 1
#define fft_points 16384
#define dur_sec 16.384
-#define module_name "TFT2" //enter module name here
+#define module_name "BHJ3" //enter module name here
Serial pc(USBTX, USBRX);
Serial gsm(D1, D0);
@@ -249,7 +251,7 @@
void GetTime_CSQ()
{
- if(sendATcommand("AT+CCLK?\r", "OK", 10,1)){
+ sendATcommand("AT+CCLK?\r", "OK", 10,1);
//sprintf(response,timestamp);
int x=20;
year = 10*(timestamp[x+1]-48) + (timestamp[x+2]-48);
@@ -257,10 +259,9 @@
date = (timestamp[x+7]-48)*10+(timestamp[x+8]-48);
hour = (timestamp[x+10]-48)*10+(timestamp[x+11]-48);
minute = (timestamp[x+13]-48)*10+(timestamp[x+14]-48);
- second = (timestamp[x+16]-48)*10+(timestamp[x+17]-48);
+ second = (timestamp[x+16]-48)*10+(timestamp[x+17]-48);
+ sprintf(time_stamp,"%02d%02d%02d%02d%02d%02d",year,month,date,hour,minute,second);
- sprintf(time_stamp,"%02d%02d%02d%02d%02d%02d",year,month,date,hour,minute,second);
- }
//pc.printf("Get time result:%s.....",time_stamp);
if(sendATcommand("AT+CSQ","OK",5,3)){
if(csq[18]==44){
@@ -306,7 +307,7 @@
sprintf(hour_dir,"%s/%s%02d%02d%02d%02d",date_dir,sitename,year,month,date,hour);
sprintf(filepath,"%s/%s%02d%02d%02d%02d%02d%02d",hour_dir,sitename,year,month,date,hour,minute,second);
sprintf(filename,"%s%02d%02d%02d%02d%02d%02d",sitename,year,month,date,hour,minute,second);
- sprintf(ftpputpathname,"%s/%02d%02d/%02d/%02d",module_name,year,month,date,hour); // For FTPPUTPATHNAME feature
+ sprintf(ftpputpathname,"%s/%02d/%02d/%02d/%02d",module_name,year,month,date,hour); // For FTPPUTPATHNAME feature
//pc.printf("Ftpputpathname is %s\r\n",ftpputpathname); // For FTPPUTPATHNAME feature
gsmerr=0;
mkdir(main_dir,0777);
@@ -647,11 +648,11 @@
else
{
fprintf(fp, "%s",time_stamp);
- fprintf(fp, " %s",csq_value);
- fprintf(fp, " %d",avg_dc_detect[0]);
- fprintf(fp, " %d",avg_dc_detect[1]);
- fprintf(fp, " %d",avg_temp[0]);
- fprintf(fp, " %d",avg_temp[1]);
+ fprintf(fp, " CSQ %s",csq_value);
+ fprintf(fp, " AD1 %d",avg_dc_detect[0]);
+ fprintf(fp, " AD2 %d",avg_dc_detect[1]);
+ fprintf(fp, " AT1 %d",avg_temp[0]);
+ fprintf(fp, " AT2 %d",avg_temp[1]);
fprintf(fp, " %.0f",AC_rms_value);
fclose(fp);
}
@@ -776,11 +777,11 @@
wait(3);
if(sendATcommand("AT+FTPTYPE=\"I\"", "OK", 5,0))
{
- if(sendATcommand("AT+FTPSERV=\"ftp.panchsheel.biz\"", "OK", 10,0))
+ if(sendATcommand("AT+FTPSERV=\"ftp.magnetsnmiracles.com\"", "OK", 10,0))
{
- if(sendATcommand("AT+FTPUN=\"hardware@panchsheel.biz\"", "OK\r", 10,0))
+ if(sendATcommand("AT+FTPUN=\"rjsmstrial@magnetsnmiracles.com\"", "OK\r", 10,0))
{
- if(sendATcommand("AT+FTPPW=\"DAStest123\"", "OK\r", 10,0)) return 1;
+ if(sendATcommand("AT+FTPPW=\"Krliu@3i\"", "OK\r", 10,0)) return 1;
}
}
}
@@ -857,7 +858,7 @@
sprintf(command2,"%s/%s/\"", "AT+FTPPUTPATH=\"", ftpputpathname); // For FTPPUTPATHNAME Feature
//sprintf(result2,"%s", "OK");
sendATcommand(command2,"OK", 10,0);
- if(sendATcommand3("AT+FTPPUT=1", "OK", "+FTPPUT:1,1,1294",15))
+ if(sendATcommand3("AT+FTPPUT=1", "OK", "+FTPPUT:1,1",20))
{
//wait(8);
// pc.printf("in loop");
@@ -1064,11 +1065,12 @@
int main()
{
-
+ //pc.printf("\r\nHelloWorld\r\n");
gsm_rst=0;
wait(1);
gsm_rst=1;
wait(8);
+ //pc.printf("\r\nHelloWorld\r\n");
if(gsm_init()==0){
reset_mod(); //COA for gsm init failure TBD
}