diff --git a/source/Core/BSP/MHP30/QC_GPIO.cpp b/source/Core/BSP/MHP30/QC_GPIO.cpp index 8adc603b..8486df03 100644 --- a/source/Core/BSP/MHP30/QC_GPIO.cpp +++ b/source/Core/BSP/MHP30/QC_GPIO.cpp @@ -71,7 +71,6 @@ uint8_t QC_DM_PulledDown() { return HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO #endif void QC_resync() { #ifdef POW_QC - seekQC((systemSettings.QCIdealVoltage) ? 120 : 90, - systemSettings.voltageDiv); // Run the QC seek again if we have drifted too much + seekQC(systemSettings.QCIdealVoltage, systemSettings.voltageDiv); // Run the QC seek again if we have drifted too much #endif } diff --git a/source/Core/BSP/Miniware/QC_GPIO.cpp b/source/Core/BSP/Miniware/QC_GPIO.cpp index 84edd842..d9481c2c 100644 --- a/source/Core/BSP/Miniware/QC_GPIO.cpp +++ b/source/Core/BSP/Miniware/QC_GPIO.cpp @@ -71,7 +71,6 @@ uint8_t QC_DM_PulledDown() { return HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO #endif void QC_resync() { #ifdef POW_QC - seekQC((getSettingValue(SettingsOptions::QCIdealVoltage)) ? 120 : 90, - getSettingValue(SettingsOptions::VoltageDiv)); // Run the QC seek again if we have drifted too much + seekQC(getSettingValue(SettingsOptions::QCIdealVoltage), getSettingValue(SettingsOptions::VoltageDiv)); // Run the QC seek again if we have drifted too much #endif } diff --git a/source/Core/BSP/Pine64/QC_GPIO.cpp b/source/Core/BSP/Pine64/QC_GPIO.cpp index 35789055..11ad5344 100644 --- a/source/Core/BSP/Pine64/QC_GPIO.cpp +++ b/source/Core/BSP/Pine64/QC_GPIO.cpp @@ -46,13 +46,6 @@ uint8_t QC_DM_PulledDown() { return gpio_input_bit_get(USB_DM_LOW_GPIO_Port, USB #endif void QC_resync() { #ifdef POW_QC - uint8_t targetvoltage = 90; - if (getSettingValue(SettingsOptions::QCIdealVoltage) == 1) { - targetvoltage = 120; - } else if (getSettingValue(SettingsOptions::QCIdealVoltage) == 2) { - targetvoltage = 200; - } - - seekQC(targetvoltage, getSettingValue(SettingsOptions::VoltageDiv)); // Run the QC seek again if we have drifted too much + seekQC(getSettingValue(SettingsOptions::QCIdealVoltage), getSettingValue(SettingsOptions::VoltageDiv)); // Run the QC seek again if we have drifted too much #endif } diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index bf4f4ef4..c9ca92e4 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -16,9 +16,9 @@ bool sanitiseSettings(); #ifdef POW_QC_20V -#define QC_SETTINGS_MAX 3 +#define QC_VOLTAGE_MAX 220 #else -#define QC_SETTINGS_MAX 2 +#define QC_VOLTAGE_MAX 140 #endif /* @@ -53,7 +53,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp {0, 16, 1, SLEEP_TIME}, // SleepTime {0, 5, 1, CUT_OUT_SETTING}, // MinDCVoltageCells {24, 38, 1, RECOM_VOL_CELL}, // MinVoltageCells - {0, QC_SETTINGS_MAX, 1, 0}, // QCIdealVoltage + {90, QC_VOLTAGE_MAX, 2, 90}, // QCIdealVoltage {0, 3, 1, ORIENTATION_MODE}, // OrientationMode {0, 10, 1, SENSITIVITY}, // Sensitivity {0, 2, 1, ANIMATION_LOOP}, // AnimationLoop diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index 3b8c9c10..8e1f921e 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -325,24 +325,13 @@ static bool settings_displayInputMinVRange(void) { static bool settings_displayQCInputV(void) { printShortDescription(SettingsItemIndex::QCMaxVoltage, 5); - // 0 = 9V, 1=12V, 2=20V (Fixed Voltages) // These are only used in QC modes - switch (getSettingValue(SettingsOptions::QCIdealVoltage)) { - case 0: - OLED::printNumber(9, 2, FontStyle::LARGE); - OLED::print(SymbolVolts, FontStyle::LARGE); - break; - case 1: - OLED::printNumber(12, 2, FontStyle::LARGE); - OLED::print(SymbolVolts, FontStyle::LARGE); - break; - case 2: - OLED::printNumber(20, 2, FontStyle::LARGE); - OLED::print(SymbolVolts, FontStyle::LARGE); - break; - default: - break; - } + // Allows setting the voltage negotiated for QC + auto voltage = getSettingValue(SettingsOptions::QCIdealVoltage); + OLED::printNumber(voltage / 10, 2, FontStyle::LARGE); + OLED::print(SymbolDot, FontStyle::LARGE); + OLED::printNumber(voltage % 10, 2, FontStyle::LARGE); + OLED::print(SymbolVolts, FontStyle::LARGE); return false; }