mirror of
https://github.com/arwidcool/Solder-Plate.git
synced 2024-11-12 01:10:52 +01:00
Refactor drawReflowTargetTempLine() method and update startTemps[0] in reflow.h
This commit is contained in:
parent
74d16003d2
commit
32ec4fa38c
@ -342,13 +342,13 @@ void TFT_Display::drawGraphReflowStagesBackground()
|
||||
|
||||
|
||||
void TFT_Display::drawReflowTargetTempLine() {
|
||||
uint16_t y = tempYonGraph(20);
|
||||
uint16_t y = tempYonGraph(chosenReflowProfile.startTemps[0]);
|
||||
uint16_t x = percentageToX(0);
|
||||
for (float i=0.00; i<=1; i+=0.01) {
|
||||
float temp = profile->getTargetTempFromPercentage(i);
|
||||
uint16_t y2 = tempYonGraph(temp);
|
||||
uint16_t x2 = percentageToX(i);
|
||||
Serial.println(String(i) + " - temp: "+ String(temp) + " - x:" + String(x) + " y:" + String(y) + " x2:" + String(x2) + " y2:" + String(y2));
|
||||
// Serial.println(String(i) + " - temp: "+ String(temp) + " - x:" + String(x) + " y:" + String(y) + " x2:" + String(x2) + " y2:" + String(y2));
|
||||
tft.drawLine(x, y, x2, y2, ST77XX_WHITE);
|
||||
x = x2;
|
||||
y = y2;
|
||||
|
14
src/reflow.h
14
src/reflow.h
@ -119,7 +119,7 @@ public:
|
||||
startTimes[3] = endTimes[2];
|
||||
startTimes[4] = endTimes[3];
|
||||
|
||||
startTemps[0] = 20;
|
||||
startTemps[0] = 20; // USe ambient temp as the starting temp for the first step
|
||||
|
||||
endTemps[0] = steps[0].calcTempAtPercentage(startTemps[0], 1);
|
||||
endTemps[1] = steps[1].calcTempAtPercentage(endTemps[0], 1);
|
||||
@ -163,27 +163,19 @@ public:
|
||||
{
|
||||
if (!timer.isRunning())
|
||||
{
|
||||
return 20;
|
||||
return startTemps[0];
|
||||
}
|
||||
return getTargetTemp(timer.elapsed());
|
||||
}
|
||||
float getTargetTemp(uint32_t elapsedMS)
|
||||
{
|
||||
uint8_t startTemp = 20; // always assume 20 degrees at the start
|
||||
|
||||
ReflowStep curStep = reflowStep(elapsedMS);
|
||||
if (curStep.state > PREHEAT)
|
||||
{
|
||||
startTemp = endTemps[STEPINDEX(curStep) - 1];
|
||||
}
|
||||
|
||||
// startTemp => 20 or the temp at 100% of the previous step
|
||||
|
||||
uint32_t startTimeMS = TOMILLIS(startTimes[STEPINDEX(curStep)]);
|
||||
uint32_t relativeElapsedTime = elapsedMS - startTimeMS;
|
||||
|
||||
float stepPercentage = relativeElapsedTime / (double)TOMILLIS(curStep.duration);
|
||||
return curStep.calcTempAtPercentage(startTemp, stepPercentage);
|
||||
return curStep.calcTempAtPercentage(startTemps[STEPINDEX(curStep)], stepPercentage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user