mirror of
https://github.com/wagiminator/ATmega-Soldering-Station.git
synced 2025-08-08 13:00:59 +03:00
暂时修复校准后内存溢出的问题
通过校准后自动重启缓解这个问题
This commit is contained in:
@@ -295,7 +295,7 @@ void setup() {
|
|||||||
SetTemp = DefaultTemp;
|
SetTemp = DefaultTemp;
|
||||||
RawTemp = denoiseAnalog(SENSOR_PIN);
|
RawTemp = denoiseAnalog(SENSOR_PIN);
|
||||||
ChipTemp = getChipTemp();
|
ChipTemp = getChipTemp();
|
||||||
calculateTemp();
|
CurrentTemp = calculateTemp(RawTemp);
|
||||||
// turn on heater if iron temperature is well below setpoint
|
// turn on heater if iron temperature is well below setpoint
|
||||||
#if UsePMOS
|
#if UsePMOS
|
||||||
if ((CurrentTemp + 20) < DefaultTemp) analogWrite(CONTROL_PIN, 255);
|
if ((CurrentTemp + 20) < DefaultTemp) analogWrite(CONTROL_PIN, 255);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
|
void(* resetFunc) (void) = 0;
|
||||||
// reads current rotary encoder value
|
// reads current rotary encoder value
|
||||||
int getRotary() {
|
int getRotary() {
|
||||||
return (Count >> ROTARY_TYPE);
|
return (Count >> ROTARY_TYPE);
|
||||||
@@ -110,8 +110,8 @@ ISR (PCINT0_vect) {
|
|||||||
|
|
||||||
//计算实际温度
|
//计算实际温度
|
||||||
// calculates real temperature value according to ADC reading and calibration values
|
// calculates real temperature value according to ADC reading and calibration values
|
||||||
void calculateTemp() {
|
float calculateTemp(float t) {
|
||||||
CurrentTemp = PTemp[0] + RawTemp * PTemp[1] + RawTemp * RawTemp * PTemp[2] + RawTemp * RawTemp * RawTemp * PTemp[3];
|
return PTemp[0] + RawTemp * PTemp[1] + RawTemp * RawTemp * PTemp[2] + RawTemp * RawTemp * RawTemp * PTemp[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -200,7 +200,7 @@ void SENSORCheck() {
|
|||||||
|
|
||||||
|
|
||||||
RawTemp += (temp - RawTemp) * SMOOTHIE; // stabilize ADC temperature reading
|
RawTemp += (temp - RawTemp) * SMOOTHIE; // stabilize ADC temperature reading
|
||||||
calculateTemp();
|
CurrentTemp = calculateTemp(RawTemp);
|
||||||
|
|
||||||
// stabilize displayed temperature when around setpoint
|
// stabilize displayed temperature when around setpoint
|
||||||
if ((ShowTemp != Setpoint) || (abs(ShowTemp - CurrentTemp) > 5)) ShowTemp = CurrentTemp;
|
if ((ShowTemp != Setpoint) || (abs(ShowTemp - CurrentTemp) > 5)) ShowTemp = CurrentTemp;
|
||||||
|
@@ -259,7 +259,7 @@ void TipScreen() {
|
|||||||
default: repeat = false; break;
|
default: repeat = false; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ViewEEPRom();
|
ViewEEPRom();
|
||||||
}
|
}
|
||||||
|
|
||||||
//温控设置菜单
|
//温控设置菜单
|
||||||
@@ -569,7 +569,6 @@ void CalibrationScreen() {
|
|||||||
for (int i = 0; i < 8; i++) if (xx[i] + 5 >= xx[i + 1]) pass = false;
|
for (int i = 0; i < 8; i++) if (xx[i] + 5 >= xx[i + 1]) pass = false;
|
||||||
if (pass) {
|
if (pass) {
|
||||||
MenuLevel = 7;
|
MenuLevel = 7;
|
||||||
free(&pass);
|
|
||||||
polyfit(9, xx, CalTemp, 3, P); //拟合程序
|
polyfit(9, xx, CalTemp, 3, P); //拟合程序
|
||||||
free(xx);
|
free(xx);
|
||||||
ShowPTemp(&P[0]);
|
ShowPTemp(&P[0]);
|
||||||
@@ -584,6 +583,11 @@ void CalibrationScreen() {
|
|||||||
arduboy.display();
|
arduboy.display();
|
||||||
delay(5000);
|
delay(5000);
|
||||||
}
|
}
|
||||||
|
arduboy.clear();
|
||||||
|
arduboy.print(F("Reboot..."));
|
||||||
|
arduboy.display();
|
||||||
|
delay(500);
|
||||||
|
resetFunc();
|
||||||
}
|
}
|
||||||
//显示默认烙铁头温度曲线系数
|
//显示默认烙铁头温度曲线系数
|
||||||
void ShowPTemp(float *p) {
|
void ShowPTemp(float *p) {
|
||||||
@@ -598,9 +602,18 @@ void ShowPTemp(float *p) {
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
arduboy.display();
|
arduboy.display();
|
||||||
|
|
||||||
lastbutton = (!digitalRead(BUTTON_PIN));
|
lastbutton = (!digitalRead(BUTTON_PIN));
|
||||||
while (digitalRead(BUTTON_PIN) || lastbutton) CheckLastButton();
|
while (digitalRead(BUTTON_PIN) || lastbutton) CheckLastButton();
|
||||||
|
/*
|
||||||
|
lastbutton = (!digitalRead(BUTTON_PIN));
|
||||||
|
setRotary(50, 450, 1, 0);
|
||||||
|
do {
|
||||||
|
arduboy.clear();
|
||||||
|
for (int y = 0; y < 64; y++) arduboy.drawPixel(map(calculateTemp(map(y, 0, 63, 0, 400)), CalTemp[0], CalTemp[8], 0, 127), y,1);
|
||||||
|
arduboy.display();
|
||||||
|
CheckLastButton();
|
||||||
|
} while (digitalRead(BUTTON_PIN) || lastbutton);*/
|
||||||
}
|
}
|
||||||
//命名界面 文本输入界面
|
//命名界面 文本输入界面
|
||||||
// input tip name screen
|
// input tip name screen
|
||||||
@@ -630,13 +643,14 @@ void InputNameScreen() {
|
|||||||
arduboy.display();
|
arduboy.display();
|
||||||
} while (digitalRead(BUTTON_PIN) || lastbutton);
|
} while (digitalRead(BUTTON_PIN) || lastbutton);
|
||||||
TipName[digit] = value;
|
TipName[digit] = value;
|
||||||
|
UpdateEEPROM();
|
||||||
beep(); delay (10);
|
beep(); delay (10);
|
||||||
}
|
}
|
||||||
TipName[TIPNAMELENGTH - 1] = 0;
|
TipName[TIPNAMELENGTH - 1] = 0;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除烙铁头
|
||||||
// delete tip screen
|
// delete tip screen
|
||||||
void DeleteTipScreen() {
|
void DeleteTipScreen() {
|
||||||
MenuLevel = 7;
|
MenuLevel = 7;
|
||||||
|
Reference in New Issue
Block a user