mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Added VPDO option for disabling PPS/EPR PDOs.
This commit is contained in:
@@ -152,7 +152,7 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS))) {
|
||||
} else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS)) && getSettingValue(SettingsOptions::PDVpdoEnabled)) {
|
||||
// If this is a PPS slot, calculate the max voltage in the PPS range that can we be used and maintain
|
||||
uint16_t max_voltage = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(lastCapabilities[i]));
|
||||
// uint16_t min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCapabilities[i]));
|
||||
@@ -179,7 +179,7 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
||||
}
|
||||
}
|
||||
#ifdef POW_EPR
|
||||
else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_AVS))) {
|
||||
else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_AVS)) && getSettingValue(SettingsOptions::PDVpdoEnabled)) {
|
||||
uint16_t max_voltage = PD_PAV2MV(PD_APDO_AVS_MAX_VOLTAGE_GET(lastCapabilities[i]));
|
||||
uint8_t max_wattage = PD_APDO_AVS_MAX_POWER_GET(lastCapabilities[i]);
|
||||
|
||||
@@ -372,4 +372,4 @@ void pdbs_dpm_get_sink_capability(pd_msg *cap, const bool isPD3) {
|
||||
// cap->hdr = hdr_template | PD_MSGTYPE_SINK_CAPABILITIES | PD_NUMOBJ(numobj);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -52,9 +52,9 @@ enum SettingsOptions {
|
||||
LOGOTime = 35, // Duration the logo will be displayed for
|
||||
CalibrateCJC = 36, // Toggle calibrate CJC at next boot
|
||||
BLEEnabled = 37, // Should BLE hardware be enabled if present
|
||||
|
||||
PDVpdoEnabled = 38, // Should PPS/EPR be enabled
|
||||
//
|
||||
SettingsOptionsLength = 38, //
|
||||
SettingsOptionsLength = 39, //
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -86,6 +86,7 @@ enum class SettingsItemIndex : uint8_t {
|
||||
SettingsReset,
|
||||
LanguageSwitch,
|
||||
BLEEnabled,
|
||||
PDVpdoEnabled,
|
||||
NUM_ITEMS,
|
||||
};
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
|
||||
{0, 5, 1, 1}, // LOGOTime
|
||||
{0, 1, 1, 0}, // CalibrateCJC
|
||||
{0, 1, 1, 1}, // BLEEnabled
|
||||
|
||||
{0, 1, 1, 1}, // PDVpdoEnabled
|
||||
};
|
||||
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ static void displayQCInputV(void);
|
||||
#endif
|
||||
#if POW_PD
|
||||
static void displayPDNegTimeout(void);
|
||||
static void displayPDVpdoEnabled(void);
|
||||
#endif
|
||||
static void displaySensitivity(void);
|
||||
static void displayShutdownTime(void);
|
||||
@@ -179,6 +180,7 @@ const menuitem powerMenu[] = {
|
||||
#endif
|
||||
#if POW_PD
|
||||
{SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout, SettingsItemIndex::PDNegTimeout, 5}, /*PD timeout setup*/
|
||||
{SETTINGS_DESC(SettingsItemIndex::PDVpdoEnabled), nullptr, displayPDVpdoEnabled, nullptr, SettingsOptions::PDVpdoEnabled, SettingsItemIndex::PDVpdoEnabled, 7 }, /*Toggle whether to use PPS/EPR*/
|
||||
#endif
|
||||
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
|
||||
};
|
||||
@@ -376,6 +378,7 @@ static void displayPDNegTimeout(void) {
|
||||
OLED::printNumber(value, 3, FontStyle::LARGE);
|
||||
}
|
||||
}
|
||||
static void displayPDVpdoEnabled(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::PDVpdoEnabled)); }
|
||||
#endif
|
||||
|
||||
static bool setBoostTemp(void) {
|
||||
|
||||
Reference in New Issue
Block a user