cad design
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include <TFT_eSPI.h> // Include the graphics library
|
||||
#include "ft6206_touch.h"
|
||||
|
||||
FT6206 ts = FT6206();
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
||||
TFT_eSprite looptime_spr = TFT_eSprite(&tft);
|
||||
@@ -65,7 +68,7 @@ uint32_t lastReading = 0;
|
||||
|
||||
void updateRealtimeGraph(void)
|
||||
{
|
||||
if(getReflowStatus() == REFLOW_STATUS_OFF)
|
||||
if (getReflowStatus() == REFLOW_STATUS_OFF)
|
||||
{
|
||||
temperatureReading.clear();
|
||||
return;
|
||||
@@ -86,10 +89,10 @@ void updateRealtimeGraph(void)
|
||||
{
|
||||
uint32_t nowX = calcTime(timeIndex * TEMPINTERVAL);
|
||||
uint32_t nowY = calcTemp(sample);
|
||||
chartArea_spr.drawLine(lastX,lastY, nowX, nowY, CHART_ACTUAL_COLOR);
|
||||
chartArea_spr.drawLine(lastX, lastY, nowX, nowY, CHART_ACTUAL_COLOR);
|
||||
lastX = nowX;
|
||||
lastY = nowY;
|
||||
timeIndex ++;
|
||||
timeIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +154,7 @@ void prepTargetChart(void)
|
||||
void updateReflowState(void)
|
||||
{
|
||||
uint32_t statusColor = STATE_BG_COLOR;
|
||||
if(getOverheating())
|
||||
if (getOverheating())
|
||||
{
|
||||
statusColor = TFT_RED;
|
||||
}
|
||||
@@ -208,7 +211,7 @@ void prepChart(void)
|
||||
for (int i = 0; i < CHART_Y_TICKS; i++)
|
||||
{
|
||||
//tick value
|
||||
uint16_t y_tick_step = calcTempY( tickIndex * (i +1));//CHART_TEMP_MAX - ((CHART_TEMP_MAX - CHART_TEMP_MIN) / CHART_Y_TICKS * i + 1) + CHART_TEMP_MIN;
|
||||
uint16_t y_tick_step = calcTempY(tickIndex * (i + 1)); //CHART_TEMP_MAX - ((CHART_TEMP_MAX - CHART_TEMP_MIN) / CHART_Y_TICKS * i + 1) + CHART_TEMP_MIN;
|
||||
chartYaxis_spr.drawLine(CHART_Y_AXIS_OFFSET - 8, tickIndex * (i + 1), CHART_Y_AXIS_OFFSET, tickIndex * (i + 1), CHART_LINE_COLOR);
|
||||
chartYaxis_spr.setTextDatum(BR_DATUM);
|
||||
chartYaxis_spr.drawString(String(y_tick_step), CHART_Y_AXIS_OFFSET - 3, tickIndex * (i + 1), CHART_FONT);
|
||||
@@ -303,8 +306,14 @@ void updateGUIButtons(void)
|
||||
uint32_t timeNow = millis();
|
||||
if (timeNow - lastButtonTime > BUTTON_INTERVAL)
|
||||
{
|
||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||
bool pressed = tft.getTouch(&t_x, &t_y);
|
||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||
bool pressed = ts.touched(); //.getTouch(&t_x, &t_y);
|
||||
if (pressed)
|
||||
{
|
||||
TS_Point p = ts.getPoint();
|
||||
t_x = p.x;
|
||||
t_y = p.y;
|
||||
}
|
||||
|
||||
for (uint8_t b = 0; b < BUTTONS_N; b++)
|
||||
{
|
||||
@@ -344,9 +353,23 @@ void updateGUIButtons(void)
|
||||
// -------------------------------------------------------------------------
|
||||
// Setup
|
||||
// -------------------------------------------------------------------------
|
||||
void initTouchScreen(void)
|
||||
{
|
||||
ts.begin();
|
||||
if (!ts.begin(40))
|
||||
{
|
||||
Serial.println("Unable to start touchscreen.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Touchscreen started.");
|
||||
}
|
||||
}
|
||||
|
||||
void initLCD(void)
|
||||
{
|
||||
tft.init();
|
||||
|
||||
tft.setRotation(2);
|
||||
tft.setTextFont(2);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
@@ -354,6 +377,8 @@ void initLCD(void)
|
||||
//touch_calibrate();
|
||||
tft.setTouch(calData);
|
||||
|
||||
initTouchScreen();
|
||||
|
||||
prepStatus();
|
||||
prepButtons();
|
||||
prepChart();
|
||||
@@ -366,12 +391,12 @@ void initLCD(void)
|
||||
// Main loop
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
uint32_t lastLCDupdate = 0;
|
||||
|
||||
void handleLCD()
|
||||
{
|
||||
updateStatus();
|
||||
|
||||
uint32_t timeNow = millis();
|
||||
if (timeNow - lastLCDupdate > LCD_INTERVAL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user