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/Miniware/configuration.h b/source/Core/BSP/Miniware/configuration.h index 6f5ab5a4..427569df 100644 --- a/source/Core/BSP/Miniware/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -130,7 +130,7 @@ #define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV #define PID_POWER_LIMIT 70 // Sets the max pwm power limit #define POWER_LIMIT 0 // 0 watts default limit -#define MAX_POWER_LIMIT 65 // +#define MAX_POWER_LIMIT 70 // #define POWER_LIMIT_STEPS 5 // #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // #define TEMP_uV_LOOKUP_HAKKO // @@ -154,7 +154,7 @@ #define PID_POWER_LIMIT 24 // Sets the max pwm power limit #define CALIBRATION_OFFSET 900 // the adc offset in uV #define POWER_LIMIT 24 // 24 watts default power limit -#define MAX_POWER_LIMIT 30 // +#define MAX_POWER_LIMIT 40 // #define POWER_LIMIT_STEPS 2 // #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // #define TEMP_uV_LOOKUP_TS80 // @@ -179,7 +179,7 @@ #define PID_POWER_LIMIT 35 // Sets the max pwm power limit #define CALIBRATION_OFFSET 1500 // the adc offset in uV #define POWER_LIMIT 30 // 30 watts default power limit -#define MAX_POWER_LIMIT 35 // +#define MAX_POWER_LIMIT 40 // #define POWER_LIMIT_STEPS 2 // #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // #define TEMP_uV_LOOKUP_TS80 // 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/BSP/Pine64/configuration.h b/source/Core/BSP/Pine64/configuration.h index 9d8c7f75..ad19637e 100644 --- a/source/Core/BSP/Pine64/configuration.h +++ b/source/Core/BSP/Pine64/configuration.h @@ -119,9 +119,9 @@ #define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV #define PID_POWER_LIMIT 70 // Sets the max pwm power limit #define POWER_LIMIT 0 // 0 watts default limit -#define MAX_POWER_LIMIT 65 // +#define MAX_POWER_LIMIT 70 // #define POWER_LIMIT_STEPS 5 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses Pinecil resistors +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors #define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table #define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate #define PID_TIM_HZ (8) // Tick rate of the PID loop diff --git a/source/Core/Src/QC3.cpp b/source/Core/Src/QC3.cpp index 311d1b73..e1b7c8c1 100644 --- a/source/Core/Src/QC3.cpp +++ b/source/Core/Src/QC3.cpp @@ -54,18 +54,12 @@ void seekQC(int16_t Vx10, uint16_t divisor) { if (QCMode == QCState::NOT_STARTED) startQC(divisor); - if (Vx10 < 45) + if (Vx10 < 40) // Bail out if less than 4V return; + if (xTaskGetTickCount() < TICKS_SECOND) return; -#ifdef POW_QC_20V - if (Vx10 > 200) - Vx10 = 200; // Cap max value at 20V -#else - if (Vx10 > 130) - Vx10 = 130; // Cap max value at 13V -#endif // Seek the QC to the Voltage given if this adapter supports continuous mode // try and step towards the wanted value @@ -77,8 +71,6 @@ void seekQC(int16_t Vx10, uint16_t divisor) { int steps = difference / 2; if (QCMode == QCState::QC_3) { - if (steps > -2 && steps < 2) - return; // dont bother with small steps while (steps < 0) { QC_SeekContNeg(); vTaskDelay(3 * TICKS_10MS); diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index bf4f4ef4..45146c4c 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 222 #else -#define QC_SETTINGS_MAX 2 +#define QC_VOLTAGE_MAX 142 #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..b1c5e25f 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -324,25 +324,14 @@ static bool settings_displayInputMinVRange(void) { #ifdef POW_QC static bool settings_displayQCInputV(void) { - printShortDescription(SettingsItemIndex::QCMaxVoltage, 5); - // 0 = 9V, 1=12V, 2=20V (Fixed Voltages) + printShortDescription(SettingsItemIndex::QCMaxVoltage, 4); // 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, 1, FontStyle::LARGE); + OLED::print(SymbolVolts, FontStyle::LARGE); return false; }