Fix: Ts80 Divisor links
This commit is contained in:
@@ -18,6 +18,7 @@ enum Orientation {
|
|||||||
ORIENTATION_RIGHT_HAND = 1,
|
ORIENTATION_RIGHT_HAND = 1,
|
||||||
ORIENTATION_FLAT = 3
|
ORIENTATION_FLAT = 3
|
||||||
};
|
};
|
||||||
|
#define MODEL_TS80
|
||||||
#ifndef MODEL_TS100
|
#ifndef MODEL_TS100
|
||||||
#ifndef MODEL_TS80
|
#ifndef MODEL_TS80
|
||||||
#error "Please Define the model you are building for! MODEL=TS100 or MODEL=TS80"
|
#error "Please Define the model you are building for! MODEL=TS100 or MODEL=TS80"
|
||||||
@@ -124,12 +125,12 @@ uint16_t ctoTipMeasurement(uint16_t temp);
|
|||||||
uint16_t tipMeasurementToC(uint16_t raw);
|
uint16_t tipMeasurementToC(uint16_t raw);
|
||||||
uint16_t ftoTipMeasurement(uint16_t temp);
|
uint16_t ftoTipMeasurement(uint16_t temp);
|
||||||
uint16_t tipMeasurementToF(uint16_t raw);
|
uint16_t tipMeasurementToF(uint16_t raw);
|
||||||
void seekQC(int16_t Vx10);
|
void seekQC(int16_t Vx10,uint16_t divisor);
|
||||||
void setCalibrationOffset(int16_t offSet);
|
void setCalibrationOffset(int16_t offSet);
|
||||||
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
||||||
uint32_t calculateTipR(uint8_t useFilter);
|
uint32_t calculateTipR(uint8_t useFilter);
|
||||||
int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP);
|
int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP);
|
||||||
void startQC(); // Tries to negotiate QC for highest voltage, must be run after
|
void startQC(uint16_t divisor); // Tries to negotiate QC for highest voltage, must be run after
|
||||||
// RToS
|
// RToS
|
||||||
// This will try for 12V, failing that 9V, failing that 5V
|
// This will try for 12V, failing that 9V, failing that 5V
|
||||||
// If input is over 12V returns -1
|
// If input is over 12V returns -1
|
||||||
|
|||||||
@@ -169,19 +169,21 @@ uint16_t getInputVoltageX10(uint16_t divisor) {
|
|||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
uint8_t QCMode = 0;
|
uint8_t QCMode = 0;
|
||||||
uint8_t QCTries = 0;
|
uint8_t QCTries = 0;
|
||||||
void seekQC(int16_t Vx10) {
|
void seekQC(int16_t Vx10,uint16_t divisor) {
|
||||||
if (QCMode == 5)
|
if (QCMode == 5)
|
||||||
startQC();
|
startQC(divisor);
|
||||||
if (QCMode == 0)
|
if (QCMode == 0)
|
||||||
return; // NOT connected to a QC Charger
|
return; // NOT connected to a QC Charger
|
||||||
|
|
||||||
if (Vx10 < 50)
|
if (Vx10 < 50)
|
||||||
return;
|
return;
|
||||||
|
if(Vx10>130)
|
||||||
|
Vx10=130;//Cap max value at 13V
|
||||||
// Seek the QC to the Voltage given if this adapter supports continuous mode
|
// Seek the QC to the Voltage given if this adapter supports continuous mode
|
||||||
// try and step towards the wanted value
|
// try and step towards the wanted value
|
||||||
|
|
||||||
// 1. Measure current voltage
|
// 1. Measure current voltage
|
||||||
int16_t vStart = getInputVoltageX10(780);
|
int16_t vStart = getInputVoltageX10(divisor);
|
||||||
int difference = Vx10 - vStart;
|
int difference = Vx10 - vStart;
|
||||||
|
|
||||||
// 2. calculate ideal steps (0.2V changes)
|
// 2. calculate ideal steps (0.2V changes)
|
||||||
@@ -243,10 +245,10 @@ void seekQC(int16_t Vx10) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Must be called after FreeRToS Starts
|
// Must be called after FreeRToS Starts
|
||||||
void startQC() {
|
void startQC(uint16_t divisor) {
|
||||||
// Pre check that the input could be >5V already, and if so, dont both
|
// Pre check that the input could be >5V already, and if so, dont both
|
||||||
// negotiating as someone is feeding in hv
|
// negotiating as someone is feeding in hv
|
||||||
uint16_t vin = getInputVoltageX10(780);
|
uint16_t vin = getInputVoltageX10(divisor);
|
||||||
if (vin > 150)
|
if (vin > 150)
|
||||||
return; // Over voltage
|
return; // Over voltage
|
||||||
if (vin > 100) {
|
if (vin > 100) {
|
||||||
@@ -308,7 +310,7 @@ void startQC() {
|
|||||||
// Wait for frontend ADC to stabilise
|
// Wait for frontend ADC to stabilise
|
||||||
QCMode = 4;
|
QCMode = 4;
|
||||||
for (uint8_t i = 0; i < 10; i++) {
|
for (uint8_t i = 0; i < 10; i++) {
|
||||||
if (getInputVoltageX10(195) > 80) {
|
if (getInputVoltageX10(divisor) > 80) {
|
||||||
// yay we have at least QC2.0 or QC3.0
|
// yay we have at least QC2.0 or QC3.0
|
||||||
QCMode = 3; // We have at least QC2, pray for 3
|
QCMode = 3; // We have at least QC2, pray for 3
|
||||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);
|
||||||
|
|||||||
@@ -787,7 +787,7 @@ void startGUITask(void const *argument __unused) {
|
|||||||
if (idealQCVoltage < 90)
|
if (idealQCVoltage < 90)
|
||||||
idealQCVoltage = calculateMaxVoltage(1,
|
idealQCVoltage = calculateMaxVoltage(1,
|
||||||
systemSettings.cutoutSetting); // 1 means use filtered values rather than do its own
|
systemSettings.cutoutSetting); // 1 means use filtered values rather than do its own
|
||||||
seekQC(idealQCVoltage);
|
seekQC(idealQCVoltage,systemSettings.voltageDiv);
|
||||||
#endif
|
#endif
|
||||||
gui_solderingMode(0); // enter soldering mode
|
gui_solderingMode(0); // enter soldering mode
|
||||||
buttonLockout = true;
|
buttonLockout = true;
|
||||||
@@ -1011,11 +1011,11 @@ void startMOVTask(void const *argument __unused) {
|
|||||||
OLED::setRotation(false);
|
OLED::setRotation(false);
|
||||||
|
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
startQC();
|
startQC(systemSettings.voltageDiv);
|
||||||
while (idealQCVoltage == 0)
|
while (idealQCVoltage == 0)
|
||||||
osDelay(20); // To ensure we return after idealQCVoltage is setup
|
osDelay(20); // To ensure we return after idealQCVoltage is setup
|
||||||
|
|
||||||
seekQC(idealQCVoltage); // this will move the QC output to the preferred voltage to start with
|
seekQC(idealQCVoltage,systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with
|
||||||
|
|
||||||
#else
|
#else
|
||||||
osDelay(250); // wait for accelerometer to stabilize
|
osDelay(250); // wait for accelerometer to stabilize
|
||||||
@@ -1102,7 +1102,7 @@ void startMOVTask(void const *argument __unused) {
|
|||||||
osDelay(100); // Slow down update rate
|
osDelay(100); // Slow down update rate
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
if (currentlyActiveTemperatureTarget) {
|
if (currentlyActiveTemperatureTarget) {
|
||||||
seekQC(idealQCVoltage); // Run the QC seek again to try and compensate for cable V drop
|
seekQC(idealQCVoltage,systemSettings.voltageDiv); // Run the QC seek again to try and compensate for cable V drop
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user