lcd update
This commit is contained in:
17
reflow_plate_fw/.vscode/tasks.json
vendored
Normal file
17
reflow_plate_fw/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "PlatformIO",
|
||||||
|
"task": "Build",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$platformio"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"label": "PlatformIO: Build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#define SSD1351_DRIVER
|
#define SSD1351_DRIVER
|
||||||
|
|
||||||
|
|
||||||
#define TFT_WIDTH 128
|
#define TFT_WIDTH 128
|
||||||
#define TFT_HEIGHT 128
|
#define TFT_HEIGHT 128
|
||||||
|
|
||||||
@@ -11,19 +10,6 @@
|
|||||||
|
|
||||||
#define SSD1351_1DOT5_INCH_128 // For 128 x 128 display
|
#define SSD1351_1DOT5_INCH_128 // For 128 x 128 display
|
||||||
|
|
||||||
// Wiring:
|
|
||||||
// +-------------+------------+-------------------------------------------------------------------+
|
|
||||||
// | Display PCB | TFT_eSPI | Info |
|
|
||||||
// +-------------+------------+-------------------------------------------------------------------+
|
|
||||||
// | GND | GND (0V) | Common |
|
|
||||||
// | VCC | 5V or 3.3V | Better to power with 5V if display PCB supports it |
|
|
||||||
// | DIN | TFT_MOSI | SPI data |
|
|
||||||
// | SCK | TFT_SCLK | SPI clock |
|
|
||||||
// | DC | TFT_DC | Distinguish between a command or its data |
|
|
||||||
// | RST | TFT_RST | Hardware reset, can connect to MCU RST pin as well |
|
|
||||||
// | CS | TFT_CS | Chip select, Set to -1 if for manually use with multiple displays |
|
|
||||||
// +-------------+------------+-------------------------------------------------------------------+
|
|
||||||
|
|
||||||
//#define TFT_MOSI PA7
|
//#define TFT_MOSI PA7
|
||||||
//#define TFT_SCLK PA5
|
//#define TFT_SCLK PA5
|
||||||
#define TFT_DC PB1
|
#define TFT_DC PB1
|
||||||
|
|||||||
@@ -19,4 +19,7 @@ lib_deps =
|
|||||||
bodmer/TFT_eSPI@^2.3.70
|
bodmer/TFT_eSPI@^2.3.70
|
||||||
lib_ldf_mode = deep+
|
lib_ldf_mode = deep+
|
||||||
build_flags =
|
build_flags =
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-include include/Setup202_SSD1351_128.h
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,7 @@
|
|||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
#include "thermo.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// void initLCD(void)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void handleLCD(void)
|
|
||||||
// {
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
unsigned int rainbow(byte value);
|
|
||||||
|
|
||||||
#include <TFT_eSPI.h> // Include the graphics library
|
|
||||||
|
|
||||||
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -24,10 +9,28 @@ TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
void initLCD(void) {
|
void initLCD(void) {
|
||||||
tft.init();
|
tft.init();
|
||||||
tft.setRotation(0);
|
tft.setTextFont(2);
|
||||||
tft.setTextFont(1);
|
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.invertDisplay(false);
|
tft.invertDisplay(false);
|
||||||
|
//tft.setTextColor(TFT_WHITE);
|
||||||
|
tft.setRotation(0);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String showValue(String designator, float value, String unit)
|
||||||
|
{
|
||||||
|
String text;
|
||||||
|
//text.clear();
|
||||||
|
if (designator != "")
|
||||||
|
{
|
||||||
|
text = designator;
|
||||||
|
text += " ";
|
||||||
|
}
|
||||||
|
text += value;
|
||||||
|
text += " ";
|
||||||
|
text += unit;
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -35,7 +38,5 @@ void initLCD(void) {
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
void handleLCD()
|
void handleLCD()
|
||||||
{
|
{
|
||||||
//tft.setTextColor(TFT_WHITE);
|
tft.drawString(showValue("Temp", getTemperature(), "grC"), 10, 10);
|
||||||
//tft.setTextPadding(60);
|
|
||||||
tft.drawString("hello World!", 10, 10);
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
#include "Setup202_SSD1351_128.h"
|
||||||
|
#include <TFT_eSPI.h> // Include the graphics library
|
||||||
|
|
||||||
|
|
||||||
void initLCD(void);
|
void initLCD(void);
|
||||||
|
|||||||
@@ -1,12 +1,46 @@
|
|||||||
#include "thermo.h"
|
#include "thermo.h"
|
||||||
|
|
||||||
|
Thermocouple* thermocouple = NULL;
|
||||||
|
|
||||||
void initThermo(void)
|
// the setup function runs once when you press reset or power the board
|
||||||
{
|
void initThermo() {
|
||||||
|
|
||||||
|
Thermocouple* originThermocouple = new MAX6675_Thermocouple(THERM_CL, THERM_CS, THERM_SO);
|
||||||
|
thermocouple = new AverageThermocouple(
|
||||||
|
originThermocouple,
|
||||||
|
READINGS_NUMBER,
|
||||||
|
DELAY_TIME
|
||||||
|
);
|
||||||
|
|
||||||
|
/* OR
|
||||||
|
thermocouple = new AverageThermocouple(
|
||||||
|
new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN),
|
||||||
|
READINGS_NUMBER,
|
||||||
|
DELAY_TIME
|
||||||
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleThermo(void)
|
// the loop function runs over and over again forever
|
||||||
{
|
void handleThermo(void) {
|
||||||
|
// Reads temperature
|
||||||
|
const double celsius = thermocouple->readCelsius();
|
||||||
|
const double kelvin = thermocouple->readKelvin();
|
||||||
|
const double fahrenheit = thermocouple->readFahrenheit();
|
||||||
|
|
||||||
}
|
// Output of information
|
||||||
|
Serial.print("Temperature: ");
|
||||||
|
Serial.print(celsius);
|
||||||
|
Serial.print(" C, ");
|
||||||
|
Serial.print(kelvin);
|
||||||
|
Serial.print(" K, ");
|
||||||
|
Serial.print(fahrenheit);
|
||||||
|
Serial.println(" F");
|
||||||
|
|
||||||
|
delay(100); // optionally, only to delay the output of information in the example.
|
||||||
|
}
|
||||||
|
|
||||||
|
double getTemperature(void)
|
||||||
|
{
|
||||||
|
return thermocouple->readCelsius();
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,26 @@
|
|||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include <Thermocouple.h>
|
||||||
|
#include <MAX6675_Thermocouple.h>
|
||||||
|
#include <AverageThermocouple.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
How many readings are taken to determine a mean temperature.
|
||||||
|
The more values, the longer a calibration is performed,
|
||||||
|
but the readings will be more accurate.
|
||||||
|
*/
|
||||||
|
#define READINGS_NUMBER 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
Delay time between a temperature readings
|
||||||
|
from the temperature sensor (ms).
|
||||||
|
*/
|
||||||
|
#define DELAY_TIME 10
|
||||||
|
|
||||||
void initThermo(void);
|
void initThermo(void);
|
||||||
void handleThermo(void);
|
void handleThermo(void);
|
||||||
|
double getTemperature(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user