Modified Motor Driver Firmware to include Flash + Thermal
Dependencies: FastPWM3 mbed-dev-STM-lean
Diff: main.cpp
- Revision:
- 76:4fd876d4cf2b
- Parent:
- 75:c7fbacd92b8f
- Child:
- 77:81c2cbc5d906
--- a/main.cpp Mon Aug 29 18:57:14 2022 +0000 +++ b/main.cpp Tue Oct 18 16:22:24 2022 +0000 @@ -13,9 +13,11 @@ #define VERSION_NUM "2.0" //changed to 2.0 for flash storage version +#define LOG_POINTS 500 float __float_reg[64]; // Floats stored in flash int __int_reg[256]; // Ints stored in flash. Includes position sensor calibration lookup table +float pos_high_frequency[LOG_POINTS]; #include "mbed.h" #include "PositionSensor.h" @@ -518,6 +520,14 @@ case 'd': controller.i_q_ref = 0; controller.i_d_ref = 0; + case 'p': + //turn off switching + state = REST_MODE; + state_change = 1; + //print the characters to terminal + for (int i=0; i< LOG_POINTS; i++) { + printf("%f\n\r", pos_high_frequency[i]); //return carrige + } } } @@ -638,6 +648,13 @@ wait(.1); if(controller.otw_flag){gpio.led->write(!gpio.led->read());} + + if(state == MOTOR_MODE) { + for (int i=0; i<= LOG_POINTS-2; i++) { + pos_high_frequency[i] = pos_high_frequency[i+i]; + } + pos_high_frequency[499] = controller.theta_mech; + } /* if(state == MOTOR_MODE) {