Fixed issue of when using Half sine the next step would start at the MAX of the sign (middle) rather then where it ends

This commit is contained in:
-help 2024-01-28 10:12:55 +02:00
parent 70b62eb787
commit 5d64932082
3 changed files with 29 additions and 8 deletions

View File

@ -390,6 +390,13 @@ void TFT_Display::drawReflowTargetTempLine()
Serial.println(String(endTime));
Serial.println(" ");
if(profile->steps[i].flagged) {
// tft.drawCircle(startX, startY, 5, ST77XX_RED);
startTemp = profile->steps[i-2].targetTempAtEnd;
}
// Draw the line pixel by pixel
switch (profile->steps[i].easeFunction)
{

View File

@ -63,8 +63,8 @@ ReflowProfile reflowProfiles[] = {
ReflowProfile(new ReflowStep[5]{
ReflowStep(ReflowProcessState::PREHEAT, 20, 100, EASE_OUT),
ReflowStep(ReflowProcessState::SOAK, 20, 155,EASE_IN_OUT),
ReflowStep(ReflowProcessState::REFLOW, 20, 185, EASE_IN),
ReflowStep(ReflowProcessState::COOL, 20, 95, EASE_OUT),
ReflowStep(ReflowProcessState::REFLOW, 20, 185, HALF_SINE),
ReflowStep(ReflowProcessState::COOL, 20, 95, EASE_IN),
ReflowStep(ReflowProcessState::DONE, 0, 0)},
"138c Sn42Bi58\0"),

View File

@ -81,17 +81,19 @@ public:
{
bool flag = false;
uint8_t sinePosition = 0;
uint8_t flagPosistion = 0;
for (int i = 0; i < 5; i++)
{
//TODO: Important we need to flag the step after half sine because its starting temp is the PEAK of the sine wave and the sine wave ends at the start of the sine wave
//this creates a problem because the next step will start at the peak of the sine wave and not the end of the sine wave
//We can fix this by flagging the effect step and then when we are calculating the target temp we can check if the step is flagged and if it is we can use the target temp of the step prevous to the sine wave
// TODO: Important we need to flag the step after half sine because its starting temp is the PEAK of the sine wave and the sine wave ends at the start of the sine wave
// this creates a problem because the next step will start at the peak of the sine wave and not the end of the sine wave
// We can fix this by flagging the effect step and then when we are calculating the target temp we can check if the step is flagged and if it is we can use the target temp of the step prevous to the sine wave
if (steps[i].easeFunction == HALF_SINE && i != 3 && i != 0)
{
this->steps[i + 1].flagged = true;
this->steps[i] = steps[i];
flag = true;
flagPosistion = i + 1;
}
else
{
@ -99,6 +101,11 @@ public:
}
}
if (flag)
{
this->steps[flagPosistion].flagged = true;
}
for (int i = 0; i < 20; i++)
{
this->name[i] = name[i];
@ -206,8 +213,15 @@ public:
float percentage = relativeElapsedTime / duration;
// Serial.println(String(percentage)+ "%" + String(STATE_STR(curStep.state)) + " Elapsed: " + String(elapsedMS) + " ___ " + String(curStep.duration * 1000));
if (curStep.flagged)
{
startTemp = steps[STEPINDEX(curStep) - 2].targetTempAtEnd;
return curStep.calcTempAtPercentage(startTemp, percentage);
}
else
{
return curStep.calcTempAtPercentage(startTemp, percentage);
}
}
/**