diff --git a/Translations/make_translation.py b/Translations/make_translation.py index 217f1da2..e6be313a 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -147,7 +147,8 @@ def get_power_source_list() -> List[str]: return [ "DC", "QC", - "PD", + "PD W. VBus", + "PD No VBus", ] diff --git a/source/Core/Drivers/USBPD.cpp b/source/Core/Drivers/USBPD.cpp index c2d7abef..d1093dde 100644 --- a/source/Core/Drivers/USBPD.cpp +++ b/source/Core/Drivers/USBPD.cpp @@ -67,6 +67,8 @@ bool USBPowerDelivery::fusbPresent() { return detectionState == 1; } +bool USBPowerDelivery::isVBUSConnected() { return fusb.isVBUSConnected(); } + bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *request) { /* Get the number of PDOs */ diff --git a/source/Core/Drivers/USBPD.h b/source/Core/Drivers/USBPD.h index bd41297b..7e27dbea 100644 --- a/source/Core/Drivers/USBPD.h +++ b/source/Core/Drivers/USBPD.h @@ -16,9 +16,9 @@ public: static void PPSTimerCallback(); // PPS Timer static void IRQOccured(); // Thread callback that an irq occured static void step(); // Iterate the step machine - static bool negotiationHasWorked(); // - static uint8_t getStateNumber(); // - + static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract) + static uint8_t getStateNumber(); // Debugging - Get the internal state number + static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302 private: // static int detectionState; diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index bb6ca51f..c87aa443 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -733,18 +733,23 @@ void showDebugMenu(void) { sourceNumber = 0; } else { // We are not powered via DC, so want to display the appropriate state for PD or QC - bool poweredbyPD = false; + bool poweredbyPD = false; + bool pdHasVBUSConnected = true; #if POW_PD if (USBPowerDelivery::fusbPresent()) { // We are PD capable if (USBPowerDelivery::negotiationComplete()) { // We are powered via PD - poweredbyPD = true; + poweredbyPD = true; + pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected(); } } #endif if (poweredbyPD) { sourceNumber = 2; + if (!pdHasVBUSConnected) { + sourceNumber = 3; + } } else { sourceNumber = 1; }