ETB compensates for battery voltage (#4838)
* compensate battery voltage * changelog Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
53828adaa3
commit
872595f302
|
@ -28,6 +28,9 @@ Release template (copy/paste this for new release):
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
- Electronic throttle supply voltage compensation, giving more consistent behavior as battery voltage changes #4838
|
||||
|
||||
## December 2022 Release - "Day 289"
|
||||
|
||||
### Breaking Changes
|
||||
|
|
|
@ -53,6 +53,11 @@ bool TwoPinDcMotor::set(float duty)
|
|||
{
|
||||
m_value = duty;
|
||||
|
||||
// For low voltage, voltageRatio will be >1 to boost duty so that motor current stays the same
|
||||
// At high voltage, the inverse will be true to keep behavior always the same.
|
||||
float voltageRatio = 14 / Sensor::get(SensorType::BatteryVoltage).value_or(14);
|
||||
duty *= voltageRatio;
|
||||
|
||||
// If not init, don't try to set
|
||||
if (!m_dir1 || !m_dir2 || !m_enable) {
|
||||
if (m_disable) {
|
||||
|
|
Loading…
Reference in New Issue