Add enum for USB PD modes (#1943)
Some checks failed
Docs / deploy-docs (push) Has been cancelled
CI / build (MHP30) (push) Has been cancelled
CI / build (Pinecil) (push) Has been cancelled
CI / build (Pinecilv2) (push) Has been cancelled
CI / build (S60) (push) Has been cancelled
CI / build (S60P) (push) Has been cancelled
CI / build (TS100) (push) Has been cancelled
CI / build (TS101) (push) Has been cancelled
CI / build (TS80) (push) Has been cancelled
CI / build (TS80P) (push) Has been cancelled
CI / build_multi-lang (Pinecil) (push) Has been cancelled
CI / build_multi-lang (Pinecilv2) (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / check_c-cpp (push) Has been cancelled
CI / check_python (push) Has been cancelled
CI / check_shell (push) Has been cancelled
CI / check_readme (push) Has been cancelled
CI / upload_metadata (push) Has been cancelled

* Add enum for USB PD modes

* Update comments for clarification according to code review
This commit is contained in:
Ivan Zorin
2024-07-09 12:20:02 +03:00
committed by GitHub
parent ac6994a676
commit c19e882338
5 changed files with 17 additions and 10 deletions

View File

@@ -158,7 +158,7 @@ void FS2711::negotiate() {
// FS2711 uses mV instead of V
const uint16_t vmax = USB_PD_VMAX * 1000;
uint8_t tip_resistance = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tip_resistance += 5;
}

View File

@@ -136,7 +136,7 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
// Fudge of 0.5 ohms to round up a little to account for us always having off periods in PWM
uint8_t tipResistance = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tipResistance += 5;
}
#ifdef MODEL_HAS_DCDC

View File

@@ -23,7 +23,7 @@ int32_t Utils::LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
uint16_t Utils::RequiredCurrentForTipAtVoltage(uint16_t voltageX10) {
uint8_t tipResistancex10 = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tipResistancex10 += 5;
}
#ifdef MODEL_HAS_DCDC
@@ -34,4 +34,4 @@ uint16_t Utils::RequiredCurrentForTipAtVoltage(uint16_t voltageX10) {
// V/R = I
uint16_t currentX10 = (voltageX10 * 10) / tipResistancex10;
return currentX10;
}
}