working 2 motors

This commit is contained in:
Oskar Weigl
2016-12-11 23:47:17 +09:00
parent 4a85368384
commit 28b4740b18
4 changed files with 8 additions and 3 deletions
+1
View File
@@ -52,6 +52,7 @@
/* Private define ------------------------------------------------------------*/
#define TIM_CLOCK_HZ 168000000
#define TIM_PERIOD_CLOCKS 8192
// #define TIM_PERIOD_CLOCKS 4096
#define TIM_DEADTIME_CLOCKS 20
#define M0_nCS_Pin GPIO_PIN_13
+1
View File
@@ -14,6 +14,7 @@ TARGET = ODriveFirmware
DEBUG = 1
# optimization
# OPT = -O3 -ffast-math -flto
# OPT = -O3 -ffast-math
OPT = -O0 -ffast-math
#######################################
+5 -2
View File
@@ -528,8 +528,11 @@ void motor_thread(void const * argument) {
float test_current = 4.0f;
float R = measure_phase_resistance(motor, test_current, 1.0f);
// scan_motor(motor, 10.0f, test_current * R);
scan_motor(motor, 10.0f, 0.2f);
if (motor == &motors[0]) {
scan_motor(motor, 50.0f, test_current * R);
} else {
scan_motor(motor, 10.0f, test_current * R);
}
// float L = measure_phase_inductance(motor, -1.0f, 1.0f);
//De-energize motor
+1 -1
View File
@@ -114,7 +114,7 @@ void StartDefaultTask(void const * argument)
init_motor_control();
// Start motor threads
// osThreadCreate(osThread(task_motor_0), &motors[0]);
osThreadCreate(osThread(task_motor_0), &motors[0]);
osThreadCreate(osThread(task_motor_1), &motors[1]);
//If we get to here, then the default task is done.