9/10

Revision:
2:e0164b9fe93a
Parent:
1:3838b5e3966c
Child:
5:b78f031b66f7
diff -r 3838b5e3966c -r e0164b9fe93a AMT21.cpp
--- a/AMT21.cpp	Mon Apr 12 06:08:22 2021 +0000
+++ b/AMT21.cpp	Tue Apr 13 16:50:54 2021 +0000
@@ -38,6 +38,7 @@
     } else if(receive_mode==3) {//turn受信モード(上8ビット)
         high_turn=serial_.getc();
     }
+    wait_us(2);
 }
 int Amt21::getAbCount()
 {
@@ -66,19 +67,20 @@
     receive_old=receive_;
     return turn;
 }
-int Amt21::getCount()
+void Amt21::rewriteCount()
 {
     int count,turn;
     count=getAbCount();
-    wait_us(150);
+    wait_us(200);
     turn=getTurn();
     count_=count+RESOLUTION_AMT21*turn;
-
+}
+int Amt21::getCount()
+{
     return count_;
 }
 double Amt21::getDeg()
 {
-    getCount();
     double angle_;
     angle_=(count_-COUNT_OFFSET)*360.0/RESOLUTION_AMT21;
     angle_/=GEER_STEER;
@@ -86,7 +88,6 @@
 }
 double Amt21::getRad()
 {
-    getCount();
     double angle_;
     angle_=(count_-COUNT_OFFSET)*2.0f*M_PI/RESOLUTION_AMT21;
     angle_/=GEER_STEER;
@@ -103,7 +104,7 @@
     getTurn();//
     flow_count=0;
     receive_old=0;
-    printf("reset Amt21\r\n");
+//    printf("reset Amt21\r\n");
 }
 void Amt21::calOmega()
 {