From 925800de1a21c3ca7e9ba83fc93ed22ccb8fd2ef Mon Sep 17 00:00:00 2001 From: Samuel Hedrick Date: Mon, 27 Feb 2023 07:03:47 +0000 Subject: [PATCH] USBPDDebug: Check whether VPDO is EPR or PPS. --- source/Core/Threads/OperatingModes/USBPDDebug.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Core/Threads/OperatingModes/USBPDDebug.cpp b/source/Core/Threads/OperatingModes/USBPDDebug.cpp index 2c5d79d78c..21a0584445 100644 --- a/source/Core/Threads/OperatingModes/USBPDDebug.cpp +++ b/source/Core/Threads/OperatingModes/USBPDDebug.cpp @@ -40,12 +40,12 @@ void showPDDebug(void) { if ((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) { voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(lastCaps[screen - 1])); // voltage in mV units current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(lastCaps[screen - 1]); // current in 10mA units - } else if ((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED) { + } else if (((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED) && ((lastCaps[screen - 1] & PD_APDO_TYPE) == PD_APDO_TYPE_AVS)) { voltage_mv = PD_PAV2MV(PD_APDO_AVS_MAX_VOLTAGE_GET(lastCaps[screen - 1])); min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps[screen - 1])); // Last value is wattage wattage = PD_APDO_AVS_MAX_POWER_GET(lastCaps[screen - 1]); - } else { + } else if (((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED) && ((lastCaps[screen - 1] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS)) { voltage_mv = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(lastCaps[screen - 1])); min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps[screen - 1])); current_a_x100 = PD_PAI2CA(PD_APDO_PPS_CURRENT_GET(lastCaps[screen - 1])); // max current in 10mA units @@ -90,4 +90,4 @@ void showPDDebug(void) { } } #endif -#endif \ No newline at end of file +#endif