mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Fix reading of handle compensation to fix offset tip temperatures
This commit is contained in:
@@ -652,22 +652,28 @@ static void setTipOffset() {
|
||||
|
||||
uint32_t offset = 0;
|
||||
for (uint8_t i = 0; i < 15; i++) {
|
||||
offset += getTipRawTemp(1);
|
||||
offset += getTipRawTemp(0);
|
||||
// cycle through the filter a fair bit to ensure we're stable.
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print(".");
|
||||
for (uint8_t x = 0; x < i / 4; x++)
|
||||
OLED::print(".");
|
||||
OLED::refresh();
|
||||
osDelay(333);
|
||||
osDelay(100);
|
||||
}
|
||||
systemSettings.CalibrationOffset = offset / 15;
|
||||
// Need to remove from this the ambient temperature offset
|
||||
uint32_t ambientoffset = getHandleTemperature(); // Handle temp in C
|
||||
ambientoffset *=1000;
|
||||
uint32_t ambientoffset = getHandleTemperature(); // Handle temp in C x10
|
||||
ambientoffset *= 100;
|
||||
ambientoffset /= tipGainCalValue;
|
||||
systemSettings.CalibrationOffset -= ambientoffset;
|
||||
setCalibrationOffset(systemSettings.CalibrationOffset); // store the error
|
||||
osDelay(100);
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print("OK");
|
||||
OLED::refresh();
|
||||
osDelay(1000);
|
||||
}
|
||||
static void calibration_enterSimpleCal(void) {
|
||||
// User has entered into the simple cal routine
|
||||
@@ -816,10 +822,10 @@ static void settings_setCalibrateVIN(void) {
|
||||
|
||||
for (;;) {
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv,0) / 10,
|
||||
OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv, 0) / 10,
|
||||
2);
|
||||
OLED::print(".");
|
||||
OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv,0) % 10,
|
||||
OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv, 0) % 10,
|
||||
1);
|
||||
OLED::print("V");
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ uint16_t getHandleTemperature() {
|
||||
result -= 4965; // remove 0.5V offset
|
||||
// 10mV per C
|
||||
// 99.29 counts per Deg C above 0C
|
||||
result *= 10;
|
||||
result *= 100;
|
||||
result /= 993;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -939,7 +939,7 @@ void startPIDTask(void const *argument __unused) {
|
||||
#ifdef MODEL_TS80
|
||||
//Set power management code to the tip resistance in ohms * 10
|
||||
setupPower(calculateTipR() / 100);
|
||||
size_t lastPowerPulse = 0;
|
||||
//size_t lastPowerPulse = 0;
|
||||
#else
|
||||
setupPower(85);
|
||||
|
||||
@@ -987,7 +987,7 @@ void startPIDTask(void const *argument __unused) {
|
||||
const uint16_t mass = 2020 / 20; // divide here so division is compile-time.
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
const uint16_t mass = 2020 / 50;
|
||||
const uint16_t mass = 2020 / 60;
|
||||
#endif
|
||||
|
||||
int32_t milliWattsNeeded = tempToMilliWatts(tempError.average(),
|
||||
|
||||
Reference in New Issue
Block a user