updated sensors

This commit is contained in:
2021-07-26 18:54:25 +02:00
parent 14b599c4da
commit 11b146c2d1
9 changed files with 239 additions and 240 deletions

13
lcd.cpp
View File

@@ -85,6 +85,8 @@ void initLCD()
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
pinMode(TFT_BL, OUTPUT);
// Draw the dial
TJpgDec.drawJpg(0, 0, dial, sizeof(dial));
tft.drawCircle(DIAL_CENTRE_X, DIAL_CENTRE_Y, NEEDLE_RADIUS - NEEDLE_LENGTH, TFT_DARKGREY);
@@ -102,8 +104,8 @@ void initLCD()
spr.pushSprite(DIAL_CENTRE_X - spr_width / 2, DIAL_CENTRE_Y - spr.fontHeight() / 2);
// Plot the label text
nameSpr.setTextFont(3);
name_spr_width = nameSpr.textWidth("Temperature");
nameSpr.setTextFont(2);
name_spr_width = nameSpr.textWidth("---Sensor Name---");
nameSpr.createSprite(name_spr_width, nameSpr.fontHeight() * 2 + 2);
nameSpr.fillSprite(bg_color);
nameSpr.setTextColor(TFT_WHITE, bg_color);
@@ -146,11 +148,10 @@ uint32_t display_last_update = 0;
#define MAXGUAGE 240
#define MINGUAGE 0
#define DISPLAY_ROTATE 10 //sec
#define DISPLAY_ROTATE 15 //sec
void handleLCD()
{
static uint32_t value;
static uint16_t angle;
DISPLAY_STATE displaystate_next = DISPLAY_PM1P0;
sensor_e nextSensor = AE_1P0;
@@ -218,9 +219,9 @@ void handleLCD()
return;
}
angle = map(value, sensor->getMin(), sensor->getMax(), MINGUAGE, MAXGUAGE);
angle = map(sensor->value(), sensor->getMin(), sensor->getMax(), MINGUAGE, MAXGUAGE);
plotNeedle(angle, 15, value);
plotNeedle(angle, 15, sensor->value());
nameSpr.drawString(sensor->getName().c_str(), name_spr_width / 2, nameSpr.fontHeight() / 2);
nameSpr.drawString(sensor->getUnit().c_str(), name_spr_width / 2, nameSpr.fontHeight() / 2 * 3 + 2);