lilygo-t-hmi initial
This commit is contained in:
parent
d1cadd4345
commit
cd01c88f24
46
boards/lilygo-t-hmi.json
Normal file
46
boards/lilygo-t-hmi.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino":{
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"memory_type": "qio_opi",
|
||||||
|
"partitions": "default_16MB.csv"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DBOARD_HAS_PSRAM",
|
||||||
|
"-DARDUINO_USB_MODE=1"
|
||||||
|
],
|
||||||
|
"f_cpu": "240000000L",
|
||||||
|
"f_flash": "80000000L",
|
||||||
|
"flash_mode": "qio",
|
||||||
|
"hwids": [
|
||||||
|
[
|
||||||
|
"0X303A",
|
||||||
|
"0x1001"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"mcu": "esp32s3",
|
||||||
|
"variant": "esp32s3"
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"wifi",
|
||||||
|
"bluetooth"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"openocd_target": "esp32s3.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"espidf"
|
||||||
|
],
|
||||||
|
"name": "LILYGO T-HMI",
|
||||||
|
"upload": {
|
||||||
|
"flash_size": "16MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 16777216,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 921600
|
||||||
|
},
|
||||||
|
"url": "https://www.adafruit.com/product/5290",
|
||||||
|
"vendor": "LILYGO"
|
||||||
|
}
|
@ -137,8 +137,9 @@
|
|||||||
#ifdef NERMINER_S3_AMOLED
|
#ifdef NERMINER_S3_AMOLED
|
||||||
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> //Just a stub. No driver implementation for S3 AMOLED in TFT_eSPI
|
#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> //Just a stub. No driver implementation for S3 AMOLED in TFT_eSPI
|
||||||
#endif
|
#endif
|
||||||
//#include <User_Setups/Setup207_LilyGo_T_HMI.h> // For the LilyGo T-HMI S3 based ESP32S3 with ST7789 240 x 320 TFT
|
#ifdef NERDMINER_T_HMI
|
||||||
|
#include <User_Setups/Setup207_LilyGo_T_HMI.h> // For the LilyGo T-HMI S3 based ESP32S3 with ST7789 240 x 320 TFT
|
||||||
|
#endif
|
||||||
//#include <User_Setups/Setup208_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite (may also work with ESP32 S3 Box)
|
//#include <User_Setups/Setup208_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite (may also work with ESP32 S3 Box)
|
||||||
|
|
||||||
//#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
//#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
globallib_dir = lib
|
globallib_dir = lib
|
||||||
default_envs = NerminerV2 ; esp32cam, ESP32-2432S028R, NerminerV2, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-AMOLED, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, M5-StampS3
|
default_envs = NerminerV2 ; esp32cam, ESP32-2432S028R, NerminerV2, ESP32-devKitv1, NerminerV2-S3-DONGLE, NerminerV2-S3-AMOLED, NerminerV2-T-QT, NerdminerV2-T-Display_V1, ESP32-2432S028R, NerdminerV2-T-HMI, M5-StampS3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -238,6 +238,40 @@ lib_deps =
|
|||||||
|
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
|
|
||||||
|
[env:NerdminerV2-T-HMI]
|
||||||
|
platform = espressif32
|
||||||
|
board = lilygo-t-hmi
|
||||||
|
framework = arduino
|
||||||
|
board_build.partitions = default_16MB.csv
|
||||||
|
monitor_filters =
|
||||||
|
esp32_exception_decoder
|
||||||
|
time
|
||||||
|
log2file
|
||||||
|
|
||||||
|
monitor_speed = 115200
|
||||||
|
upload_speed = 921600
|
||||||
|
upload_port = /dev/ttyACM0
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-D ARDUINO_USB_MODE=1
|
||||||
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
|
-D BOARD_HAS_PSRAM
|
||||||
|
-D NERDMINER_T_HMI=1
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup207_LilyGo_T_HMI.h
|
||||||
|
|
||||||
|
board_build.arduino.memory_type = qio_opi
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/takkaO/OpenFontRender
|
||||||
|
bblanchon/ArduinoJson@^6.21.2
|
||||||
|
https://github.com/tzapu/WiFiManager.git#v2.0.16-rc.2
|
||||||
|
mathertel/OneButton @ ^2.0.3
|
||||||
|
arduino-libraries/NTPClient
|
||||||
|
bodmer/TFT_eSPI @ ^2.5.31
|
||||||
|
https://github.com/achillhasler/TFT_eTouch
|
||||||
|
|
||||||
|
;--------------------------------------------------------------------
|
||||||
|
|
||||||
[env:NerdminerV2-T-Display_V1]
|
[env:NerdminerV2-T-Display_V1]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = ttgo-lora32-v1
|
board = ttgo-lora32-v1
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#if defined(NERDMINERV2)
|
#if defined(NERDMINERV2)
|
||||||
#include "nerdMinerV2.h"
|
#include "nerdMinerV2.h"
|
||||||
|
#elif defined(M5STICK_C)
|
||||||
|
#include "M5Stick-C.h"
|
||||||
#elif defined(DEVKITV1)
|
#elif defined(DEVKITV1)
|
||||||
#include "esp32DevKit.h"
|
#include "esp32DevKit.h"
|
||||||
#elif defined(TDISPLAY)
|
#elif defined(TDISPLAY)
|
||||||
@ -21,9 +23,13 @@
|
|||||||
#include "esp32CAM.h"
|
#include "esp32CAM.h"
|
||||||
#elif defined(M5_STAMP_S3)
|
#elif defined(M5_STAMP_S3)
|
||||||
#include "m5StampS3.h"
|
#include "m5StampS3.h"
|
||||||
|
#elif defined(ESP32RGB)
|
||||||
|
#include "esp32RGB.h"
|
||||||
|
#elif defined(NERDMINER_T_HMI)
|
||||||
|
#include "lilygoT_HMI.h"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "No device defined"
|
#error "No device defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __DEVICE_H__
|
#endif // __DEVICE_H__
|
||||||
|
42
src/drivers/devices/lilygoT_HMI.h
Normal file
42
src/drivers/devices/lilygoT_HMI.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef _NERD_MINER_T_HMI_H
|
||||||
|
#define _NERD_MINER_T_HMI_H
|
||||||
|
|
||||||
|
#define T_HMI_DISPLAY
|
||||||
|
|
||||||
|
#define PWR_EN_PIN (10)
|
||||||
|
#define PWR_ON_PIN (14)
|
||||||
|
#define BAT_ADC_PIN (5)
|
||||||
|
#define BUTTON1_PIN (0)
|
||||||
|
#define BUTTON2_PIN (21)
|
||||||
|
|
||||||
|
#define PIN_BUTTON_1 BUTTON1_PIN
|
||||||
|
// #define PIN_BUTTON_2 BUTTON2_PIN
|
||||||
|
|
||||||
|
|
||||||
|
// touch screen
|
||||||
|
#define TOUCHSCREEN_SCLK_PIN (1)
|
||||||
|
#define TOUCHSCREEN_MISO_PIN (4)
|
||||||
|
#define TOUCHSCREEN_MOSI_PIN (3)
|
||||||
|
#define TOUCHSCREEN_CS_PIN (2)
|
||||||
|
#define TOUCHSCREEN_IRQ_PIN (9)
|
||||||
|
#define TOUCH_CLK TOUCHSCREEN_SCLK_PIN
|
||||||
|
#define TOUCH_MISO TOUCHSCREEN_MISO_PIN
|
||||||
|
#define TOUCH_MOSI TOUCHSCREEN_MOSI_PIN
|
||||||
|
#define ETOUCH_CS TOUCHSCREEN_CS_PIN
|
||||||
|
|
||||||
|
|
||||||
|
// lcd
|
||||||
|
#define PCLK_PIN (8)
|
||||||
|
#define CS_PIN (6)
|
||||||
|
#define DC_PIN (7)
|
||||||
|
#define RST_PIN (-1)
|
||||||
|
#define BK_LIGHT_PIN (38)
|
||||||
|
#define LED_PIN (8)
|
||||||
|
|
||||||
|
#ifndef TFT_BL
|
||||||
|
// XXX - defined in User_Setups/Setup207_LilyGo_T_HMI.h:37
|
||||||
|
#define TFT_BL (38) // LED back-light
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -4,6 +4,10 @@
|
|||||||
DisplayDriver *currentDisplayDriver = &noDisplayDriver;
|
DisplayDriver *currentDisplayDriver = &noDisplayDriver;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LED_DISPLAY
|
||||||
|
DisplayDriver *currentDisplayDriver = &ledDisplayDriver;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef T_DISPLAY
|
#ifdef T_DISPLAY
|
||||||
DisplayDriver *currentDisplayDriver = &tDisplayDriver;
|
DisplayDriver *currentDisplayDriver = &tDisplayDriver;
|
||||||
#endif
|
#endif
|
||||||
@ -28,6 +32,13 @@ DisplayDriver *currentDisplayDriver = &t_qtDisplayDriver;
|
|||||||
DisplayDriver *currentDisplayDriver = &tDisplayV1Driver;
|
DisplayDriver *currentDisplayDriver = &tDisplayV1Driver;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef M5STICKC_DISPLAY
|
||||||
|
DisplayDriver *currentDisplayDriver = &m5stickCDriver;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef T_HMI_DISPLAY
|
||||||
|
DisplayDriver *currentDisplayDriver = &t_hmiDisplayDriver;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize the display
|
// Initialize the display
|
||||||
void initDisplay()
|
void initDisplay()
|
||||||
|
@ -29,12 +29,15 @@ typedef struct
|
|||||||
extern DisplayDriver *currentDisplayDriver;
|
extern DisplayDriver *currentDisplayDriver;
|
||||||
|
|
||||||
extern DisplayDriver noDisplayDriver;
|
extern DisplayDriver noDisplayDriver;
|
||||||
|
extern DisplayDriver ledDisplayDriver;
|
||||||
extern DisplayDriver tDisplayDriver;
|
extern DisplayDriver tDisplayDriver;
|
||||||
extern DisplayDriver amoledDisplayDriver;
|
extern DisplayDriver amoledDisplayDriver;
|
||||||
extern DisplayDriver dongleDisplayDriver;
|
extern DisplayDriver dongleDisplayDriver;
|
||||||
extern DisplayDriver esp32_2432S028RDriver;
|
extern DisplayDriver esp32_2432S028RDriver;
|
||||||
extern DisplayDriver t_qtDisplayDriver;
|
extern DisplayDriver t_qtDisplayDriver;
|
||||||
extern DisplayDriver tDisplayV1Driver;
|
extern DisplayDriver tDisplayV1Driver;
|
||||||
|
extern DisplayDriver m5stickCDriver;
|
||||||
|
extern DisplayDriver t_hmiDisplayDriver;
|
||||||
|
|
||||||
#define SCREENS_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
#define SCREENS_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||||
|
|
||||||
|
355
src/drivers/displays/t_hmiDisplayDriver.cpp
Normal file
355
src/drivers/displays/t_hmiDisplayDriver.cpp
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
#include "displayDriver.h"
|
||||||
|
|
||||||
|
#ifdef T_HMI_DISPLAY
|
||||||
|
|
||||||
|
#include <TFT_eSPI.h>
|
||||||
|
#include <TFT_eTouch.h>
|
||||||
|
#include "media/images_320_170.h"
|
||||||
|
#include "media/images_bottom_320_70.h"
|
||||||
|
#include "media/myFonts.h"
|
||||||
|
#include "media/Free_Fonts.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "monitor.h"
|
||||||
|
#include "OpenFontRender.h"
|
||||||
|
|
||||||
|
#define WIDTH 320
|
||||||
|
#define HEIGHT 240
|
||||||
|
|
||||||
|
OpenFontRender render;
|
||||||
|
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
|
||||||
|
TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite
|
||||||
|
|
||||||
|
|
||||||
|
SPIClass hSPI(HSPI);
|
||||||
|
TFT_eTouch<TFT_eSPI> touch(tft, ETOUCH_CS, 0xFF, hSPI);
|
||||||
|
bool showbtcprice = false;
|
||||||
|
|
||||||
|
extern monitor_data mMonitor;
|
||||||
|
extern pool_data pData;
|
||||||
|
extern DisplayDriver *currentDisplayDriver;
|
||||||
|
|
||||||
|
|
||||||
|
void t_hmiDisplay_Init(void)
|
||||||
|
{
|
||||||
|
tft.init();
|
||||||
|
tft.setRotation(1);
|
||||||
|
tft.setSwapBytes(true); // Swap the colour byte order when rendering
|
||||||
|
background.createSprite(WIDTH,HEIGHT); // Background Sprite
|
||||||
|
background.setSwapBytes(true);
|
||||||
|
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||||
|
render.setLineSpaceRatio(0.9);
|
||||||
|
// Load the font and check it can be read OK
|
||||||
|
// if (render.loadFont(NotoSans_Bold, sizeof(NotoSans_Bold))) {
|
||||||
|
if (render.loadFont(DigitalNumbers, sizeof(DigitalNumbers)))
|
||||||
|
{
|
||||||
|
Serial.println("Initialise error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* XXX - Pass for first version
|
||||||
|
Serial.println(F("Initialize the touch screen"));
|
||||||
|
hSPI.begin(TOUCH_CLK, TOUCH_MISO, TOUCH_MOSI, ETOUCH_CS);
|
||||||
|
TFT_eTouchBase::Calibation calibation = { 233, 3785, 3731, 120, 2 };
|
||||||
|
touch.setCalibration(calibation);
|
||||||
|
*/
|
||||||
|
Serial.println(F("Power on peripherals, such as the LCD backlight"));
|
||||||
|
pinMode(PWR_EN_PIN, OUTPUT);
|
||||||
|
digitalWrite(PWR_EN_PIN, HIGH);
|
||||||
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
pData.bestDifficulty = "0";
|
||||||
|
pData.workersHash = "0";
|
||||||
|
pData.workersCount = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_AlternateScreenState(void)
|
||||||
|
{
|
||||||
|
int screen_state = digitalRead(TFT_BL);
|
||||||
|
Serial.println("Switching display state");
|
||||||
|
digitalWrite(TFT_BL, !screen_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_AlternateRotation(void)
|
||||||
|
{
|
||||||
|
tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printPoolData()
|
||||||
|
{
|
||||||
|
// Serial.print("\nPool ============ Free Heap:");
|
||||||
|
// Serial.println(ESP.getFreeHeap());
|
||||||
|
pData = getPoolData();
|
||||||
|
|
||||||
|
background.pushImage(0, 170, 320, 70, bottonPoolScreen);
|
||||||
|
render.setLineSpaceRatio(1);
|
||||||
|
|
||||||
|
render.setFontSize(24);
|
||||||
|
render.drawString(String(pData.workersCount).c_str(), 146, 170+35, TFT_BLACK);
|
||||||
|
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.drawString(pData.workersHash.c_str(), 216, 170+34, TFT_BLACK);
|
||||||
|
render.drawString(pData.bestDifficulty.c_str(), 5, 170+34, TFT_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void printMemPoolFees(unsigned long mElapsed)
|
||||||
|
{
|
||||||
|
// Serial.print("\nFees ============ Free Heap:");
|
||||||
|
// Serial.println(ESP.getFreeHeap());
|
||||||
|
|
||||||
|
coin_data data = getCoinData(mElapsed);
|
||||||
|
|
||||||
|
render.setFontSize(18);
|
||||||
|
background.pushImage(0, 170, 320, 70, bottomMemPoolFees);
|
||||||
|
if (showbtcprice)
|
||||||
|
{
|
||||||
|
// XXX -- remove when bitmap is done
|
||||||
|
background.fillRect( 105, 170, 110, 20, TFT_BLACK);
|
||||||
|
|
||||||
|
String st = data.btcPrice;
|
||||||
|
if (st.length()) st.remove(st.length()-1);
|
||||||
|
render.drawString(st.c_str(), 125, 170, TFT_WHITE);
|
||||||
|
}
|
||||||
|
render.drawString(data.economyFee.c_str(), 140, 170+38, TFT_BLACK);
|
||||||
|
|
||||||
|
render.setFontSize(18);
|
||||||
|
// XXX - less than sign in DigitalNumbers
|
||||||
|
// render.drawChar('<', 245, 170+32, TFT_RED);
|
||||||
|
render.drawString(data.minimumFee.c_str(), 250, 170+32, TFT_RED);
|
||||||
|
render.drawString(data.fastestFee.c_str(), 30, 170+32, TFT_BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_MinerScreen(unsigned long mElapsed)
|
||||||
|
{
|
||||||
|
mining_data data = getMiningData(mElapsed);
|
||||||
|
background.pushImage(0, 0, MinerWidth, 170, MinerScreen);
|
||||||
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
// Hashrate
|
||||||
|
render.setFontSize(35);
|
||||||
|
render.setCursor(19, 118);
|
||||||
|
render.setFontColor(TFT_BLACK);
|
||||||
|
render.rdrawString(data.currentHashRate.c_str(), 118, 114, TFT_BLACK);
|
||||||
|
|
||||||
|
// Total hashes
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.rdrawString(data.totalMHashes.c_str(), 268, 138, TFT_BLACK);
|
||||||
|
// Block templates
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.drawString(data.templates.c_str(), 186, 20, 0xDEDB);
|
||||||
|
// Best diff
|
||||||
|
render.drawString(data.bestDiff.c_str(), 186, 48, 0xDEDB);
|
||||||
|
// 32Bit shares
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.drawString(data.completedShares.c_str(), 186, 76, 0xDEDB);
|
||||||
|
// Hores
|
||||||
|
render.setFontSize(14);
|
||||||
|
render.rdrawString(data.timeMining.c_str(), 315, 104, 0xDEDB);
|
||||||
|
|
||||||
|
// Valid Blocks
|
||||||
|
render.setFontSize(24);
|
||||||
|
render.drawString(data.valids.c_str(), 285, 56, 0xDEDB);
|
||||||
|
|
||||||
|
// Print Temp
|
||||||
|
render.setFontSize(10);
|
||||||
|
render.rdrawString(data.temp.c_str(), 239, 1, TFT_BLACK);
|
||||||
|
|
||||||
|
render.setFontSize(4);
|
||||||
|
render.rdrawString(String(0).c_str(), 244, 3, TFT_BLACK);
|
||||||
|
|
||||||
|
// Print Hour
|
||||||
|
render.setFontSize(10);
|
||||||
|
render.rdrawString(data.currentTime.c_str(), 286, 1, TFT_BLACK);
|
||||||
|
|
||||||
|
printPoolData();
|
||||||
|
// Push prepared background to screen
|
||||||
|
background.pushSprite(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_ClockScreen(unsigned long mElapsed)
|
||||||
|
{
|
||||||
|
clock_data data = getClockData(mElapsed);
|
||||||
|
|
||||||
|
// Print background screen
|
||||||
|
background.pushImage(0, 0, minerClockWidth, 170 /*minerClockHeight*/, minerClockScreen);
|
||||||
|
|
||||||
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
|
||||||
|
// Hashrate
|
||||||
|
render.setFontSize(25);
|
||||||
|
render.setCursor(19, 122);
|
||||||
|
render.setFontColor(TFT_BLACK);
|
||||||
|
render.rdrawString(data.currentHashRate.c_str(), 94, 129, TFT_BLACK);
|
||||||
|
|
||||||
|
// Print BTC Price
|
||||||
|
background.setFreeFont(FSSB9);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextColor(TFT_BLACK);
|
||||||
|
background.drawString(data.btcPrice.c_str(), 202, 3, GFXFF);
|
||||||
|
|
||||||
|
// Print BlockHeight
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.rdrawString(data.blockHeight.c_str(), 254, 140, TFT_BLACK);
|
||||||
|
|
||||||
|
// Print Hour
|
||||||
|
background.setFreeFont(FF23);
|
||||||
|
background.setTextSize(2);
|
||||||
|
background.setTextColor(0xDEDB, TFT_BLACK);
|
||||||
|
|
||||||
|
background.drawString(data.currentTime.c_str(), 130, 50, GFXFF);
|
||||||
|
printMemPoolFees(mElapsed);
|
||||||
|
// Push prepared background to screen
|
||||||
|
background.pushSprite(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_GlobalHashScreen(unsigned long mElapsed)
|
||||||
|
{
|
||||||
|
coin_data data = getCoinData(mElapsed);
|
||||||
|
|
||||||
|
// Print background screen
|
||||||
|
background.pushImage(0, 0, globalHashWidth, 170 /* globalHashHeight */, globalHashScreen);
|
||||||
|
|
||||||
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
|
||||||
|
// Print BTC Price
|
||||||
|
background.setFreeFont(FSSB9);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextColor(TFT_BLACK);
|
||||||
|
background.drawString(data.btcPrice.c_str(), 198, 3, GFXFF);
|
||||||
|
|
||||||
|
// Print Hour
|
||||||
|
background.setFreeFont(FSSB9);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextColor(TFT_BLACK);
|
||||||
|
background.drawString(data.currentTime.c_str(), 268, 3, GFXFF);
|
||||||
|
|
||||||
|
// Print Last Pool Block
|
||||||
|
background.setFreeFont(FSS9);
|
||||||
|
background.setTextDatum(TR_DATUM);
|
||||||
|
background.setTextColor(0x9C92);
|
||||||
|
background.drawString(data.halfHourFee.c_str(), 302, 52, GFXFF);
|
||||||
|
|
||||||
|
// Print Difficulty
|
||||||
|
background.setFreeFont(FSS9);
|
||||||
|
background.setTextDatum(TR_DATUM);
|
||||||
|
background.setTextColor(0x9C92);
|
||||||
|
background.drawString(data.netwrokDifficulty.c_str(), 302, 88, GFXFF);
|
||||||
|
|
||||||
|
// Print Global Hashrate
|
||||||
|
render.setFontSize(17);
|
||||||
|
render.rdrawString(data.globalHashRate.c_str(), 274, 145, TFT_BLACK);
|
||||||
|
|
||||||
|
// Print BlockHeight
|
||||||
|
render.setFontSize(28);
|
||||||
|
render.rdrawString(data.blockHeight.c_str(), 140, 104, 0xDEDB);
|
||||||
|
|
||||||
|
// Draw percentage rectangle
|
||||||
|
int x2 = 2 + (138 * data.progressPercent / 100);
|
||||||
|
background.fillRect(2, 149, x2, 168, 0xDEDB);
|
||||||
|
|
||||||
|
// Print Remaining BLocks
|
||||||
|
background.setTextFont(FONT2);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextDatum(MC_DATUM);
|
||||||
|
background.setTextColor(TFT_BLACK);
|
||||||
|
background.drawString(data.remainingBlocks.c_str(), 72, 159, FONT2);
|
||||||
|
|
||||||
|
printMemPoolFees(mElapsed);
|
||||||
|
// Push prepared background to screen
|
||||||
|
background.pushSprite(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void t_hmiDisplay_BTCprice(unsigned long mElapsed)
|
||||||
|
{
|
||||||
|
clock_data data = getClockData(mElapsed);
|
||||||
|
|
||||||
|
// Print background screen
|
||||||
|
background.pushImage(0, 0, priceScreenWidth, 170 /*priceScreenHeight*/, priceScreen);
|
||||||
|
|
||||||
|
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||||
|
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||||
|
|
||||||
|
// Hashrate
|
||||||
|
render.setFontSize(25);
|
||||||
|
render.setCursor(19, 122);
|
||||||
|
render.setFontColor(TFT_BLACK);
|
||||||
|
render.rdrawString(data.currentHashRate.c_str(), 94, 129, TFT_BLACK);
|
||||||
|
|
||||||
|
// Print BlockHeight
|
||||||
|
render.setFontSize(18);
|
||||||
|
render.rdrawString(data.blockHeight.c_str(), 254, 138, TFT_WHITE);
|
||||||
|
|
||||||
|
// Print Hour
|
||||||
|
|
||||||
|
background.setFreeFont(FSSB9);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextDatum(TL_DATUM);
|
||||||
|
background.setTextColor(TFT_BLACK);
|
||||||
|
background.drawString(data.currentTime.c_str(), 222, 3, GFXFF);
|
||||||
|
|
||||||
|
// Print BTC Price
|
||||||
|
background.setFreeFont(FF24);
|
||||||
|
background.setTextDatum(TR_DATUM);
|
||||||
|
background.setTextSize(1);
|
||||||
|
background.setTextColor(0xDEDB, TFT_BLACK);
|
||||||
|
background.drawString(data.btcPrice.c_str(), 300, 58, GFXFF);
|
||||||
|
printPoolData();
|
||||||
|
// Push prepared background to screen
|
||||||
|
background.pushSprite(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void t_hmiDisplay_LoadingScreen(void)
|
||||||
|
{
|
||||||
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
// tft.pushImage(0, 0, initWidth, initHeight, initScreen);
|
||||||
|
tft.pushImage(0, 0, initWidth, initHeight, initScreen);
|
||||||
|
tft.setTextColor(TFT_BLACK);
|
||||||
|
tft.drawString(CURRENT_VERSION, 24, 147, FONT2);
|
||||||
|
delay(2000);
|
||||||
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
// tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
||||||
|
tft.pushImage(0, 0, initWidth, 170, MinerScreen);
|
||||||
|
tft.pushImage(0, 170, initWidth, 70, bottonPoolScreen);
|
||||||
|
if (showbtcprice)
|
||||||
|
{
|
||||||
|
// blackout title
|
||||||
|
tft.fillRect( 105, 170, 110, 20, TFT_BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void t_hmiDisplay_SetupScreen(void)
|
||||||
|
{
|
||||||
|
tft.pushImage(0, 0, setupModeWidth, setupModeHeight, setupModeScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_AnimateCurrentScreen(unsigned long frame)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void t_hmiDisplay_DoLedStuff(unsigned long frame)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CyclicScreenFunction t_hmiDisplayCyclicScreens[] = {t_hmiDisplay_MinerScreen, t_hmiDisplay_ClockScreen, t_hmiDisplay_GlobalHashScreen, t_hmiDisplay_BTCprice};
|
||||||
|
|
||||||
|
DisplayDriver t_hmiDisplayDriver = {
|
||||||
|
t_hmiDisplay_Init,
|
||||||
|
t_hmiDisplay_AlternateScreenState,
|
||||||
|
t_hmiDisplay_AlternateRotation,
|
||||||
|
t_hmiDisplay_LoadingScreen,
|
||||||
|
t_hmiDisplay_SetupScreen,
|
||||||
|
t_hmiDisplayCyclicScreens,
|
||||||
|
t_hmiDisplay_AnimateCurrentScreen,
|
||||||
|
t_hmiDisplay_DoLedStuff,
|
||||||
|
SCREENS_ARRAY_SIZE(t_hmiDisplayCyclicScreens),
|
||||||
|
0,
|
||||||
|
WIDTH,
|
||||||
|
HEIGHT};
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -91,7 +91,12 @@ void updateGlobalData(void){
|
|||||||
deserializeJson(doc, payload);
|
deserializeJson(doc, payload);
|
||||||
String temp = "";
|
String temp = "";
|
||||||
if (doc.containsKey("halfHourFee")) gData.halfHourFee = doc["halfHourFee"].as<int>();
|
if (doc.containsKey("halfHourFee")) gData.halfHourFee = doc["halfHourFee"].as<int>();
|
||||||
|
#ifdef NERDMINER_T_HMI
|
||||||
|
if (doc.containsKey("fastestFee")) gData.fastestFee = doc["fastestFee"].as<int>();
|
||||||
|
if (doc.containsKey("hourFee")) gData.hourFee = doc["hourFee"].as<int>();
|
||||||
|
if (doc.containsKey("economyFee")) gData.economyFee = doc["economyFee"].as<int>();
|
||||||
|
if (doc.containsKey("minimumFee")) gData.minimumFee = doc["minimumFee"].as<int>();
|
||||||
|
#endif
|
||||||
doc.clear();
|
doc.clear();
|
||||||
|
|
||||||
mGlobalUpdate = millis();
|
mGlobalUpdate = millis();
|
||||||
@ -293,6 +298,12 @@ coin_data getCoinData(unsigned long mElapsed)
|
|||||||
data.currentHashRate = getCurrentHashRate(mElapsed);
|
data.currentHashRate = getCurrentHashRate(mElapsed);
|
||||||
data.btcPrice = getBTCprice();
|
data.btcPrice = getBTCprice();
|
||||||
data.currentTime = getTime();
|
data.currentTime = getTime();
|
||||||
|
#ifdef NERDMINER_T_HMI
|
||||||
|
data.hourFee = String(gData.hourFee);
|
||||||
|
data.fastestFee = String(gData.fastestFee);
|
||||||
|
data.economyFee = String(gData.economyFee);
|
||||||
|
data.minimumFee = String(gData.minimumFee);
|
||||||
|
#endif
|
||||||
data.halfHourFee = String(gData.halfHourFee) + " sat/vB";
|
data.halfHourFee = String(gData.halfHourFee) + " sat/vB";
|
||||||
data.netwrokDifficulty = gData.difficulty;
|
data.netwrokDifficulty = gData.difficulty;
|
||||||
data.globalHashRate = gData.globalHash;
|
data.globalHashRate = gData.globalHash;
|
||||||
|
@ -54,6 +54,12 @@ typedef struct{
|
|||||||
float progressPercent;
|
float progressPercent;
|
||||||
int remainingBlocks;
|
int remainingBlocks;
|
||||||
int halfHourFee;
|
int halfHourFee;
|
||||||
|
#ifdef NERDMINER_T_HMI
|
||||||
|
int fastestFee;
|
||||||
|
int hourFee;
|
||||||
|
int economyFee;
|
||||||
|
int minimumFee;
|
||||||
|
#endif
|
||||||
}global_data;
|
}global_data;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -94,6 +100,12 @@ typedef struct {
|
|||||||
String btcPrice;
|
String btcPrice;
|
||||||
String currentTime;
|
String currentTime;
|
||||||
String halfHourFee;
|
String halfHourFee;
|
||||||
|
#ifdef NERDMINER_T_HMI
|
||||||
|
String hourFee;
|
||||||
|
String fastestFee;
|
||||||
|
String economyFee;
|
||||||
|
String minimumFee;
|
||||||
|
#endif
|
||||||
String netwrokDifficulty;
|
String netwrokDifficulty;
|
||||||
String globalHashRate;
|
String globalHashRate;
|
||||||
String blockHeight;
|
String blockHeight;
|
||||||
@ -107,13 +119,15 @@ typedef struct{
|
|||||||
String bestDifficulty; // Your miners best difficulty
|
String bestDifficulty; // Your miners best difficulty
|
||||||
}pool_data;
|
}pool_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setup_monitor(void);
|
void setup_monitor(void);
|
||||||
|
|
||||||
mining_data getMiningData(unsigned long mElapsed);
|
mining_data getMiningData(unsigned long mElapsed);
|
||||||
clock_data getClockData(unsigned long mElapsed);
|
clock_data getClockData(unsigned long mElapsed);
|
||||||
coin_data getCoinData(unsigned long mElapsed);
|
coin_data getCoinData(unsigned long mElapsed);
|
||||||
pool_data getPoolData(void);
|
pool_data getPoolData(void);
|
||||||
|
|
||||||
clock_data_t getClockData_t(unsigned long mElapsed);
|
clock_data_t getClockData_t(unsigned long mElapsed);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user