20210203

Dependencies:   mbed FastPWM

Revision:
192:637092202815
Parent:
180:02be1711ee0b
Child:
209:ebc69d6ee6f1
--- a/CAN/function_CAN.cpp	Fri Dec 18 00:58:54 2020 +0000
+++ b/CAN/function_CAN.cpp	Fri Dec 18 05:44:16 2020 +0000
@@ -754,6 +754,11 @@
             break;
         }
 
+        case CRX_SET_CHANGE_EVERY_REFERNCE: {
+            flag_every_reference = 1;
+            break;
+        }
+
         default:
             break;
     }
@@ -808,10 +813,18 @@
         f_past[num_array_f_past-1] = torq.sen;  //N
 
         f_future[0] = torq.sen;  //N
-        for(int i=1; i<num_array_f_future-1; i++) {
-            f_future[i] = f_future[i+1];
+
+        if(flag_every_reference == 1) {
+            for(int i=1; i<num_array_f_future-1; i++) {
+                f_future[i] = 500.0f;
+            }
+            f_future[num_array_f_future-1] = 500.0f;  //N
+        } else {
+            for(int i=1; i<num_array_f_future-1; i++) {
+                f_future[i] = f_future[i+1];
+            }
+            f_future[num_array_f_future-1] = torq.ref;  //N
         }
-        f_future[num_array_f_future-1] = torq.ref;  //N
 
 
     } else if(address==CID_RX_REF_VALVE_POS) {