From 445069c92bd62ca9030c5be2cc61e2742c8ee7d9 Mon Sep 17 00:00:00 2001 From: Samuelrmlink <125516872+Samuelrmlink@users.noreply.github.com> Date: Sat, 1 Apr 2023 08:14:45 -0500 Subject: [PATCH] USBPDDebug: Check whether VPDO is EPR or PPS (#1600) * USBPDDebug: Check whether VPDO is EPR or PPS. * USBPDDebug - Allow trailing zeros after a decimal point. --------- Co-authored-by: discip <53649486+discip@users.noreply.github.com> --- source/Core/Threads/OperatingModes/USBPDDebug.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/Core/Threads/OperatingModes/USBPDDebug.cpp b/source/Core/Threads/OperatingModes/USBPDDebug.cpp index 2c5d79d7..53ae709d 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 @@ -70,7 +70,7 @@ void showPDDebug(void) { } else { OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res OLED::print(SmallSymbolDot, FontStyle::SMALL); - OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res + OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, false); // print the current in 0.1A res OLED::print(SmallSymbolAmps, FontStyle::SMALL); } } @@ -90,4 +90,4 @@ void showPDDebug(void) { } } #endif -#endif \ No newline at end of file +#endif