change2shinsu

Dependencies:   mbed mbedTimer SDFileSystem MU2 GPS

Revision:
19:75067f4d49b6
Parent:
18:05d5de29511d
Child:
20:b70e877cdc0f
--- a/main.cpp	Tue Sep 03 20:34:51 2019 +0000
+++ b/main.cpp	Sat Sep 07 22:07:18 2019 +0000
@@ -11,7 +11,8 @@
 #define THRESHOLID 0.45  //感圧のしきい値 0.45
 #define SAMPLENUMBER 5   //しきい値判定に用いるサンプル数 5
 #define CLOSETIME 60     //しきい値超えてからのインレット閉鎖機構の稼働時間を設定 60
-#define INTERVALTIME 1800 //インターバルモードの時間 1800
+#define LIMITTIME 1800   //しきい値超えなくてもインターバルモードへ移行
+#define INTERVALTIME 7200 //インターバルモードの時間 1800
 #define INTERVAL_HIGH 5  //インターバルモードでモーター回す時間 5
 #define INTERVAL_LOW 20  //インターバルモードでモーター止める時間 20
 
@@ -240,6 +241,7 @@
             snprintf(sensorMessage, 128, "%f", ave_sensor);
             MuPort.send(sensorMessage);
             fprintf(fp, "%s %s\n",myTimer.timeMessage,mygps.getGPS);
+            timer++;
         }
 
 
@@ -303,6 +305,7 @@
             break;
 
         }
+        
 
         if(val>=1800) {
             //timer_rec.stop();
@@ -312,6 +315,20 @@
             val=0;
 
         }
+        
+        if(timer>LIMITTIME) {
+            inlet.Stop();
+            val=timer_rec.read();
+            val3=val+val2;
+            myTimer.sendMessage(val3);
+            fprintf(fp, "%s ClosingModeFinsh!\r\n",myTimer.timeMessage);
+            MuPort.send(myTimer.timeMessage);
+            MuPort.send("Closing Mode Finish!\r\n");
+            fclose(fp);
+            fclose(fp2);
+            break;
+
+        }
 
         inlet.Close(1.1);//1より大きい引数にしておけばモーターはずっと回ってる.