|
|
|
|
@ -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);
|
|
|
|
|
|