We now how full target drawing with lines and everything

This commit is contained in:
-help 2024-01-28 09:55:05 +02:00
parent c947545b25
commit 70b62eb787
6 changed files with 350 additions and 130 deletions

View File

@ -37,6 +37,8 @@ void TFT_Display::init(ReflowProfile *profile)
getMaxTempFromProfile(profile);
getTotalTimeFromProfile(profile);
this->profile = profile;
drawGraph();
}
@ -121,6 +123,8 @@ TFT_XY TFT_Display::getCenterAlignedBottomTextXY(char *text, uint16_t x, uint16_
void TFT_Display::getMaxTempFromProfile(ReflowProfile *profile)
{
maxTemp = 0;
for (uint8_t i = 0; i < 5; i++)
{
if (profile->steps[i].targetTempAtEnd > maxTemp)
@ -153,12 +157,15 @@ void TFT_Display::getMaxTempFromProfile(ReflowProfile *profile)
void TFT_Display::getTotalTimeFromProfile(ReflowProfile *profile)
{
totalTIme = 0;
for (uint8_t i = 0; i < 5; i++)
{
totalTIme += profile->steps[i].duration;
}
Serial.println("Total time");
Serial.println(String(totalTIme));
}
TFT_XY TFT_Display::getXYWithinGraphBounds(uint8_t temp, uint8_t time)
@ -175,10 +182,12 @@ TFT_XY TFT_Display::getXYWithinGraphBounds(uint8_t temp, uint8_t time)
void TFT_Display::drawGraph()
{
drawGraphAxis();
drawGraphAxisLabels();
drawGraphAxisTicks();
drawGraphAxisTickLabels();
drawGraphReflowStagesBackground();
drawGraphAxis();
drawReflowTargetTempLine();
}
void TFT_Display::drawGraphAxis()
@ -236,109 +245,302 @@ void TFT_Display::drawGraphAxisTicks()
void TFT_Display::drawGraphAxisTickLabels()
{
// Temperatures
// Always starts at 20c
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(1);
TFT_XY position = getRightAlignedTextXY("20", graphXY.x, graphXY.y);
TFT_XY position;
// Always starts at 20c
position = getRightAlignedTextXY("20", graphXY.x, graphXY.y);
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println("20");
// Always ends at maxTemp
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(1);
// Always ends at maxTemp
char *maxTempCharPtr = numberToCharPtr(maxTemp);
position = getRightAlignedTextXY(maxTempCharPtr, graphXY.x, graphXY.y - graphHeight);
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println(maxTemp);
delete[] maxTempCharPtr;
// Draw three tick labels on the temp axis at 1/4, 1/2 and 3/4 of the way along
// 1/4
uint8_t temp = (maxTemp - minTemp) / 4;
char *tempCharPtr = numberToCharPtr(temp);
position = getRightAlignedTextXY(tempCharPtr, graphXY.x, graphXY.y - (graphHeight / 4));
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println(temp);
delete[] tempCharPtr;
// 1/2
temp = (maxTemp - minTemp) / 2;
tempCharPtr = numberToCharPtr(temp);
position = getRightAlignedTextXY(tempCharPtr, graphXY.x, graphXY.y - (graphHeight / 2));
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println(temp);
delete[] tempCharPtr;
// 3/4
temp = (maxTemp - minTemp) * 3 / 4;
tempCharPtr = numberToCharPtr(temp);
position = getRightAlignedTextXY(tempCharPtr, graphXY.x, graphXY.y - (graphHeight * 3 / 4));
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println(temp);
delete[] tempCharPtr;
for (int i = 1; i <= 3; i++)
{
uint8_t temp = (maxTemp - minTemp) * i / 4;
char *tempCharPtr = numberToCharPtr(temp);
position = getRightAlignedTextXY(tempCharPtr, graphXY.x, graphXY.y - (graphHeight * i / 4));
tft.setCursor(position.x - tickMarkLength, position.y);
tft.println(temp);
delete[] tempCharPtr;
}
// Times
// Always starts at 0
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(1);
position = getCenterAlignedBottomTextXY("0", graphXY.x, graphXY.y);
tft.setCursor(position.x, position.y+tickMarkLength+1);
tft.setCursor(position.x, position.y + tickMarkLength + 1);
tft.println("0");
// Always ends at totalTime
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(1);
char *totalTimeCharPtr = numberToCharPtr(totalTIme);
position = getCenterAlignedBottomTextXY(totalTimeCharPtr, graphXY.x + graphWidth, graphXY.y);
tft.setCursor(position.x, position.y+tickMarkLength+1);
tft.setCursor(position.x, position.y + tickMarkLength + 1);
tft.println(totalTIme);
delete[] totalTimeCharPtr;
// Draw three tick labels on the time axis at 1/4, 1/2 and 3/4 of the way along
// 1/4
uint8_t time = totalTIme / 4;
char *timeCharPtr = numberToCharPtr(time);
position = getCenterAlignedBottomTextXY(timeCharPtr, graphXY.x + (graphWidth / 4), graphXY.y);
tft.setCursor(position.x, position.y+tickMarkLength+1);
tft.println(time);
delete[] timeCharPtr;
// 1/2
time = totalTIme / 2;
timeCharPtr = numberToCharPtr(time);
position = getCenterAlignedBottomTextXY(timeCharPtr, graphXY.x + (graphWidth / 2), graphXY.y);
tft.setCursor(position.x, position.y+tickMarkLength+1);
tft.println(time);
delete[] timeCharPtr;
// 3/4
time = totalTIme * 3 / 4;
timeCharPtr = numberToCharPtr(time);
position = getCenterAlignedBottomTextXY(timeCharPtr, graphXY.x + (graphWidth * 3 / 4), graphXY.y);
tft.setCursor(position.x, position.y+tickMarkLength+1);
tft.println(time);
delete[] timeCharPtr;
for (int i = 1; i <= 3; i++)
{
uint8_t time = totalTIme * i / 4;
char *timeCharPtr = numberToCharPtr(time);
position = getCenterAlignedBottomTextXY(timeCharPtr, graphXY.x + (graphWidth * i / 4), graphXY.y);
tft.setCursor(position.x, position.y + tickMarkLength + 1);
tft.println(time);
delete[] timeCharPtr;
}
}
uint16_t TFT_Display::tempYonGraph(uint16_t temp)
void TFT_Display::drawGraphReflowStagesBackground()
{
// Calculate the y position of the temperature on the graph based on the min and max temperatures and the min and max y of the graph
uint16_t x = graphXY.x + 1;
uint16_t previopusWidth;
// Draw the background for the reflow stages
for (int i = 0; i < 5; i++)
{
uint8_t y = graphXY.y - (graphHeight * ((temp - minTemp) / (maxTemp - minTemp)));
Serial.println("Time x");
Serial.println(String(x));
uint16_t y = graphXY.y - graphHeight;
uint16_t height = graphHeight;
// Get the width by getting the duration of each step in relation to the total time
float duration = profile->steps[i].duration;
uint16_t width = (duration / totalTIme) * graphWidth;
switch (i)
{
case 0:
tft.drawRect(x, y, width, height, preheat_COLOR);
previopusWidth = width;
break;
case 1:
x += previopusWidth;
tft.drawRect(x, y, width, height, soak_COLOR);
previopusWidth = width;
break;
case 2:
x += previopusWidth;
tft.drawRect(x, y, width, height, reflow_COLOR);
previopusWidth = width;
break;
case 3:
x += previopusWidth;
tft.drawRect(x, y, width, height, cool_COLOR);
previopusWidth = width;
break;
default:
break;
}
}
}
void TFT_Display::drawReflowTargetTempLine()
{
float startTemp = 20;
int startTime = 0;
uint16_t startX = graphXY.x;
uint16_t startY = graphXY.y;
int endTime;
for (int i = 0; i < 4; i++)
{
// Get the end temp and time of the current step
int endTemp = profile->steps[i].targetTempAtEnd;
int duration = profile->steps[i].duration;
endTime = duration + startTime;
uint16_t endX = timeXonGraph(endTime);
uint16_t endY = tempYonGraph(endTemp);
Serial.print("State:");
Serial.println(String(STATE_STR(profile->steps[i].state)));
Serial.print("Start x:");
Serial.println(String(startX));
Serial.print("Start y:");
Serial.println(String(startY));
Serial.print("End x:");
Serial.println(String(endX));
Serial.print("End y:");
Serial.println(String(endY));
Serial.print("Start temp:");
Serial.println(String(startTemp));
Serial.print("End temp:");
Serial.println(String(endTemp));
Serial.print("Start time:");
Serial.println(String(startTime));
Serial.print("End time:");
Serial.println(String(endTime));
Serial.println(" ");
// Draw the line pixel by pixel
switch (profile->steps[i].easeFunction)
{
case LINEAR:
tft.drawLine(startX, startY, endX, endY, ST77XX_WHITE);
break;
case EASE_IN_OUT:
for (int i = 0; i <= 100; i++)
{
// Convert i to a percentage
float percentage = i / 100.0;
// calculate the temp at the current percentage of the line
float temp = startTemp + (endTemp - startTemp) * -(cos(percentage * PI) - 1) / (double)2;
Serial.print("Temp:");
Serial.println(temp);
Serial.print("Percentage:");
Serial.println(percentage);
float time = startTime + (duration * percentage);
// Calculate the x and y position of the temp on the graph
uint16_t y = tempYonGraph(temp);
uint16_t x = timeXonGraph(time);
tft.drawPixel(x, y, ST77XX_WHITE);
}
break;
case EASE_IN:
for (int i = 0; i <= 100; i++)
{
// Convert i to a percentage
float percentage = i / 100.0;
// calculate the temp at the current percentage of the line
float temp = startTemp + (endTemp - startTemp) * (1 - cos(percentage * PI / (double)2));
Serial.print("Temp:");
Serial.println(temp);
Serial.print("Percentage:");
Serial.println(percentage);
// Calculate the x and y position of the temp on the graph
uint16_t y = tempYonGraph(temp);
uint16_t x = timeXonGraph(startTime + (duration * percentage));
tft.drawPixel(x, y, ST77XX_WHITE);
}
break;
case EASE_OUT:
for (int i = 0; i <= 100; i++)
{
// Convert i to a percentage
float percentage = i / 100.0;
// calculate the temp at the current percentage of the line
float temp = startTemp + (endTemp - startTemp) * (sin(percentage * PI / (double)2));
Serial.print("Temp:");
Serial.println(temp);
Serial.print("Percentage:");
Serial.println(percentage);
// Calculate the x and y position of the temp on the graph
uint16_t y = tempYonGraph(temp);
uint16_t x = timeXonGraph(startTime + (duration * percentage));
tft.drawPixel(x, y, ST77XX_WHITE);
}
break;
case HALF_SINE:
for (int i = 0; i <= 100; i++)
{
// Convert i to a percentage
float percentage = i / 100.0;
// calculate the temp at the current percentage of the line
float temp = startTemp + (endTemp - startTemp) * (sin(percentage * PI));
Serial.print("Temp:");
Serial.println(temp);
Serial.print("Percentage:");
Serial.println(percentage);
// Calculate the x and y position of the temp on the graph
uint16_t y = tempYonGraph(temp);
uint16_t x = timeXonGraph(startTime + (duration * percentage));
tft.drawPixel(x, y, ST77XX_WHITE);
}
break;
default:
// tft.drawLine(startX, startY, endX, endY, ST77XX_WHITE);
break;
}
// tft.drawLine(startX, startY, endX, endY, ST77XX_WHITE);
// Set the start temp and time to the end temp and time of the current step
startTemp = endTemp;
startTime = endTime;
// Get the start and end x and y positions of the line
startX = endX;
startY = endY;
}
}
uint16_t TFT_Display::tempYonGraph(float temp)
{
// Calculate the y position of the temperature on the graph based on the min and max temperatures and the min and max y of the graph the higher the temperature the lower the y values goes
float y = graphXY.y - (graphHeight * ((temp - minTemp) / (maxTemp - minTemp)));
return y;
}
uint16_t TFT_Display::timeXonGraph(uint16_t time)
uint16_t TFT_Display::timeXonGraph(float time)
{
// Calculate the x position of the time on the graph based on the min and max times and the min and max x of the graph
uint8_t x = graphXY.x + (graphWidth * (time / totalTIme));
float x = graphXY.x + (graphWidth * (time / totalTIme));
return x;
}

View File

@ -4,6 +4,7 @@
#include <Arduino.h>
#include <Adafruit_ST7789.h> // Include the ST7789 library
#include <reflow.h>
#include <globals.h>
struct TFT_XY
{
@ -23,6 +24,9 @@ public:
void clear();
private:
ReflowProfile *profile;
uint8_t tickMarkLength = 5;
// Add your private members here
TFT_XY getCenteredTextXY(char *text);
@ -46,9 +50,11 @@ private:
void drawGraphAxisLabels();
void drawGraphAxisTicks();
void drawGraphAxisTickLabels();
void drawGraphReflowStagesBackground();
void drawReflowTargetTempLine();
uint16_t tempYonGraph(uint16_t temp);
uint16_t timeXonGraph(uint16_t time);
uint16_t tempYonGraph(float temp);
uint16_t timeXonGraph(float time);
template <typename T>
char *numberToCharPtr(T number);

View File

@ -1,54 +1,59 @@
#include "./globals.h"
#include "./EEPROMDataManager.h"
#include "Adafruit_ST7789.h"
WrappedState<ReflowProcessState> reflowProcessState = WrappedState<ReflowProcessState>(INITIALIZING);
AnalogRef analogRef(5.0);
// Calibration data for 100K thermistors ->https://fab.cba.mit.edu/classes/863.18/CBA/people/erik/reference/11_NTC-3950-100K.pdf ->Glass thermistor NTC 3950 100K
// Calibration data for 100K thermistors ->https://fab.cba.mit.edu/classes/863.18/CBA/people/erik/reference/11_NTC-3950-100K.pdf ->Glass thermistor NTC 3950 100K
TempCalibration calibration_100K_3950 = {25, 100000, 86, 10324, 169, 1148};
// Initalize the 3950 100K thermistors with ACTUAL reference resistor measurnment(Measured between Left pin and GND when the board is powered off) using the default calibration data for 100K thermistor
// You can also make a custom calibration data for your thermistor and use that instead of the default one pass it as shown below --> keep the naming of the thermistor the same as the one you are replacing
//TempCalibration calibration_10K_3950 = {25, 10000, 86, 1032, 169, 118};
//Thermistor thermistor1(THERMISTOR1_PIN, 100000, calibration_10K_3950,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
// TempCalibration calibration_10K_3950 = {25, 10000, 86, 1032, 169, 118};
// Thermistor thermistor1(THERMISTOR1_PIN, 100000, calibration_10K_3950,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//--------------------------------------------------------------------------------------------------------------------------------------
//This is where you set your potentiometer values and positioning for the 6 thermistors
// This is where you set your potentiometer values and positioning for the 6 thermistors
//You can tweak them from the datasheet to best fit your thermistor but we reccoemnd using the default values and setting the potentiometer to these values
// Does not have to be perfect just set it close to this value and record the measured value and put it for the thermistors
//To measure the resistence turn off the controller completley and measure between GND and the left pin of the connector with the thermistor unplugged
//2.5k reference = Best accuracy around 138C
Thermistor thermistor1(THERMISTOR1_PIN, 2500,ThermistorZ_Placement::BOTTOM,ThermistorXY_Placement::RIGHT);
Thermistor thermistor2(THERMISTOR2_PIN, 2500,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
Thermistor thermistor3(THERMISTOR3_PIN, 2500,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//1k reference = Best accuracy around 173c
Thermistor thermistor4(THERMISTOR4_PIN, 1000,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//515R reference = Best accuracy around 210C
Thermistor thermistor5(THERMISTOR5_PIN, 515,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
//9k reference = Best accuracy around 90C -> This thermistor is used for the preheat phase if attached
Thermistor thermistor6(THERMISTOR6_PIN, 9000,ThermistorZ_Placement::TOP,ThermistorXY_Placement::MIDDLE);
// You can tweak them from the datasheet to best fit your thermistor but we reccoemnd using the default values and setting the potentiometer to these values
// Does not have to be perfect just set it close to this value and record the measured value and put it for the thermistors
// To measure the resistence turn off the controller completley and measure between GND and the left pin of the connector with the thermistor unplugged
// 2.5k reference = Best accuracy around 138C
Thermistor thermistor1(THERMISTOR1_PIN, 2500, ThermistorZ_Placement::BOTTOM, ThermistorXY_Placement::RIGHT);
Thermistor thermistor2(THERMISTOR2_PIN, 2500, ThermistorZ_Placement::TOP, ThermistorXY_Placement::MIDDLE);
Thermistor thermistor3(THERMISTOR3_PIN, 2500, ThermistorZ_Placement::TOP, ThermistorXY_Placement::MIDDLE);
// 1k reference = Best accuracy around 173c
Thermistor thermistor4(THERMISTOR4_PIN, 1000, ThermistorZ_Placement::TOP, ThermistorXY_Placement::MIDDLE);
// 515R reference = Best accuracy around 210C
Thermistor thermistor5(THERMISTOR5_PIN, 515, ThermistorZ_Placement::TOP, ThermistorXY_Placement::MIDDLE);
// 9k reference = Best accuracy around 90C -> This thermistor is used for the preheat phase if attached
Thermistor thermistor6(THERMISTOR6_PIN, 9000, ThermistorZ_Placement::TOP, ThermistorXY_Placement::MIDDLE);
//---------------------------------------------------------------------------------------------------------------------------------------
//Put all thermistors in an array
// Put all thermistors in an array
Thermistor thermistors[6] = {thermistor1, thermistor2, thermistor3, thermistor4, thermistor5, thermistor6};
//---------------------------------------------------------------------------------------------------------------------------------------
// Which Color to use for the reflow process markers
uint16_t preheat_COLOR = 0x6800;
uint16_t soak_COLOR = 0x6b60;
uint16_t reflow_COLOR = 0x0201;
uint16_t cool_COLOR = 0x00a8;
// These are the reflow profiles that you can choose from, you can add more if you want (up to 5) but you will have to change the nReflowProfiles variable to the number of profiles you have
int nReflowProfiles = 3;
@ -56,39 +61,25 @@ int nReflowProfiles = 3;
ReflowProfile reflowProfiles[] = {
// 138c profile Sn42Bi58
ReflowProfile(new ReflowStep[5]{
ReflowStep(ReflowProcessState::PREHEAT, 2, 100, EASE_OUT),
ReflowStep(ReflowProcessState::SOAK, 5, 155),
ReflowStep(ReflowProcessState::REFLOW, 90, 185, HALF_SINE),
ReflowStep(ReflowProcessState::COOL, 60, 95, EASE_OUT),
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::DONE, 0, 0)},
"138c Sn42Bi58\0"),
ReflowProfile(new ReflowStep[5]{
ReflowStep(ReflowProcessState::PREHEAT, 100, 150),
ReflowStep(ReflowProcessState::SOAK, 30, 180),
ReflowStep(ReflowProcessState::REFLOW, 80, 220, EASE_IN_OUT),
ReflowStep(ReflowProcessState::COOL, 30, 183),
ReflowStep(ReflowProcessState::DONE, 0, 0)},
"183C Sn63 Pb37 \0"),
ReflowProfile(new ReflowStep[5]{
ReflowStep(ReflowProcessState::PREHEAT, 5, 150),
ReflowStep(ReflowProcessState::SOAK, 5, 180),
ReflowStep(ReflowProcessState::REFLOW, 5, 220, EASE_IN_OUT),
ReflowStep(ReflowProcessState::COOL, 5, 183),
ReflowStep(ReflowProcessState::DONE, 0, 0)},
"debug profi \0"),
"138c Sn42Bi58\0"),
ReflowProfile(new ReflowStep[5]{ReflowStep(ReflowProcessState::PREHEAT, 100, 150), ReflowStep(ReflowProcessState::SOAK, 30, 180), ReflowStep(ReflowProcessState::REFLOW, 80, 220, EASE_IN_OUT), ReflowStep(ReflowProcessState::COOL, 30, 183), ReflowStep(ReflowProcessState::DONE, 0, 0)}, "183C Sn63 Pb37 \0"),
ReflowProfile(new ReflowStep[5]{ReflowStep(ReflowProcessState::PREHEAT, 5, 150), ReflowStep(ReflowProcessState::SOAK, 5, 180), ReflowStep(ReflowProcessState::REFLOW, 5, 220, EASE_IN_OUT), ReflowStep(ReflowProcessState::COOL, 5, 183), ReflowStep(ReflowProcessState::DONE, 0, 0)}, "debug profi \0"),
};
//---------------------------------------------------------------------------------------------------------------------------------------
ReflowProfile chosenReflowProfile = reflowProfiles[0];
//Currently unsued -> can be used to calculate current draw of the system along with system voltage and compared to the current sensor and just be a nice sanity check for the system
// Currently unsued -> can be used to calculate current draw of the system along with system voltage and compared to the current sensor and just be a nice sanity check for the system
uint16_t plateResistanceOhm = 0;
EEPROMDataManager eepromDataManager = EEPROMDataManager();
PidControllerData pidControllerData = {0 /*currentTemp*/, 60 /*TargetTemp*/, 255 /*PWM*/};

View File

@ -6,6 +6,7 @@
#include "./EEPROMDataManager.h"
#include "./PID/PidController.h"
//Comment out to enable debug messages
//#define DEBUG
@ -37,4 +38,9 @@ extern PidControllerData pidControllerData;
extern PidController pidController;
extern EEPROMDataManager eepromDataManager;
extern uint16_t reflow_COLOR;
extern uint16_t preheat_COLOR;
extern uint16_t soak_COLOR;
extern uint16_t cool_COLOR;
#endif

View File

@ -113,7 +113,7 @@ void loop()
pidController.loop();
pidController.debug();
//pidController.debug();
ReflowStep step = chosenReflowProfile.reflowStep();
// Here we draw the actual temp vs time to the display

View File

@ -50,6 +50,7 @@ public:
uint8_t targetTempAtEnd;
ReflowProcessState state;
ReflowStepEaseFunction easeFunction;
bool flagged = false;
float calcTempAtPercentage(uint8_t startTemp, float percentage)
{
@ -61,7 +62,6 @@ public:
return startTemp + (this->targetTempAtEnd - startTemp) * -(cos(percentage * PI) - 1) / (double)2;
case EASE_IN:
return startTemp + (this->targetTempAtEnd - startTemp) * (1 - cos(percentage * PI / (double)2));
case EASE_OUT:
return startTemp + (this->targetTempAtEnd - startTemp) * (sin(percentage * PI / (double)2));
case HALF_SINE:
@ -79,9 +79,24 @@ class ReflowProfile
public:
ReflowProfile(ReflowStep steps[5], char name[20])
{
bool flag = false;
uint8_t sinePosition = 0;
for (int i = 0; i < 5; i++)
{
this->steps[i] = steps[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
if (steps[i].easeFunction == HALF_SINE && i != 3 && i != 0)
{
this->steps[i + 1].flagged = true;
this->steps[i] = steps[i];
}
else
{
this->steps[i] = steps[i];
}
}
for (int i = 0; i < 20; i++)
@ -137,7 +152,7 @@ public:
startTimeFloat *= 1000;
endTimeFloat *= 1000;
if (elapsedMS >= startTimeFloat && elapsedMS <endTimeFloat)
if (elapsedMS >= startTimeFloat && elapsedMS < endTimeFloat)
{
// Serial.println(String(elapsedMS) + " " + String(startTimes[i] * 1000) + " " + String(endTimes[i] * 1000) + " " + String(i) + " " + String(steps[i].state));
return steps[i];
@ -154,7 +169,6 @@ public:
float endTimesFloat[4];
return timerElapsed / (float)(endTimes[4] * 1000);
}
@ -184,15 +198,16 @@ public:
uint32_t relativeElapsedTime = elapsedMS - startTimeMS;
float duration = curStep.duration ;
float duration = curStep.duration;
duration *= 1000;
float relativeElapsedTimeF = relativeElapsedTime;
float percentage = relativeElapsedTime / duration;
// Serial.println(String(percentage)+ "%" + String(STATE_STR(curStep.state)) + " Elapsed: " + String(elapsedMS) + " ___ " + String(curStep.duration * 1000));
return curStep.calcTempAtPercentage(startTemp, percentage);
return curStep.calcTempAtPercentage(startTemp, percentage);
}
/**