Fix meters Widget example
This commit is contained in:
parent
cc9787deaf
commit
90fe790ff9
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef _TFT_eSPIH_
|
#ifndef _TFT_eSPIH_
|
||||||
#define _TFT_eSPIH_
|
#define _TFT_eSPIH_
|
||||||
|
|
||||||
#define TFT_ESPI_VERSION "2.4.74"
|
#define TFT_ESPI_VERSION "2.4.75"
|
||||||
|
|
||||||
// Bit level feature flags
|
// Bit level feature flags
|
||||||
// Bit 0 set: viewport capability
|
// Bit 0 set: viewport capability
|
||||||
|
|
|
||||||
|
|
@ -65,18 +65,23 @@ void loop()
|
||||||
float value = 50.0 + 50.0 * sin((d + 0) * 0.0174532925);
|
float value = 50.0 + 50.0 * sin((d + 0) * 0.0174532925);
|
||||||
|
|
||||||
float current;
|
float current;
|
||||||
mapValue(value, current, (float)0.0, (float)100.0, (float)0.0, (float)2.0);
|
current = mapValue(value, (float)0.0, (float)100.0, (float)0.0, (float)2.0);
|
||||||
//Serial.print("I = "); Serial.print(current);
|
//Serial.print("I = "); Serial.print(current);
|
||||||
amps.updateNeedle(current, 0);
|
amps.updateNeedle(current, 0);
|
||||||
|
|
||||||
float voltage;
|
float voltage;
|
||||||
mapValue(value, voltage, (float)0.0, (float)100.0, (float)0.0, (float)10.0);
|
voltage = mapValue(value, (float)0.0, (float)100.0, (float)0.0, (float)10.0);
|
||||||
//Serial.print(", V = "); Serial.println(voltage);
|
//Serial.print(", V = "); Serial.println(voltage);
|
||||||
volts.updateNeedle(voltage, 0);
|
volts.updateNeedle(voltage, 0);
|
||||||
|
|
||||||
float resistance;
|
float resistance;
|
||||||
mapValue(value, resistance, (float)0.0, (float)100.0, (float)0.0, (float)100.0);
|
resistance = mapValue(value, (float)0.0, (float)100.0, (float)0.0, (float)100.0);
|
||||||
//Serial.print(", R = "); Serial.println(resistance);
|
//Serial.print(", R = "); Serial.println(resistance);
|
||||||
ohms.updateNeedle(resistance, 0);
|
ohms.updateNeedle(resistance, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float mapValue(float ip, float ipmin, float ipmax, float tomin, float tomax)
|
||||||
|
{
|
||||||
|
return tomin + (((tomax - tomin) * (ip - ipmin))/ (ipmax - ipmin));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "2.4.74",
|
"version": "2.4.75",
|
||||||
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
|
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
|
||||||
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32",
|
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32",
|
||||||
"repository":
|
"repository":
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=2.4.74
|
version=2.4.75
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue