9/10
Diff: AMT21.cpp
- Revision:
- 5:b78f031b66f7
- Parent:
- 2:e0164b9fe93a
diff -r 1ee3f6183111 -r b78f031b66f7 AMT21.cpp --- a/AMT21.cpp Wed Apr 14 12:18:56 2021 +0000 +++ b/AMT21.cpp Fri Sep 10 08:55:09 2021 +0000 @@ -56,25 +56,34 @@ receive_mode=RECEIVE_TURN; sendMessage(); wait_us(190); - int turn,receive_; + int turn_,receive_; receive_=((high_turn&0b00111111)<<8)+low_turn; if(receive_>th_max&&receive_old<th_min) {//ターン数がアンダーフローしたとき flow_count--; } else if(receive_<th_min&&receive_old>th_max) { //ターン数がオーバーフローした場合 flow_count++; } - turn=receive_+flow_count*RESOLUTION_AMT21; + turn_=receive_+flow_count*RESOLUTION_AMT21; receive_old=receive_; - return turn; + return turn_; } -void Amt21::rewriteCount() +void Amt21::rewriteCount_1() { - int count,turn; + int count,turn_; count=getAbCount(); wait_us(200); - turn=getTurn(); - count_=count+RESOLUTION_AMT21*turn; + turn_=getTurn(); + count_=-(count+RESOLUTION_AMT21*turn_); } +void Amt21::rewriteCount_2() +{ + int count,turn_; + count=getAbCount(); + wait_us(200); + turn_=getTurn(); + count_=count+RESOLUTION_AMT21*turn_; +} + int Amt21::getCount() { return count_;