yei

Dependencies:   interface mbed enc_1multi calPID motorout KondoServoLibrary

Fork of cat18_operate by Catch the GIANT Caplico!

Revision:
19:48c3af917932
Parent:
18:05f5a3323bda
Child:
20:13934809e117
--- a/interrupt/interrupt.cpp	Fri Aug 17 00:10:25 2018 +0000
+++ b/interrupt/interrupt.cpp	Fri Aug 17 08:47:23 2018 +0000
@@ -14,11 +14,12 @@
 int counterpart_is_in_common;
 char can_pub_data[kCanlength_rightleft];
 
-const double kTicker_s = 0.01;
+const double kTicker_s = 0.001;
 const int kCanCount = kCanTicker_s / kTicker_s;
 const int kPIDCount = kPIDTicker_s / kTicker_s;
-const int kServoCount = kServoTicker_s / kTicker_s;
-const int kCountReset=kPIDCount*kServoCount*kCanCount;
+const int kServoCalCount = kServoCalTicker_s / kTicker_s;
+const int kServoMoveCount = kServoMoveTicker_s / kTicker_s;
+const int kCountReset=kPIDCount*kServoCalCount*kCanCount*kServoMoveCount;
 
 void TimerInterrupt();
 void CanRead();
@@ -32,10 +33,13 @@
 void TimerInterrupt()
 {
     static int count = 0;
-    PIDInterrupt();
-    if(count % kServoCount==0){
-        ServoTargetInterrupt();
+    if(count % kPIDCount == 0) PIDInterrupt();
+    if(count % kServoCalCount==0){
+        ServoCalInterrupt();
     }
+    //if(count % kServoMoveCount==0){
+    //    ServoMoveInterrupt();
+    //}
     /*
     if(count % kCanCount==0){
         CanRead();
@@ -48,6 +52,7 @@
 int GetCounterpartIsInCommon()
 {
     if(shootingbox[9].is_exist == 0) counterpart_is_in_common = 1;
+    else counterpart_is_in_common = 0;
     return counterpart_is_in_common;
 }