mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Fix temperature getting bumped off screen
This fixes the temp gettting bumped because I forgot to reset OLED::cursor_y after writing. Fixes #376 (hopefully)
This commit is contained in:
@@ -168,9 +168,13 @@ uint16_t getInputVoltageX10(uint16_t divisor) {
|
|||||||
}
|
}
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
uint8_t QCMode = 0;
|
uint8_t QCMode = 0;
|
||||||
|
uint8_t QCTries = 0;
|
||||||
void seekQC(int16_t Vx10) {
|
void seekQC(int16_t Vx10) {
|
||||||
if (QCMode <= 1)
|
if (QCMode == 5)
|
||||||
|
startQC();
|
||||||
|
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;
|
||||||
// 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
|
||||||
@@ -244,7 +248,7 @@ void startQC() {
|
|||||||
// negotiating as someone is feeding in hv
|
// negotiating as someone is feeding in hv
|
||||||
uint16_t vin = getInputVoltageX10(780);
|
uint16_t vin = getInputVoltageX10(780);
|
||||||
if (vin > 150)
|
if (vin > 150)
|
||||||
return;// Over voltage
|
return; // Over voltage
|
||||||
if (vin > 100) {
|
if (vin > 100) {
|
||||||
QCMode = 1; // ALready at ~12V
|
QCMode = 1; // ALready at ~12V
|
||||||
return;
|
return;
|
||||||
@@ -306,7 +310,7 @@ void startQC() {
|
|||||||
for (uint8_t i = 0; i < 10; i++) {
|
for (uint8_t i = 0; i < 10; i++) {
|
||||||
if (getInputVoltageX10(195) > 80) {
|
if (getInputVoltageX10(195) > 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);
|
||||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
|
||||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, GPIO_PIN_SET);
|
||||||
@@ -314,12 +318,17 @@ void startQC() {
|
|||||||
}
|
}
|
||||||
vTaskDelay(10); // 100mS
|
vTaskDelay(10); // 100mS
|
||||||
}
|
}
|
||||||
|
QCMode = 5;
|
||||||
|
QCTries++;
|
||||||
|
if (QCTries > 10) // 10 goes to get it going
|
||||||
QCMode = 0;
|
QCMode = 0;
|
||||||
// No QC / not working to us
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// no QC
|
// no QC
|
||||||
|
QCMode = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (QCTries > 10)
|
||||||
|
QCMode = 0;
|
||||||
}
|
}
|
||||||
// Get tip resistance in milliohms
|
// Get tip resistance in milliohms
|
||||||
uint32_t calculateTipR(uint8_t useFilter) {
|
uint32_t calculateTipR(uint8_t useFilter) {
|
||||||
@@ -333,7 +342,7 @@ uint32_t calculateTipR(uint8_t useFilter) {
|
|||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);// Set low first
|
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET); // Set low first
|
||||||
setTipPWM(0);
|
setTipPWM(0);
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
uint32_t offReading = getTipInstantTemperature();
|
uint32_t offReading = getTipInstantTemperature();
|
||||||
@@ -347,8 +356,8 @@ uint32_t calculateTipR(uint8_t useFilter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Turn on
|
// Turn on
|
||||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET);// Set low first
|
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET); // Set low first
|
||||||
vTaskDelay(1);// delay to allow it too stabilize
|
vTaskDelay(1); // delay to allow it too stabilize
|
||||||
uint32_t onReading = getTipInstantTemperature();
|
uint32_t onReading = getTipInstantTemperature();
|
||||||
for (uint8_t i = 0; i < 24; i++) {
|
for (uint8_t i = 0; i < 24; i++) {
|
||||||
if (useFilter == 0) {
|
if (useFilter == 0) {
|
||||||
@@ -366,7 +375,7 @@ uint32_t calculateTipR(uint8_t useFilter) {
|
|||||||
// 4688 milliohms (Measured using 4 terminal measurement) 25x oversampling
|
// 4688 milliohms (Measured using 4 terminal measurement) 25x oversampling
|
||||||
// reads this as around 47490 Almost perfectly 10x the milliohms value This
|
// reads this as around 47490 Almost perfectly 10x the milliohms value This
|
||||||
// will drift massively with tip temp However we really only need 10x ohms
|
// will drift massively with tip temp However we really only need 10x ohms
|
||||||
return (difference / 10) + 1;// ceil
|
return (difference / 10) + 1; // ceil
|
||||||
}
|
}
|
||||||
static unsigned int sqrt32(unsigned long n) {
|
static unsigned int sqrt32(unsigned long n) {
|
||||||
unsigned int c = 0x8000;
|
unsigned int c = 0x8000;
|
||||||
@@ -395,9 +404,9 @@ int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP) {
|
|||||||
|
|
||||||
uint32_t Vx = sqrt32(milliOhms);
|
uint32_t Vx = sqrt32(milliOhms);
|
||||||
if (useHP)
|
if (useHP)
|
||||||
Vx *= 1549;//sqrt(24)*sqrt(1/1000)
|
Vx *= 1549; //sqrt(24)*sqrt(1/1000)
|
||||||
else
|
else
|
||||||
Vx *= 1342;// sqrt(18) * sqrt(1/1000)
|
Vx *= 1342; // sqrt(18) * sqrt(1/1000)
|
||||||
|
|
||||||
// Round to nearest 200mV,
|
// Round to nearest 200mV,
|
||||||
// So divide by 100 to start, to get in Vxx
|
// So divide by 100 to start, to get in Vxx
|
||||||
|
|||||||
@@ -282,8 +282,8 @@ static void gui_drawBatteryIcon() {
|
|||||||
OLED::printNumber(1, 1);
|
OLED::printNumber(1, 1);
|
||||||
OLED::setCursor(xPos, 8);
|
OLED::setCursor(xPos, 8);
|
||||||
OLED::printNumber(V % 10, 1);
|
OLED::printNumber(V % 10, 1);
|
||||||
|
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
|
OLED::setCursor(xPos+12,0); // need to reset this as if we drew a wide char
|
||||||
} else {
|
} else {
|
||||||
OLED::printNumber(V, 1);
|
OLED::printNumber(V, 1);
|
||||||
}
|
}
|
||||||
@@ -537,7 +537,6 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||||
OLED::printNumber(getTipPWM(), 3);
|
OLED::printNumber(getTipPWM(), 3);
|
||||||
OLED::print("%");
|
OLED::print("%");
|
||||||
// OLED::printNumber(getTipRawTemp(0), 6);
|
|
||||||
|
|
||||||
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
||||||
OLED::print(" ");
|
OLED::print(" ");
|
||||||
@@ -784,6 +783,7 @@ void startGUITask(void const *argument __unused) {
|
|||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::displayOnOff(true); // turn lcd on
|
OLED::displayOnOff(true); // turn lcd on
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
|
//Here we re-check for tip presence
|
||||||
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
|
||||||
@@ -1008,6 +1008,8 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
}
|
}
|
||||||
#define MOVFilter 8
|
#define MOVFilter 8
|
||||||
void startMOVTask(void const *argument __unused) {
|
void startMOVTask(void const *argument __unused) {
|
||||||
|
OLED::setRotation(false);
|
||||||
|
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
startQC();
|
startQC();
|
||||||
while (idealQCVoltage == 0)
|
while (idealQCVoltage == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user