Compare commits
4 Commits
peters_pla
...
master
Author | SHA1 | Date | |
---|---|---|---|
cd69f0b894 | |||
323db30bc1 | |||
1125ab934c | |||
0c3b449a2c |
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config: [motortest, motortest_peter, feedcode-front, feedcode-back, greyhash]
|
||||
config: [motortest, motortest_peter, feedcode-front, feedcode-back, greyhash, pcbv2_front, pcbv2_back, pcbv2_test, commander_v2_front, commander_v2_back]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
|
@ -11,7 +11,7 @@ SET(CMAKE_SYSTEM_NAME Generic)
|
||||
set(COMMON_FLAGS "-mcpu=cortex-m3 -mthumb -Wall -fdata-sections -ffunction-sections")
|
||||
set(CMAKE_ASM_FLAGS "${COMMON_FLAGS} -x assembler-with-cpp")
|
||||
set(CMAKE_C_FLAGS "${COMMON_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -Wno-volatile")
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
@ -80,7 +80,6 @@ target_compile_options(motortest.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
# -DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -107,7 +106,6 @@ target_compile_options(motortest_peter.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DFEATURE_INVERT_HALL
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
@ -136,7 +134,6 @@ target_compile_options(feedcode-front.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -163,7 +160,6 @@ target_compile_options(feedcode-back.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -178,6 +174,61 @@ add_custom_command(OUTPUT feedcode-back.bin COMMAND arm-none-eabi-objcopy -O bin
|
||||
add_custom_target(feedcode-back ALL SOURCES feedcode-back.hex feedcode-back.bin)
|
||||
add_custom_target(flash-feedcode-back COMMAND st-flash --reset write feedcode-back.bin 0x8000000 SOURCES feedcode-back.bin DEPENDS feedcode-back.bin)
|
||||
|
||||
|
||||
#
|
||||
# feedc0de 2 front
|
||||
#
|
||||
add_executable(feedcode2-front.elf config.h defines.h main.cpp)
|
||||
target_link_libraries(feedcode2-front.elf stm32_hal emanuel_foc_model bobbycar-protocol)
|
||||
target_compile_options(feedcode2-front.elf PRIVATE
|
||||
# -DMOTOR_TEST
|
||||
-DFEATURE_IGNORE_OTHER_MOTOR
|
||||
-DLEFT_HALL_ABC
|
||||
-DRIGHT_HALL_ABC
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
# -DFEATURE_SERIAL_FEEDBACK
|
||||
# -DLOG_TO_SERIAL
|
||||
-DFEATURE_CAN
|
||||
# -DCAN_LOG_UNKNOWN_ADDR
|
||||
# -DIS_BACK
|
||||
)
|
||||
add_custom_command(OUTPUT feedcode2-front.hex COMMAND arm-none-eabi-objcopy -O ihex feedcode2-front.elf feedcode2-front.hex DEPENDS feedcode2-front.elf)
|
||||
add_custom_command(OUTPUT feedcode2-front.bin COMMAND arm-none-eabi-objcopy -O binary -S feedcode2-front.elf feedcode2-front.bin DEPENDS feedcode2-front.elf)
|
||||
add_custom_target(feedcode2-front ALL SOURCES feedcode2-front.hex feedcode2-front.bin)
|
||||
add_custom_target(flash-feedcode2-front COMMAND st-flash --reset write feedcode2-front.bin 0x8000000 SOURCES feedcode2-front.bin DEPENDS feedcode2-front.bin)
|
||||
|
||||
#
|
||||
# feedc0de 2 back
|
||||
#
|
||||
add_executable(feedcode2-back.elf config.h defines.h main.cpp)
|
||||
target_link_libraries(feedcode2-back.elf stm32_hal emanuel_foc_model bobbycar-protocol)
|
||||
target_compile_options(feedcode2-back.elf PRIVATE
|
||||
# -DMOTOR_TEST
|
||||
-DFEATURE_IGNORE_OTHER_MOTOR
|
||||
-DLEFT_HALL_ACB
|
||||
-DRIGHT_HALL_ACB
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
# -DFEATURE_SERIAL_FEEDBACK
|
||||
# -DLOG_TO_SERIAL
|
||||
-DFEATURE_CAN
|
||||
# -DCAN_LOG_UNKNOWN_ADDR
|
||||
-DIS_BACK
|
||||
)
|
||||
add_custom_command(OUTPUT feedcode2-back.hex COMMAND arm-none-eabi-objcopy -O ihex feedcode2-back.elf feedcode2-back.hex DEPENDS feedcode2-back.elf)
|
||||
add_custom_command(OUTPUT feedcode2-back.bin COMMAND arm-none-eabi-objcopy -O binary -S feedcode2-back.elf feedcode2-back.bin DEPENDS feedcode2-back.elf)
|
||||
add_custom_target(feedcode2-back ALL SOURCES feedcode2-back.hex feedcode2-back.bin)
|
||||
add_custom_target(flash-feedcode2-back COMMAND st-flash --reset write feedcode2-back.bin 0x8000000 SOURCES feedcode2-back.bin DEPENDS feedcode2-back.bin)
|
||||
|
||||
#
|
||||
# greyhash
|
||||
#
|
||||
@ -190,7 +241,6 @@ target_compile_options(greyhash.elf PRIVATE
|
||||
-DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
-DHUART3
|
||||
-DFEATURE_SERIAL_CONTROL
|
||||
@ -217,7 +267,6 @@ target_compile_options(pcbv2_front.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -245,7 +294,6 @@ target_compile_options(pcbv2_back.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -273,7 +321,6 @@ target_compile_options(pcbv2_test.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
# -DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -324,7 +371,6 @@ target_compile_options(commander_v2_front.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
-DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
@ -375,7 +421,6 @@ target_compile_options(commander_v2_back.elf PRIVATE
|
||||
# -DPWM_FREQ_12KHZ
|
||||
# -DFEATURE_BUTTON
|
||||
-DPETERS_PLATINE
|
||||
-DSHUNT_4_MILLIOHM
|
||||
# -DHUART2
|
||||
# -DHUART3
|
||||
# -DFEATURE_SERIAL_CONTROL
|
||||
|
20
main.cpp
20
main.cpp
@ -464,15 +464,15 @@ void updateMotors()
|
||||
static int16_t offsetdcl{2000};
|
||||
static int16_t offsetdcr{2000};
|
||||
|
||||
if (offsetcount < 20000) // calibrate ADC offsets
|
||||
if (offsetcount < 2000) // calibrate ADC offsets
|
||||
{
|
||||
offsetcount++;
|
||||
offsetrl1 = (adc_buffer.rl1 + offsetrl1 * 9) / 10;
|
||||
offsetrl2 = (adc_buffer.rl2 + offsetrl2 * 9) / 10;
|
||||
offsetrr1 = (adc_buffer.rr1 + offsetrr1 * 9) / 10;
|
||||
offsetrr2 = (adc_buffer.rr2 + offsetrr2 * 9) / 10;
|
||||
offsetdcl = (adc_buffer.dcl + offsetdcl * 9) / 10;
|
||||
offsetdcr = (adc_buffer.dcr + offsetdcr * 9) / 10;
|
||||
offsetrl1 = (adc_buffer.rl1 + offsetrl1) / 2;
|
||||
offsetrl2 = (adc_buffer.rl2 + offsetrl2) / 2;
|
||||
offsetrr1 = (adc_buffer.rr1 + offsetrr1) / 2;
|
||||
offsetrr2 = (adc_buffer.rr2 + offsetrr2) / 2;
|
||||
offsetdcl = (adc_buffer.dcl + offsetdcl) / 2;
|
||||
offsetdcr = (adc_buffer.dcr + offsetdcr) / 2;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -496,12 +496,6 @@ void updateMotors()
|
||||
#endif
|
||||
int16_t curR_DC = (int16_t)(offsetdcr - adc_buffer.dcr);
|
||||
|
||||
|
||||
#ifdef SHUNT_4_MILLIOHM
|
||||
curL_DC *= 2.276;
|
||||
curR_DC *= 2.276;
|
||||
#endif
|
||||
|
||||
const bool chopL = std::abs(curL_DC) > (left.iDcMax.load() * AMPERE2BIT_CONV);
|
||||
if (chopL)
|
||||
left.chops++;
|
||||
|
Reference in New Issue
Block a user