calibrate rear (blue) pcb, temp and voltage

This commit is contained in:
interfisch 2019-12-10 23:44:35 +01:00
parent f302ff8041
commit 794edd5169
1 changed files with 43 additions and 14 deletions

View File

@ -1,6 +1,10 @@
#pragma once
#include "stm32f1xx_hal.h"
//Select the calibration values for the different pcbs
//#define BOBBYCAR_PCB_FRONT
#define BOBBYCAR_PCB_REAR
// ############################### DO-NOT-TOUCH SETTINGS ###############################
#define PWM_FREQ 16000 // PWM frequency in Hz
@ -42,8 +46,15 @@
* Then you can verify voltage on value 6 (to get calibrated voltage multiplied by 100).
*/
#define BAT_FILT_COEF 655 // battery voltage filter coefficient in fixed-point. coef_fixedPoint = coef_floatingPoint * 2^16. In this case 655 = 0.01 * 2^16
#define BAT_CALIB_REAL_VOLTAGE 4300 // input voltage measured by multimeter (multiplied by 100). In this case 43.00 V * 100 = 4300
#define BAT_CALIB_ADC 1704 // adc-value measured by mainboard (value nr 5 on UART debug output)
#ifdef BOBBYCAR_PCB_REAR
//REAR WHEELS PCB
#define BAT_CALIB_REAL_VOLTAGE 4000 // input voltage measured by multimeter (multiplied by 100). In this case 40.00 V * 100 = 4000
#define BAT_CALIB_ADC 1593 // adc-value measured by mainboard (value nr 5 on UART debug output)
#endif
#ifdef BOBBYCAR_PCB_FRONT
#define BAT_CALIB_REAL_VOLTAGE 4000 // input voltage measured by multimeter (multiplied by 100). In this case 40.00 V * 100 = 4300
#define BAT_CALIB_ADC 1593 // adc-value measured by mainboard (value nr 5 on UART debug output)
#endif
#define BAT_CELLS 10 // battery number of cells. Normal Hoverboard battery: 10s
#define BAT_LOW_LVL1_ENABLE 0 // to beep or not to beep, 1 or 0
@ -61,10 +72,21 @@
* Enable warning and/or poweroff and make and flash firmware.
*/
#define TEMP_FILT_COEF 655 // temperature filter coefficient in fixed-point. coef_fixedPoint = coef_floatingPoint * 2^16. In this case 655 = 0.01 * 2^16
#define TEMP_CAL_LOW_ADC 1716 // temperature 1: ADC value
#define TEMP_CAL_LOW_DEG_C 210 // temperature 1: measured temperature [°C * 10]. Here 35.8 °C
#define TEMP_CAL_HIGH_ADC 1600 // temperature 2: ADC value
#define TEMP_CAL_HIGH_DEG_C 420 // temperature 2: measured temperature [°C * 10]. Here 48.9 °C
#ifdef BOBBYCAR_PCB_REAR
//REAR WHEELS PCB
#define TEMP_CAL_LOW_ADC 1722 // temperature 1: ADC value
#define TEMP_CAL_LOW_DEG_C 220 // temperature 1: measured temperature [°C * 10]. Here 22.0 °C
#define TEMP_CAL_HIGH_ADC 1580 // temperature 2: ADC value
#define TEMP_CAL_HIGH_DEG_C 500 // temperature 2: measured temperature [°C * 10]. Here 50.0 °C
#endif
#ifdef BOBBYCAR_PCB_FRONT
//FRONT WHEELS PCB
#define TEMP_CAL_LOW_ADC 1722 // temperature 1: ADC value
#define TEMP_CAL_LOW_DEG_C 220 // temperature 1: measured temperature [°C * 10]. Here 22.0 °C
#define TEMP_CAL_HIGH_ADC 1580 // temperature 2: ADC value
#define TEMP_CAL_HIGH_DEG_C 500 // temperature 2: measured temperature [°C * 10]. Here °C
#endif
#define TEMP_WARNING_ENABLE 1 // to beep or not to beep, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
#define TEMP_WARNING 600 // annoying fast beeps [°C * 10]. Here 60.0 °C
#define TEMP_POWEROFF_ENABLE 0 // to poweroff or not to poweroff, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!
@ -91,14 +113,14 @@
#define USART2_BAUD 38400 // UART2 baud rate (long wired cable, soldered next to buzzer)
#define USART2_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
#define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
#define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
//#define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
//#define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
//#define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
#define USART3_BAUD 38400 // UART3 baud rate (short wired cable)
#define USART3_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
// #define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used! For Arduino control check the hoverSerial.ino
// #define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
#define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used! For Arduino control check the hoverSerial.ino
#define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
//#define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
#if defined(FEEDBACK_SERIAL_USART2) || defined(DEBUG_SERIAL_USART2)
@ -188,8 +210,15 @@
#define SPEED_COEFFICIENT 16384 // 1.0f [-] higher value == stronger. [0, 65535] = [-2.0, 2.0]. In this case 16384 = 1.0 * 2^14
#define STEER_COEFFICIENT 8192 // 0.5f [-] higher value == stronger. [0, 65535] = [-2.0, 2.0]. In this case 8192 = 0.5 * 2^14. If you do not want any steering, set it to 0.
#define INVERT_R_DIRECTION
#define INVERT_L_DIRECTION
#ifdef BOBBYCAR_PCB_REAR
//#define INVERT_R_DIRECTION
//#define INVERT_L_DIRECTION
#endif
#ifdef BOBBYCAR_PCB_FRONT
//#define INVERT_R_DIRECTION
//#define INVERT_L_DIRECTION
#endif
#define BEEPS_BACKWARD 0 // 0 or 1
// ###### SIMPLE BOBBYCAR ######