Motor drive constant adjustments

master
Tom Wilson 3 years ago
parent 59a1462abb
commit ec882ef653

@ -9,7 +9,9 @@
#include "esp_adc_cal.h"
#define SYS_VOLTS_PER_ADC_MV ((((2.2+10.0)/2.2)/1000.0)*1.042)
#define MOTOR_AMPS_PER_ADC_MV ((2.5/1000.0)*1.042)
#define MOTOR_AMPS_PER_ADC_MV ((8.5/1000.0)*1.042)
//Roller 3 has a motor driver with the BTS7960B (R9 R3 R8 R2 are all 3K), rather than the BTN7971B (all 1K)
#define MOTOR_AMPS_PER_ADC_MV_R3 ((8.5/1000.0)*1.042)
#define ADC_TASK_STACK_SIZE 2048
@ -47,7 +49,7 @@ static void motor_control_task(void *pvParameters) {
xQueueOverwrite(motor_current_queue[1], &result);
adc_raw = adc1_get_raw(ADC_ROLLER3_IS);
result = esp_adc_cal_raw_to_voltage(adc_raw, &adc1_11db_chars) * MOTOR_AMPS_PER_ADC_MV;
result = esp_adc_cal_raw_to_voltage(adc_raw, &adc1_11db_chars) * MOTOR_AMPS_PER_ADC_MV_R3;
xQueueOverwrite(motor_current_queue[2], &result);
adc_raw = adc1_get_raw(ADC_SYS_VOLTAGE);

@ -10,7 +10,7 @@
#define MAX_DUTY_RAMP 10.0 // max change in duty per second - where 1.0 is full duty
#define MIN_DUTY 0.10 // min duty for each motor
#define MAX_DUTY 0.99 // max duty for each motor - Needs to be below 0.33 to avoid overlapping the three motor phases
#define MAX_DUTY 0.55 // max duty for each motor - Needs to be below 0.33 to avoid overlapping the three motor phases
#define DEFAULT_KP 0.0
#define DEFAULT_KI 5.0

Loading…
Cancel
Save