From 9007f6c0e892c5bebb20692a14e323fd68b37138 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Wed, 3 Jul 2024 03:51:40 +0300 Subject: [PATCH 1/5] Update RU translation for PD mode options (#1940) --- Translations/translation_RU.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 1c408972..b3b35db8 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -107,13 +107,13 @@ }, "menuValues": { "USBPDModeDefault": { - "displayText": "Default\nMode" + "displayText": "Вкл.\nPPSиEPR" }, "USBPDModeNoDynamic": { - "displayText": "No\nDynamic" + "displayText": "Откл.\n" }, "USBPDModeSafe": { - "displayText": "Safe\nMode" + "displayText": "Вкл.без\nсопротив" } }, "menuOptions": { @@ -130,12 +130,12 @@ "description": "Максимальное напряжение для согласования с источником питания по QC" }, "PDNegTimeout": { - "displayText": "PD\nинтервал", + "displayText": "Интервал\nPD", "description": "Интервал согласования питания по Power Delivery с шагом 100 мс для совместимости с некоторыми источниками питания по QC (0=Откл.)" }, "USBPDMode": { - "displayText": "PD\nMode", - "description": "Включить режимы PPS & EPR" + "displayText": "Режим\nPD", + "description": "Вкл.без сопротив: включить PPS и EPR без 'выравнивания' сопротивления" }, "BoostTemperature": { "displayText": "t° турбо\nрежима", From 116afeca6016979ced328b098d2491d98ebb4dc2 Mon Sep 17 00:00:00 2001 From: fredericuslaurentii <157758058+fredericuslaurentii@users.noreply.github.com> Date: Wed, 3 Jul 2024 02:51:56 +0200 Subject: [PATCH 2/5] PD modes IT translation (#1937) Update translation_IT.json --- Translations/translation_IT.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 41be5b11..40f4714c 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -107,13 +107,13 @@ }, "menuValues": { "USBPDModeDefault": { - "displayText": "Default\nMode" + "displayText": "Modo\npredefinito" }, "USBPDModeNoDynamic": { - "displayText": "No\nDynamic" + "displayText": "Modo\nstatico" }, "USBPDModeSafe": { - "displayText": "Safe\nMode" + "displayText": "Modo\nsicuro" } }, "menuOptions": { From b72ff94ecef78a1a030a59a6f6b809f4bf233c8f Mon Sep 17 00:00:00 2001 From: dmitrygribenchuk Date: Sun, 7 Jul 2024 15:56:46 +0300 Subject: [PATCH 3/5] update translation_BE.json (#1942) --- Translations/translation_BE.json | 52 ++++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index c2980732..e9c9e601 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -107,13 +107,13 @@ }, "menuValues": { "USBPDModeDefault": { - "displayText": "Default\nMode" + "displayText": "\nРэжым" }, "USBPDModeNoDynamic": { - "displayText": "No\nDynamic" + "displayText": "Няма\nдынамікі" }, "USBPDModeSafe": { - "displayText": "Safe\nMode" + "displayText": "Бяспечны\nрэжым" } }, "menuOptions": { @@ -134,7 +134,7 @@ "description": "Час чакання ўзгаднення PD з крокам 100 мс для сумяшчальнасці з некаторымі зараднымі зараднымі прыладамі QC (0: адключана)" }, "USBPDMode": { - "displayText": "PD\nMode", + "displayText": "PD\nРэжым", "description": "Уключае рэжымы PPS & EPR." }, "BoostTemperature": { @@ -158,59 +158,59 @@ "description": "Пры рабоце падоўжаны націск дзьвух кнопак блакуе іх (Т=Толькі турба | П=Поўная блакіроўка)" }, "ProfilePhases": { - "displayText": "Profile\nPhases", + "displayText": "Фазы\nпрофілю", "description": "Колькасць фаз у рэжыме профілю" }, "ProfilePreheatTemp": { - "displayText": "Preheat\nTemp", + "displayText": "Тэмпература\nразагравання", "description": "Разагрэйце да гэтай тэмпературы ў пачатку профільнага рэжыму" }, "ProfilePreheatSpeed": { - "displayText": "Preheat\nSpeed", + "displayText": "Хуткасть\nразагравання", "description": "Разагрэйце з гэтай хуткасцю (градусы ў секунду)" }, "ProfilePhase1Temp": { - "displayText": "Phase 1\nTemp", + "displayText": "Фаза 1\nтэмпература", "description": "Мэтавая тэмпература ў канцы гэтай фазы" }, "ProfilePhase1Duration": { - "displayText": "Phase 1\nDuration", + "displayText": "Фаза 1\nпрацягласць", "description": "Мэтавая працягласць гэтай фазы (секунды)" }, "ProfilePhase2Temp": { - "displayText": "Phase 2\nTemp", - "description": "" + "displayText": "Фаза 2\nтэмпература", + "description": "Мэтавая тэмпература ў канцы гэтай фазы" }, "ProfilePhase2Duration": { - "displayText": "Phase 2\nDuration", - "description": "" + "displayText": "Фаза 2\nпрацягласць", + "description": "Мэтавая працягласць гэтай фазы (секунды)" }, "ProfilePhase3Temp": { - "displayText": "Phase 3\nTemp", - "description": "" + "displayText": "Фаза 3\nтэмпература", + "description": "Мэтавая тэмпература ў канцы гэтай фазы" }, "ProfilePhase3Duration": { - "displayText": "Phase 3\nDuration", - "description": "" + "displayText": "Фаза 3\nпрацягласць", + "description": "Мэтавая працягласць гэтай фазы (секунды)" }, "ProfilePhase4Temp": { - "displayText": "Phase 4\nTemp", - "description": "" + "displayText": "Фаза 4\nтэмпература", + "description": "Мэтавая тэмпература ў канцы гэтай фазы" }, "ProfilePhase4Duration": { - "displayText": "Phase 4\nDuration", - "description": "" + "displayText": "Фаза 4\nпрацягласць", + "description": "Мэтавая працягласць гэтай фазы (секунды)" }, "ProfilePhase5Temp": { - "displayText": "Phase 5\nTemp", - "description": "" + "displayText": "Фаза 5\nтэмпература", + "description": "Мэтавая тэмпература ў канцы гэтай фазы" }, "ProfilePhase5Duration": { - "displayText": "Phase 5\nDuration", - "description": "" + "displayText": "Фаза 5\nпрацягласць", + "description": "Мэтавая працягласць гэтай фазы (секунды)" }, "ProfileCooldownSpeed": { - "displayText": "Cooldown\nSpeed", + "displayText": "Хуткасць\nастывання", "description": "Астуджаць з гэтай хуткасцю ў канцы профільнага рэжыму (градусы ў секунду)" }, "MotionSensitivity": { From ac6994a6768e7d3491eadcdd1c5abe3d69db091f Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Mon, 8 Jul 2024 05:06:38 +0300 Subject: [PATCH 4/5] Update BG translation for PD mode options (#1941) * Update BG translation for PD mode options * Update BG and RU translations for PD mode options --- Translations/translation_BG.json | 10 +++++----- Translations/translation_RU.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index 5e4aef4f..6ed233c0 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -107,13 +107,13 @@ }, "menuValues": { "USBPDModeDefault": { - "displayText": "Default\nMode" + "displayText": "Вкл.\nPPSиERP" }, "USBPDModeNoDynamic": { - "displayText": "No\nDynamic" + "displayText": "Изкл.\n" }, "USBPDModeSafe": { - "displayText": "Safe\nMode" + "displayText": "Вкл.без\nискане" } }, "menuOptions": { @@ -134,8 +134,8 @@ "description": "PD интервал за договаряне на захранването на стъпки от 100 мс за съвместимост с някои QC захранвания (0=Изкл.)" }, "USBPDMode": { - "displayText": "PD\nMode", - "description": "Включи PPS & EPR" + "displayText": "PD\nрежим", + "description": "Вкл.без искане: включи PPS и EPR без да искате повече мощност" }, "BoostTemperature": { "displayText": "Турбо\nтемп.", diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index b3b35db8..68254f40 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -113,7 +113,7 @@ "displayText": "Откл.\n" }, "USBPDModeSafe": { - "displayText": "Вкл.без\nсопротив" + "displayText": "Вкл.без\nзапроса" } }, "menuOptions": { @@ -135,7 +135,7 @@ }, "USBPDMode": { "displayText": "Режим\nPD", - "description": "Вкл.без сопротив: включить PPS и EPR без 'выравнивания' сопротивления" + "description": "Вкл.без запроса: включить PPS и EPR без запроса большей мощности" }, "BoostTemperature": { "displayText": "t° турбо\nрежима", From c19e88233844f00dedb283276f3a5502ef05162a Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Tue, 9 Jul 2024 12:20:02 +0300 Subject: [PATCH 5/5] Add enum for USB PD modes (#1943) * Add enum for USB PD modes * Update comments for clarification according to code review --- source/Core/Drivers/FS2711.cpp | 2 +- source/Core/Drivers/USBPD.cpp | 2 +- source/Core/Drivers/Utils.cpp | 4 ++-- source/Core/Inc/Settings.h | 6 ++++++ source/Core/Src/settingsGUI.cpp | 13 +++++++------ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/source/Core/Drivers/FS2711.cpp b/source/Core/Drivers/FS2711.cpp index 1aec92e8..35e90898 100644 --- a/source/Core/Drivers/FS2711.cpp +++ b/source/Core/Drivers/FS2711.cpp @@ -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; } diff --git a/source/Core/Drivers/USBPD.cpp b/source/Core/Drivers/USBPD.cpp index 1f154080..6c21f5ed 100644 --- a/source/Core/Drivers/USBPD.cpp +++ b/source/Core/Drivers/USBPD.cpp @@ -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 diff --git a/source/Core/Drivers/Utils.cpp b/source/Core/Drivers/Utils.cpp index b560fd3a..20f8c46f 100644 --- a/source/Core/Drivers/Utils.cpp +++ b/source/Core/Drivers/Utils.cpp @@ -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; -} \ No newline at end of file +} diff --git a/source/Core/Inc/Settings.h b/source/Core/Inc/Settings.h index e9bddfaf..e84fbd87 100644 --- a/source/Core/Inc/Settings.h +++ b/source/Core/Inc/Settings.h @@ -104,6 +104,12 @@ typedef enum { INFINITY = 6, // Show boot logo on repeat (if animated) until a button toggled } logoMode_t; +typedef enum { + DEFAULT = 1, // PPS + EPR + more power request through increasing resistance by 0.5 Ohm to compensate power loss over cable/PCB/etc. + SAFE = 2, // PPS + EPR, without requesting more power + NO_DYNAMIC = 0, // PPS + EPR disabled, fixed PDO only +} usbpdMode_t; + // Settings wide operations void saveSettings(); bool loadSettings(); diff --git a/source/Core/Src/settingsGUI.cpp b/source/Core/Src/settingsGUI.cpp index b9ded285..180b8547 100644 --- a/source/Core/Src/settingsGUI.cpp +++ b/source/Core/Src/settingsGUI.cpp @@ -531,19 +531,20 @@ static void displayPDNegTimeout(void) { static void displayUSBPDMode(void) { /* - * PD Mode - * 0 = Safe mode, no PPS, no EPR - * 1 = Default mode, tolerant + PPS + EPR - * 2 = Strict mode + PPS + EPR + * Supported PD modes: + * DEFAULT, 1 = PPS + EPR + more power request through increasing resistance by 0.5 Ohm to compensate power loss over cable/PCB/etc. + * SAFE, 2 = PPS + EPR, without requesting more power + * NO_DYNAMIC, 0 = PPS + EPR disabled, fixed PDO only */ switch (getSettingValue(SettingsOptions::USBPDMode)) { - case 1: + case usbpdMode_t::DEFAULT: OLED::print(translatedString(Tr->USBPDModeDefault), FontStyle::SMALL, 255, OLED::getCursorX()); break; - case 2: + case usbpdMode_t::SAFE: OLED::print(translatedString(Tr->USBPDModeSafe), FontStyle::SMALL, 255, OLED::getCursorX()); break; + case usbpdMode_t::NO_DYNAMIC: default: OLED::print(translatedString(Tr->USBPDModeNoDynamic), FontStyle::SMALL, 255, OLED::getCursorX()); break;