Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Espfc/src/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class Model
// for synced and standard PWM limit loop rate and pwm pulse width
if(config.output.protocol == ESC_PROTOCOL_PWM && state.loopRate > 500)
{
config.loopSync = std::max(config.loopSync, (int8_t)((state.loopRate + 499) / 500)); // align loop rate to lower than 500Hz
config.loopSync = std::max(config.loopSync, (int8_t)((state.gyro.rate + 499) / 500)); // align loop rate to lower than 500Hz
state.loopRate = state.gyro.rate / config.loopSync;
if(state.loopRate > 480 && config.output.maxThrottle > 1940)
{
Expand All @@ -373,7 +373,7 @@ class Model
// for onshot125 limit loop rate to 2kHz
if(config.output.protocol == ESC_PROTOCOL_ONESHOT125 && state.loopRate > 2000)
{
config.loopSync = std::max(config.loopSync, (int8_t)((state.loopRate + 1999) / 2000)); // align loop rate to lower than 2000Hz
config.loopSync = std::max(config.loopSync, (int8_t)((state.gyro.rate + 1999) / 2000)); // align loop rate to lower than 2000Hz
state.loopRate = state.gyro.rate / config.loopSync;
}
}
Expand Down