Skip to content

Conversation

@pitts-mo
Copy link
Contributor

No description provided.

@pitts-mo
Copy link
Contributor Author

I have verified this allows 3.x.x to now ARM am32 PWM from an ER4 as well as ARM PWM and DHSOT from an RP4TD.

@pitts-mo
Copy link
Contributor Author

I have already made the same changes on master. Should I submit that separately?

@pitts-mo
Copy link
Contributor Author

I currently prefer init PWM/DSHOT pin state LOW. However, is it desirable to remove setting of HIGH or LOW and really leave it floating?

@pitts-mo
Copy link
Contributor Author

My testing suggests that init PWM/DSHOT pins LOW is desirable.
-init DSHOT pin float can cause AM32 to arm DSHOT twice.
-no behavior difference when init PWM pin to float or LOW for use with AM32 or servos.

@pitts-mo
Copy link
Contributor Author

Resolves am32-firmware/AM32#253 introduced by #3300

@pkendall64
Copy link
Collaborator

If we're going to output LOW on startup/initialisation then there is no point in making the pinMode OPEN_DRAIN.
We may as well just set the pinMode to OUTPUT in initialize and set the output to LOW and remove all the code from start.

Comment on lines 211 to 216
// prep PWM Pins
for (int ch = 0; ch < GPIO_PIN_PWM_OUTPUTS_COUNT; ++ch)
{
const rx_config_pwm_t *chConfig = config.GetPwmChannel(ch);
const auto frequency = servoOutputModeToFrequency((eServoOutputMode)chConfig->val.mode);
if (frequency && servoPins[ch] != UNDEF_PIN)
{
pinMode(servoPins[ch], OUTPUT_OPEN_DRAIN);
digitalWrite(servoPins[ch], HIGH);
}
#if defined(PLATFORM_ESP32)
else if ((eServoOutputMode)chConfig->val.mode == somDShot)
{
pinMode(servoPins[ch], OUTPUT_OPEN_DRAIN);
digitalWrite(servoPins[ch], HIGH);
}
#endif
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this would go, leaving just the return.

@pitts-mo
Copy link
Contributor Author

07b1627 Still tests as expected with PWM on ER3C-i, ER4, and RP4TD and DSHOT on RP4TD.

Thank you @pkendall64

@pitts-mo
Copy link
Contributor Author

pitts-mo commented Oct 8, 2025

Please consider for review.

I have been using PWM on three esp8285 RX and PWM/DSHOT on an esp32 RX. In testing a handful of different servos and ESCs I have found no additional problem.

Copy link
Member

@CapnBry CapnBry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all the code has been removed from start() then remove it entirely and use nullptr for in the device definition, as return DURATION_NEVER is the default behavior.

Copy link
Member

@CapnBry CapnBry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pkendall64 pkendall64 merged commit 54b874d into ExpressLRS:3.x.x-maintenance Oct 14, 2025
@pitts-mo
Copy link
Contributor Author

@pkendall64 and @CapnBry
I only had the idea of starting the pin low, you both did the harder work of assessing and informing me how this should be simplified.
Thank you, -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants