Modified Motor Driver Firmware to include Flash + Thermal

Dependencies:   FastPWM3 mbed-dev-STM-lean

Revision:
75:c7fbacd92b8f
Parent:
74:fcc5f8e7f0ef
--- a/Config/user_config.h	Mon Aug 29 18:09:36 2022 +0000
+++ b/Config/user_config.h	Mon Aug 29 18:57:14 2022 +0000
@@ -3,7 +3,10 @@
 #ifndef USER_CONFIG_H
 #define USER_CONFIG_H
 
+//MOTOR INT PARAMS 
+#define NPP                     21 //__int_reg[200]                                  //TODO --> FIX ISSUES w/ THIS IN FLASH , ask @adi, Number of motor Pole Pairs  
 
+//OFFSET PARAMS / OTHER PARAMS
 #define E_OFFSET                __float_reg[0]                                  // Encoder electrical offset
 #define M_OFFSET                __float_reg[1]                                  // Encoder mechanical offset
 #define I_BW                    __float_reg[2]                                  // Current loop bandwidth
@@ -23,26 +26,21 @@
 #define L_D                     __float_reg[14]                                 //D-axis inductance in HENRIES
 #define L_Q                     __float_reg[15]                                 //L-axis inductance in HENRIES
 //ACTUATOR PARAMETERS
-#define KT                      __float_reg[17]                                 //Torque Constance Nm/peak phase amp, = WB*NPP*3/2
-#define GR                      __float_reg[18]                                 //Output gear ratio
-#define KT_OUT                  __float_reg[19]                                 //KT*GR
-#define WB                      __float_reg[20]                                 //Flux linkage, Webers.  (from motor KT, see above formula)
+#define KT                      __float_reg[16]                                 //Torque Constance Nm/peak phase amp, = WB*NPP*3/2
+#define GR                      __float_reg[17]                                 //Output gear ratio
+#define KT_OUT                  __float_reg[18]                                 //KT*GR
+#define WB                      __float_reg[19]                                 //Flux linkage, Webers.  (from motor KT, see above formula)
 //THERMAL OBSERVER
-#define R_TH                    __float_reg[21]                                 //Kelvin watt per joule (motor thermal resistance)
-#define INV_M_TH                __float_reg[22]                                 //Kelvin per Joule (some observer thing)
-#define T_AMBIENT               __float_reg[23]                                 // ambient temperature during temp calibration
+#define R_TH                    __float_reg[20]                                 //Kelvin watt per joule (motor thermal resistance)
+#define INV_M_TH                __float_reg[21]                                 //Kelvin per Joule (some observer thing)
+#define T_AMBIENT               __float_reg[22]                                 // ambient temperature during temp calibration
 
 
 #define PHASE_ORDER             __int_reg[0]                                    // Phase swapping during calibration
 #define CAN_ID                  __int_reg[1]                                    // CAN bus ID
 #define CAN_MASTER              __int_reg[2]                                    // CAN bus "master" ID
 #define CAN_TIMEOUT             __int_reg[3]                                    // CAN bus timeout period
-#define ENCODER_LUT             __int_reg[5]                                    // Encoder offset LUT - 128 elements long  
-//MOTOR INT PARAMS 
-#define NPP                     __int_reg[200]                                  //Number of motor Pole Pairs            
-
-
-//CHECK THIS BC WTF why would REG[4] break it ???
+#define ENCODER_LUT             __int_reg[5]                                    // Encoder offset LUT - 128 elements long