2020/08/31 bmx055のライブラリ及びプログラム内容を一部変更. 変換レートを更新する必要あり?

Dependencies:   mbed BMX055_rev2 SDFileSystem GPS_Interface

Revision:
8:c2812fae50df
Parent:
7:e68ead6d3c1a
Child:
9:fc0559c27628
diff -r e68ead6d3c1a -r c2812fae50df main.cpp
--- a/main.cpp	Fri Aug 28 06:51:20 2020 +0000
+++ b/main.cpp	Sat Aug 29 08:30:57 2020 +0000
@@ -19,7 +19,7 @@
 Timeout t;
 //double a[3],b[3],c[3];
 
-int i,j=0,rlock,mode;
+int i,j=0,rlock,mode,north,east;
 char ns,ew;
 float w_time;//,hokui,tokei;
 float hokui,tokei;
@@ -49,7 +49,7 @@
     gps.baud(9600); 
     //pc.baud(9600);
     //gps.attach(getGPS(&hokui_n,&tokei_n),Serial::RxIrq);
-    fprintf(fp,"N,E,acc:x,acc:y,acc:z,gyr:x,gyr:y,gyr:z,mag:x,mag:y,mag:z");
+    //fprintf(fp,"N,E,acc:x,acc:y,acc:z,gyr:x,gyr:y,gyr:z,mag:x,mag:y,mag:z");
     warikomi.attach(&FlightPinDriver,0.5);
     
    
@@ -59,9 +59,13 @@
         bmx.getGyro();//角力加速度の取得
         bmx.getMag();//地磁気の取得
         getGPS(hokui_n,tokei_n);//GPS取得
-        fprintf(fp,"%f,%f,%f,%f,%f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f\n\r",hokui_n,tokei_n,(bmx.accel[0]/512)*9.8,
-        (bmx.accel[1]/512)*9.8,(bmx.accel[2]/512)*9.8,(bmx.gyroscope[0]*125)/2048,
-        (bmx.gyroscope[1]*125)/2048,(bmx.gyroscope[2]*125)/2048,bmx.magnet[0],bmx.magnet[1],bmx.magnet[2]);
+        if(hokui_n==NULL){
+            *hokui_n=0;}
+        if(tokei_n==NULL){
+            *tokei_n=0;}
+        //(fp,"%f,%f,%f,%f,%f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f\n\r",hokui_n,tokei_n,(bmx.accel[0]/512)*9.8,
+        //(bmx.accel[1]/512)*9.8,(bmx.accel[2]/512)*9.8,(bmx.gyroscope[0]*125)/2048,
+        //(bmx.gyroscope[1]*125)/2048,(bmx.gyroscope[2]*125)/2048,bmx.magnet[0],bmx.magnet[1],bmx.magnet[2]);
         int a[3],b[3],c[3];
         for(int i=0;i<3;i++){
             a[i]=bmx.accel[i];
@@ -73,7 +77,7 @@
                      
             }
         //GPS部分
-        //getGPS(hokui_n,tokei_n);
+        
         //fprintf(fp,"北緯:%f,東経:%f,加速度:%f,%f,%f,ジャイロ:%2.4f,%2.4f,%2.4f\n\r",hokui_n,tokei_n,(bmx.accel[0]/512)*9.8,(bmx.accel[1]/512)*9.8,(bmx.accel[2]/512)*9.8,(bmx.gyroscope[0]*125)/2048,(bmx.gyroscope[1]*125)/2048,(bmx.gyroscope[2]*125)/2048);
 
         //IM920部分
@@ -86,7 +90,12 @@
         
         uart.printf("%04x%04x%04x",a[0],a[1],a[2]);//加速度の書き出し
         uart.printf("%04x%04x%04x",b[0],b[1],b[2]);//角加速度の書き出し
-        uart.printf("%08x%08x",(*hokui_n * 10000),(*tokei_n * 10000));//GPS書き出し
+        
+        north=*(hokui_n) * 1000000;
+        east=*(tokei_n) * 1000000;
+        
+        
+        uart.printf("%08x%08x",east,north);//GPS書き出し
         
         uart.printf("\r\n");
 
@@ -152,7 +161,7 @@
 void FlightPinDriver(){
     
     if(FlightPin==1){
-            printf("Flight Pin Worked!!");
+            printf("Flight Pin Worked!!\n\r");
             warikomi.detach();
             t.attach(nichrome_ON,3);//ニクロムを作動させるまでの時間
             }