Skip to content

Commit

Permalink
Added tangents to the curve for ESP32 support
Browse files Browse the repository at this point in the history
Improved graph curves
Fixed some UI glitches
Made end graph time value be the end profile time
  • Loading branch information
Seon Rozenblum committed Aug 27, 2018
1 parent 5492f93 commit 6932868
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
19 changes: 17 additions & 2 deletions Code/Reflow_Master/ReflowMasterProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ This is the profile structure used by the Reflow Master toaster oven controller
int tempDeg;
float reflowGraphX[10];
float reflowGraphY[10];
float reflowTangents[10] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
float wantedCurve[350];
int len = -1;
int fanTime = -1;
int offTime = -1;
int completeTime = -1;

float maxWantedDelta = 0;

Expand All @@ -62,18 +64,31 @@ This is the profile structure used by the Reflow Master toaster oven controller
offTime = offT;
fanTime = fanT;


// for ( int i = 0; i < 10; i++ )
// reflowTangents[i] = -1;

int minLength = min( 10, leng );

len = minLength;

completeTime = flowX[ len -1 ];

for ( int i = 0; i < minLength; i++ )
{
reflowGraphX[i] = flowX[i];
reflowGraphY[i] = flowY[i];

if ( i == 0 )
reflowTangents[i] = 1;
else if ( i >= fanT )
reflowTangents[i] = 1;
else
reflowTangents[i] = 0;
}

for ( int i = 0; i < ELEMENTS(wantedCurve); i++ )
wantedCurve[i] = -1;
wantedCurve[i] = -1;
}

~ReflowGraph()
Expand Down Expand Up @@ -114,4 +129,4 @@ This is the profile structure used by the Reflow Master toaster oven controller

/*
* End ReflowGraphs
*/
*/
35 changes: 23 additions & 12 deletions Code/Reflow_Master/Reflow_Master.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
---------------------------------------------------------------------------
Reflow Master Control - v1.0.0 - 01/08/2018
Reflow Master Control - v1.0.2 - 27/08/2018
AUTHOR/LICENSE:
Created by Seon Rozenblum - [email protected]
Expand All @@ -18,8 +18,9 @@ PURPOSE:
This controller is the software that runs on the Reflow Master toaster oven controller made by Unexpected Maker
HISTORY:
01/08/2018 v1.0 - Initial release.
13/08/2018 v1.01 - Settings UI button now change to show SELECT or CHANGE depending on what is selected
01/08/2018 v1.0 - Initial release.
13/08/2018 v1.01 - Settings UI button now change to show SELECT or CHANGE depending on what is selected
27/08/2018 v1.02 - Added tangents to the curve for ESP32 support, Improved graph curves, fixed some UI glitches, made end graph time value be the end profile time
---------------------------------------------------------------------------
*/
Expand All @@ -41,7 +42,7 @@ HISTORY:
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))

// used to show or hide serial debug output
#define DEBUG
//#define DEBUG

// TFT SPI pins
#define TFT_DC 0
Expand Down Expand Up @@ -100,7 +101,7 @@ typedef struct {
bool startFullBlast = false;
} Settings;

const String ver = "1.01";
const String ver = "1.02";
bool newSettings = false;

long nextTempRead;
Expand Down Expand Up @@ -136,6 +137,7 @@ unsigned int currentPlotColor = GREEN;
bool isCuttoff = false;
bool isFanOn = false;
float lastWantedTemp = -1;
int buzzerCount = 5;


// Graph Size for UI
Expand Down Expand Up @@ -237,7 +239,7 @@ void SetCurrentGraph( int index )

// Initialise the spline for the profile to allow for smooth graph display on UI
timeX = 0;
baseCurve.setPoints(CurrentGraph().reflowGraphX, CurrentGraph().reflowGraphY, CurrentGraph().len);
baseCurve.setPoints(CurrentGraph().reflowGraphX, CurrentGraph().reflowGraphY, CurrentGraph().reflowTangents, CurrentGraph().len);
baseCurve.setDegree( Hermite );

// Re-interpolate data based on spline
Expand Down Expand Up @@ -523,15 +525,15 @@ void loop()
{
timeX++;

if ( timeX > 300 )
if ( timeX > CurrentGraph().completeTime )
{
EndReflow();
}
else
{
Graph(tft, timeX, currentTemp, 30, 220, 270, 180 );

if ( !isCuttoff )
if ( timeX < CurrentGraph().fanTime )
{
float wantedTemp = CurrentGraph().wantedCurve[ (int)timeX ];
DrawHeading( String( round( currentTemp ) ) + "/" + String( (int)wantedTemp )+"c", currentPlotColor, BLACK );
Expand Down Expand Up @@ -697,15 +699,19 @@ void MatchTemp()
}
else // otherwise YELL at the user to open the oven door
{
DrawHeading( "OPEN OVEN", RED, BLACK );
Buzzer( 1000, 2000 );
if ( buzzerCount > 0 )
{
DrawHeading( "OPEN OVEN", RED, BLACK );
Buzzer( 1000, 2000 );
buzzerCount--;
}
}
}
}
else
{
// YELL at the user to open the oven door
if ( !isCuttoff )
if ( !isCuttoff && set.useFan )
{
DrawHeading( "OPEN OVEN", GREEN, BLACK );
Buzzer( 1000, 2000 );
Expand Down Expand Up @@ -1143,6 +1149,7 @@ void StartWarmup()
timeX = 0;
ShowMenuOptions( true );
lastWantedTemp = -1;
buzzerCount = 5;

tft.setTextColor( GREEN, BLACK );
tft.setTextSize(3);
Expand Down Expand Up @@ -1652,7 +1659,11 @@ void SetupGraph(Adafruit_ILI9341 &d, double x, double y, double gx, double gy, d
d.setTextSize(1);
d.setTextColor(tcolor, bcolor);
d.setCursor(temp, gy + 10);
println_Center(d, String(round(i)), temp, gy + 10 );

if ( i <= xhi - xinc )
println_Center(d, String(round(i)), temp, gy + 10 );
else
println_Center(d, String(round(xhi)), temp, gy + 10 );
}

//now draw the labels
Expand Down

0 comments on commit 6932868

Please sign in to comment.