Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Extend servo range #377

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion flight_computer/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ check_src_filters =
build_unflags=-fno-rtti

build_flags =
-D FIRMWARE_VERSION='"3.0.2"'
-D FIRMWARE_VERSION='"3.0.2-pre"'
-D ARM_MATH_CM4
-D ARM_MATH_MATRIX_CHECK
-D ARM_MATH_ROUNDING
Expand Down
6 changes: 3 additions & 3 deletions flight_computer/src/drivers/servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ void Servo::SetPosition(uint16_t ticks) {
// Get the output depth
const auto depth = static_cast<float32_t>(m_pwm_channel.GetPwmDepth());

// Servos operate between 4% and 11% duty cycle -> 7% usage of the pwm depth
const float32_t single_tick = (depth * 0.07F) / 1000.0F;
const auto output = static_cast<uint32_t>(single_tick * static_cast<float32_t>(ticks) + 0.04F * depth);
// Servos operate between 2.5% and 12.5% duty cycle -> 10% usage of the pwm depth
const float32_t single_tick = (depth * 0.1F) / 1000.0F;
const auto output = static_cast<uint32_t>(single_tick * static_cast<float32_t>(ticks) + 0.025F * depth);
m_pwm_channel.SetDutyCycleTicks(output);
}

Expand Down
Loading