More compile defines
This commit is contained in:
@ -36,13 +36,15 @@ include_directories(
|
|||||||
|
|
||||||
#add_definitions(-DMOTOR_TEST)
|
#add_definitions(-DMOTOR_TEST)
|
||||||
add_definitions(-DFEATURE_IGNORE_OTHER_MOTOR)
|
add_definitions(-DFEATURE_IGNORE_OTHER_MOTOR)
|
||||||
|
add_definitions(-DGSCHISSENES_HALL)
|
||||||
|
#add_definitions(-DGSCHISSENE_PWM_FREQ)
|
||||||
#add_definitions(-DFEATURE_BUTTON)
|
#add_definitions(-DFEATURE_BUTTON)
|
||||||
add_definitions(-DPETERS_PLATINE)
|
add_definitions(-DPETERS_PLATINE)
|
||||||
add_definitions(-DHUARN2)
|
#add_definitions(-DHUARN2)
|
||||||
#add_definitions(-DHUARN3)
|
#add_definitions(-DHUARN3)
|
||||||
#add_definitions(-DFEATURE_SERIAL_CONTROL)
|
#add_definitions(-DFEATURE_SERIAL_CONTROL)
|
||||||
#add_definitions(-DFEATURE_SERIAL_FEEDBACK)
|
#add_definitions(-DFEATURE_SERIAL_FEEDBACK)
|
||||||
add_definitions(-DLOG_TO_SERIAL)
|
#add_definitions(-DLOG_TO_SERIAL)
|
||||||
add_definitions(-DFEATURE_CAN)
|
add_definitions(-DFEATURE_CAN)
|
||||||
#add_definitions(-DCAN_LOG_UNKNOWN_ADDR)
|
#add_definitions(-DCAN_LOG_UNKNOWN_ADDR)
|
||||||
add_definitions(-DIS_BACK)
|
add_definitions(-DIS_BACK)
|
||||||
|
2
config.h
2
config.h
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef PETERS_PLATINE
|
#ifdef GSCHISSENE_PWM_FREQ
|
||||||
#define PWM_FREQ 12000 // PWM frequency in Hz
|
#define PWM_FREQ 12000 // PWM frequency in Hz
|
||||||
#else
|
#else
|
||||||
#define PWM_FREQ 16000 // PWM frequency in Hz
|
#define PWM_FREQ 16000 // PWM frequency in Hz
|
||||||
|
24
defines.h
24
defines.h
@ -23,33 +23,57 @@
|
|||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
|
||||||
#ifdef PETERS_PLATINE
|
#ifdef PETERS_PLATINE
|
||||||
|
#ifdef GSCHISSENES_HALL
|
||||||
|
#define LEFT_HALL_U_PIN GPIO_PIN_10
|
||||||
|
#define LEFT_HALL_V_PIN GPIO_PIN_11
|
||||||
|
#define LEFT_HALL_W_PIN GPIO_PIN_12
|
||||||
|
#else
|
||||||
#define LEFT_HALL_U_PIN GPIO_PIN_12
|
#define LEFT_HALL_U_PIN GPIO_PIN_12
|
||||||
#define LEFT_HALL_V_PIN GPIO_PIN_11
|
#define LEFT_HALL_V_PIN GPIO_PIN_11
|
||||||
#define LEFT_HALL_W_PIN GPIO_PIN_10
|
#define LEFT_HALL_W_PIN GPIO_PIN_10
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LEFT_HALL_U_PORT GPIOC
|
#define LEFT_HALL_U_PORT GPIOC
|
||||||
#define LEFT_HALL_V_PORT GPIOC
|
#define LEFT_HALL_V_PORT GPIOC
|
||||||
#define LEFT_HALL_W_PORT GPIOC
|
#define LEFT_HALL_W_PORT GPIOC
|
||||||
|
|
||||||
|
#ifdef GSCHISSENES_HALL
|
||||||
|
#define RIGHT_HALL_U_PIN GPIO_PIN_7
|
||||||
|
#define RIGHT_HALL_V_PIN GPIO_PIN_6
|
||||||
|
#define RIGHT_HALL_W_PIN GPIO_PIN_5
|
||||||
|
#else
|
||||||
#define RIGHT_HALL_U_PIN GPIO_PIN_5
|
#define RIGHT_HALL_U_PIN GPIO_PIN_5
|
||||||
#define RIGHT_HALL_V_PIN GPIO_PIN_6
|
#define RIGHT_HALL_V_PIN GPIO_PIN_6
|
||||||
#define RIGHT_HALL_W_PIN GPIO_PIN_7
|
#define RIGHT_HALL_W_PIN GPIO_PIN_7
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RIGHT_HALL_U_PORT GPIOB
|
#define RIGHT_HALL_U_PORT GPIOB
|
||||||
#define RIGHT_HALL_V_PORT GPIOB
|
#define RIGHT_HALL_V_PORT GPIOB
|
||||||
#define RIGHT_HALL_W_PORT GPIOB
|
#define RIGHT_HALL_W_PORT GPIOB
|
||||||
|
#else
|
||||||
|
#ifdef GSCHISSENES_HALL
|
||||||
|
#define LEFT_HALL_U_PIN GPIO_PIN_7
|
||||||
|
#define LEFT_HALL_V_PIN GPIO_PIN_6
|
||||||
|
#define LEFT_HALL_W_PIN GPIO_PIN_5
|
||||||
#else
|
#else
|
||||||
#define LEFT_HALL_U_PIN GPIO_PIN_5
|
#define LEFT_HALL_U_PIN GPIO_PIN_5
|
||||||
#define LEFT_HALL_V_PIN GPIO_PIN_6
|
#define LEFT_HALL_V_PIN GPIO_PIN_6
|
||||||
#define LEFT_HALL_W_PIN GPIO_PIN_7
|
#define LEFT_HALL_W_PIN GPIO_PIN_7
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LEFT_HALL_U_PORT GPIOB
|
#define LEFT_HALL_U_PORT GPIOB
|
||||||
#define LEFT_HALL_V_PORT GPIOB
|
#define LEFT_HALL_V_PORT GPIOB
|
||||||
#define LEFT_HALL_W_PORT GPIOB
|
#define LEFT_HALL_W_PORT GPIOB
|
||||||
|
|
||||||
|
#ifdef GSCHISSENES_HALL
|
||||||
|
#define RIGHT_HALL_U_PIN GPIO_PIN_12
|
||||||
|
#define RIGHT_HALL_V_PIN GPIO_PIN_11
|
||||||
|
#define RIGHT_HALL_W_PIN GPIO_PIN_10
|
||||||
|
#else
|
||||||
#define RIGHT_HALL_U_PIN GPIO_PIN_10
|
#define RIGHT_HALL_U_PIN GPIO_PIN_10
|
||||||
#define RIGHT_HALL_V_PIN GPIO_PIN_11
|
#define RIGHT_HALL_V_PIN GPIO_PIN_11
|
||||||
#define RIGHT_HALL_W_PIN GPIO_PIN_12
|
#define RIGHT_HALL_W_PIN GPIO_PIN_12
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RIGHT_HALL_U_PORT GPIOC
|
#define RIGHT_HALL_U_PORT GPIOC
|
||||||
#define RIGHT_HALL_V_PORT GPIOC
|
#define RIGHT_HALL_V_PORT GPIOC
|
||||||
|
4
main.cpp
4
main.cpp
@ -373,7 +373,9 @@ int main()
|
|||||||
|
|
||||||
while ((HAL_GetTick() - tickstart) < wait)
|
while ((HAL_GetTick() - tickstart) < wait)
|
||||||
{
|
{
|
||||||
|
#ifdef FEATURE_CAN
|
||||||
applyIncomingCanMessage();
|
applyIncomingCanMessage();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1421,7 +1423,7 @@ void doMotorTest()
|
|||||||
right.rtP.id_fieldWeakMax = (0 * A2BIT_CONV) << 4;
|
right.rtP.id_fieldWeakMax = (0 * A2BIT_CONV) << 4;
|
||||||
right.rtP.a_phaAdvMax = 40 << 4;
|
right.rtP.a_phaAdvMax = 40 << 4;
|
||||||
|
|
||||||
constexpr auto pwmMax = 250;
|
constexpr auto pwmMax = 400;
|
||||||
|
|
||||||
pwm += dir;
|
pwm += dir;
|
||||||
if (pwm > pwmMax) {
|
if (pwm > pwmMax) {
|
||||||
|
Reference in New Issue
Block a user