From 88cc151a1bced2c570fed45014b9f3222a5cd166 Mon Sep 17 00:00:00 2001 From: 94xhn <87560781+94xhn@users.noreply.github.com> Date: Tue, 14 Jul 2026 02:43:54 +0800 Subject: [PATCH] Fix ATmega32U4 _writeDutyCycle3PWM signature mismatch with hardware_api.h The ATmega32U4-specific _writeDutyCycle3PWM had a stray unused `int pinA` parameter, giving it a 5-parameter signature that mismatches the 4-parameter prototype declared in hardware_api.h (and matched by all other 10 MCU implementations, plus the weak fallback in generic_mcu.cpp and the sole call site in BLDCDriver3PWM.cpp). Because C++ overload resolution treats differing parameter lists as different functions, this made the ATmega32U4-specific override permanently unreachable/dead code - any call to _writeDutyCycle3PWM on this MCU silently resolved to the generic weak fallback instead. The unused pinA parameter is removed so the function matches the declared interface and is restored as the actual override used by BLDCDriver3PWM for ATmega32U4 boards. --- src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp b/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp index 26dad439..349f03f4 100644 --- a/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp +++ b/src/drivers/hardware_specific/atmega/atmega32u4_mcu.cpp @@ -103,7 +103,7 @@ void _writeDutyCycle2PWM(float dc_a, float dc_b, void* params){ // function setting the pwm duty cycle to the hardware // - BLDC motor - 3PWM setting // - hardware speciffic -void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, int pinA, void* params){ +void _writeDutyCycle3PWM(float dc_a, float dc_b, float dc_c, void* params){ // transform duty cycle from [0,1] to [0,255] analogWrite(((GenericDriverParams*)params)->pins[0], 255.0f*dc_a); analogWrite(((GenericDriverParams*)params)->pins[1], 255.0f*dc_b);