Touch, Sprites fix to small heap, Suffix adj.
This commit is contained in:
parent
25db0a45a6
commit
43cbaf75cb
@ -170,8 +170,8 @@ upload_speed = 921600
|
||||
;build_type = debug
|
||||
board_build.partitions = huge_app.csv
|
||||
build_flags =
|
||||
;-DDEBUG_MEMORY=1
|
||||
-D ESP32_2432S028R=1
|
||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||
-DUSER_SETUP_LOADED=1
|
||||
-DILI9341_2_DRIVER=1
|
||||
-DTFT_WIDTH=240
|
||||
@ -183,7 +183,11 @@ build_flags =
|
||||
-DTFT_DC=2
|
||||
-DTFT_RST=12
|
||||
-DTFT_BL=21
|
||||
-DTOUCH_CS=33
|
||||
-DETOUCH_CS=33
|
||||
-DTOUCH_CLK=25
|
||||
-DTOUCH_MISO=39
|
||||
-DTOUCH_MOSI=32
|
||||
-DTOUCH_IRQ=36
|
||||
-DLOAD_GLCD=1
|
||||
-DLOAD_FONT2=1
|
||||
-DLOAD_GFXFF=1
|
||||
@ -198,6 +202,7 @@ lib_deps =
|
||||
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]
|
||||
platform = espressif32
|
||||
|
@ -3,6 +3,7 @@
|
||||
#ifdef ESP32_2432S028R
|
||||
|
||||
#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"
|
||||
@ -10,39 +11,52 @@
|
||||
#include "version.h"
|
||||
#include "monitor.h"
|
||||
#include "OpenFontRender.h"
|
||||
#include <SPI.h>
|
||||
|
||||
#define WIDTH 340
|
||||
#define HEIGHT 240
|
||||
#define WIDTH 130 //320
|
||||
#define HEIGHT 170
|
||||
|
||||
OpenFontRender render;
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in platformio.ini
|
||||
TFT_eSprite background = TFT_eSprite(&tft); // Invoke library sprite
|
||||
SPIClass hSPI(HSPI);
|
||||
TFT_eTouch<TFT_eSPI> touch(tft, ETOUCH_CS, 0xFF, hSPI);
|
||||
|
||||
extern monitor_data mMonitor;
|
||||
extern pool_data pData;
|
||||
extern DisplayDriver *currentDisplayDriver;
|
||||
|
||||
bool hasChangedScreen = true;
|
||||
|
||||
void esp32_2432S028R_Init(void)
|
||||
{
|
||||
tft.init();
|
||||
tft.setRotation(1);
|
||||
tft.setSwapBytes(true); // Swap the colour byte order when rendering
|
||||
tft.setSwapBytes(true); // Swap the colour byte order when rendering
|
||||
hSPI.begin(TOUCH_CLK, TOUCH_MISO, TOUCH_MOSI, ETOUCH_CS);
|
||||
touch.init();
|
||||
|
||||
TFT_eTouchBase::Calibation calibation = { 233, 3785, 3731, 120, 2 };
|
||||
touch.setCalibration(calibation);
|
||||
|
||||
//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); // Espaciado entre texto
|
||||
|
||||
// Load the font and check it can be read OK
|
||||
// if (render.loadFont(NotoSans_Bold, sizeof(NotoSans_Bold))) {
|
||||
// if (render.loadFont(NotoSans_Bold, sizeof(NotoSans_Bold)))
|
||||
if (render.loadFont(DigitalNumbers, sizeof(DigitalNumbers)))
|
||||
{
|
||||
Serial.println("Initialise error");
|
||||
return;
|
||||
}
|
||||
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
pData.bestDifficulty = "0";
|
||||
pData.workersHash = "0";
|
||||
pData.workersCount = 0;
|
||||
|
||||
//Serial.println("=========== Fim Display ==============") ;
|
||||
}
|
||||
|
||||
void esp32_2432S028R_AlternateScreenState(void)
|
||||
@ -55,15 +69,21 @@ void esp32_2432S028R_AlternateScreenState(void)
|
||||
void esp32_2432S028R_AlternateRotation(void)
|
||||
{
|
||||
tft.getRotation() == 1 ? tft.setRotation(3) : tft.setRotation(1);
|
||||
hasChangedScreen = true;
|
||||
}
|
||||
|
||||
bool bottomScreenBlue = true;
|
||||
|
||||
void printPoolData(){
|
||||
|
||||
pData = updatePoolData();
|
||||
pData = getPoolData();
|
||||
background.createSprite(320,70); //Background Sprite
|
||||
background.setSwapBytes(true);
|
||||
background.pushImage(0, 0, 320, 70, bottonPoolScreen);
|
||||
|
||||
if (bottomScreenBlue) {
|
||||
background.pushImage(0, 0, 320, 70, bottonPoolScreen);
|
||||
} else {
|
||||
background.pushImage(0, 0, 320, 70, bottonPoolScreen_g);
|
||||
}
|
||||
//background.setTextDatum(MC_DATUM);
|
||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||
render.setLineSpaceRatio(1);
|
||||
@ -80,19 +100,76 @@ void printPoolData(){
|
||||
background.deleteSprite();
|
||||
}
|
||||
|
||||
void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||
{
|
||||
mining_data data = getMiningData(mElapsed);
|
||||
void printheap(){
|
||||
//Serial.print("============ Free Heap:");
|
||||
//Serial.println(ESP.getFreeHeap());
|
||||
}
|
||||
|
||||
// Create background sprite to print data at once
|
||||
background.createSprite(initWidth,initHeight); //Background Sprite
|
||||
void createBackgroundSprite(int16_t wdt, int16_t hgt){ // Set the background and link the render, used multiple times to fit in heap
|
||||
background.createSprite(wdt, hgt) ; //Background Sprite
|
||||
printheap();
|
||||
background.setColorDepth(16);
|
||||
background.setSwapBytes(true);
|
||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||
render.setLineSpaceRatio(0.9);
|
||||
}
|
||||
|
||||
void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||
{
|
||||
if (hasChangedScreen) tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
||||
hasChangedScreen = false;
|
||||
|
||||
mining_data data = getMiningData(mElapsed);
|
||||
|
||||
//Serial.println("Proximo sprite...");
|
||||
int wdtOffset = 190;
|
||||
// Recreate sprite to the right side of the screen
|
||||
createBackgroundSprite(WIDTH-5, HEIGHT-7);
|
||||
//Print background screen
|
||||
background.pushImage(0, 0, MinerWidth, MinerHeight, MinerScreen);
|
||||
background.pushImage(-190, 0, MinerWidth, MinerHeight, MinerScreen);
|
||||
|
||||
// Total hashes
|
||||
render.setFontSize(18);
|
||||
render.rdrawString(data.totalMHashes.c_str(), 268-wdtOffset, 138, TFT_BLACK);
|
||||
// Block templates
|
||||
render.setFontSize(18);
|
||||
render.drawString(data.templates.c_str(), 189-wdtOffset, 20, 0xDEDB);
|
||||
// Best diff
|
||||
render.drawString(data.bestDiff.c_str(), 189-wdtOffset, 48, 0xDEDB);
|
||||
// 32Bit shares
|
||||
render.setFontSize(18);
|
||||
render.drawString(data.completedShares.c_str(), 189-wdtOffset, 76, 0xDEDB);
|
||||
// Hores
|
||||
render.setFontSize(14);
|
||||
render.rdrawString(data.timeMining.c_str(), 315-wdtOffset, 104, 0xDEDB);
|
||||
|
||||
// Valid Blocks
|
||||
render.setFontSize(24);
|
||||
render.drawString(data.valids.c_str(), 285-wdtOffset, 56, 0xDEDB);
|
||||
|
||||
// Print Temp
|
||||
render.setFontSize(10);
|
||||
render.rdrawString(data.temp.c_str(), 239-wdtOffset, 1, TFT_BLACK);
|
||||
|
||||
render.setFontSize(4);
|
||||
render.rdrawString(String(0).c_str(), 244-wdtOffset, 3, TFT_BLACK);
|
||||
|
||||
// Print Hour
|
||||
render.setFontSize(10);
|
||||
render.rdrawString(data.currentTime.c_str(), 286-wdtOffset, 1, TFT_BLACK);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(190, 0);
|
||||
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
printheap();
|
||||
|
||||
//Serial.println("=========== Mining Display ==============") ;
|
||||
// Create background sprite to print data at once
|
||||
createBackgroundSprite(WIDTH-7, HEIGHT-100); // initHeight); //Background Sprite
|
||||
//Print background screen
|
||||
background.pushImage(0, -90, MinerWidth, MinerHeight, 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());
|
||||
@ -101,97 +178,72 @@ void esp32_2432S028R_MinerScreen(unsigned long mElapsed)
|
||||
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);
|
||||
render.rdrawString(data.currentHashRate.c_str(), 118, 114-90, TFT_BLACK);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
background.pushSprite(0, 90);
|
||||
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
//delay(50);
|
||||
|
||||
#ifdef ESP32_2432S028R
|
||||
printPoolData();
|
||||
#endif
|
||||
printPoolData();
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
// Print heap
|
||||
printheap();
|
||||
// Print heap
|
||||
printheap();
|
||||
#endif
|
||||
}
|
||||
|
||||
void esp32_2432S028R_ClockScreen(unsigned long mElapsed)
|
||||
{
|
||||
|
||||
if (hasChangedScreen) tft.pushImage(0, 0, minerClockWidth, minerClockHeight, minerClockScreen);
|
||||
hasChangedScreen = false;
|
||||
|
||||
clock_data data = getClockData(mElapsed);
|
||||
|
||||
// Create background sprite to print data at once
|
||||
background.createSprite(initWidth,initHeight); //Background Sprite
|
||||
background.setColorDepth(16);
|
||||
background.setSwapBytes(true);
|
||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||
render.setLineSpaceRatio(0.9);
|
||||
|
||||
// Print background screen
|
||||
background.pushImage(0, 0, minerClockWidth, 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());
|
||||
|
||||
// Create background sprite to print data at once
|
||||
createBackgroundSprite(270,36);
|
||||
|
||||
// Print background screen
|
||||
background.pushImage(0, -130, minerClockWidth, minerClockHeight, minerClockScreen);
|
||||
// Hashrate
|
||||
render.setFontSize(25);
|
||||
render.setCursor(19, 122);
|
||||
render.setFontColor(TFT_BLACK);
|
||||
render.rdrawString(data.currentHashRate.c_str(), 94, 129, TFT_BLACK);
|
||||
render.rdrawString(data.currentHashRate.c_str(), 95, 0, TFT_BLACK);
|
||||
|
||||
// Print BlockHeight
|
||||
render.setFontSize(18);
|
||||
render.rdrawString(data.blockHeight.c_str(), 254, 9, TFT_BLACK);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 130);
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
|
||||
createBackgroundSprite(169,105);
|
||||
// Print background screen
|
||||
background.pushImage(-130, -3, minerClockWidth, minerClockHeight, minerClockScreen);
|
||||
|
||||
// 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);
|
||||
background.drawString(data.btcPrice.c_str(), 202-130, 0, GFXFF);
|
||||
|
||||
// Print Hour
|
||||
background.setFreeFont(FF23);
|
||||
background.setTextSize(2);
|
||||
background.setTextColor(0xDEDB, TFT_BLACK);
|
||||
|
||||
background.drawString(data.currentTime.c_str(), 130, 50, GFXFF);
|
||||
background.drawString(data.currentTime.c_str(), 0, 50, GFXFF);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
background.pushSprite(130, 3);
|
||||
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
@ -208,17 +260,15 @@ void esp32_2432S028R_ClockScreen(unsigned long mElapsed)
|
||||
|
||||
void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
||||
{
|
||||
if (hasChangedScreen) tft.pushImage(0, 0, globalHashWidth, globalHashHeight, globalHashScreen);
|
||||
hasChangedScreen = false;
|
||||
coin_data data = getCoinData(mElapsed);
|
||||
|
||||
// Create background sprite to print data at once
|
||||
background.createSprite(initWidth,initHeight); //Background Sprite
|
||||
background.setColorDepth(16);
|
||||
background.setSwapBytes(true);
|
||||
render.setDrawer(background); // Link drawing object to background instance (so font will be rendered on background)
|
||||
render.setLineSpaceRatio(0.9);
|
||||
|
||||
createBackgroundSprite(169,105);
|
||||
// Print background screen
|
||||
background.pushImage(0, 0, globalHashWidth, globalHashHeight, globalHashScreen);
|
||||
background.pushImage(-160, -3, minerClockWidth, minerClockHeight, globalHashScreen);
|
||||
//background.fillScreen(TFT_BLUE);
|
||||
|
||||
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());
|
||||
@ -228,52 +278,68 @@ void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
||||
background.setTextSize(1);
|
||||
background.setTextDatum(TL_DATUM);
|
||||
background.setTextColor(TFT_BLACK);
|
||||
background.drawString(data.btcPrice.c_str(), 198, 3, GFXFF);
|
||||
|
||||
background.drawString(data.btcPrice.c_str(), 198-160, 0, 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);
|
||||
background.drawString(data.currentTime.c_str(), 268-160, 0, GFXFF);
|
||||
|
||||
// Print Last Pool Block
|
||||
background.setFreeFont(FSS9);
|
||||
background.setTextDatum(TR_DATUM);
|
||||
background.setTextColor(0x9C92);
|
||||
background.drawString(data.halfHourFee.c_str(), 302, 52, GFXFF);
|
||||
background.drawString(data.halfHourFee.c_str(), 302-160, 49, GFXFF);
|
||||
|
||||
// Print Difficulty
|
||||
background.setFreeFont(FSS9);
|
||||
background.setTextDatum(TR_DATUM);
|
||||
background.setTextColor(0x9C92);
|
||||
background.drawString(data.netwrokDifficulty.c_str(), 302, 88, GFXFF);
|
||||
background.drawString(data.netwrokDifficulty.c_str(), 302-160, 85, GFXFF);
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(160, 3);
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
|
||||
// Create background sprite to print data at once
|
||||
createBackgroundSprite(280,30);
|
||||
// Print background screen
|
||||
background.pushImage(0, -139, minerClockWidth, minerClockHeight, globalHashScreen);
|
||||
//background.fillSprite(TFT_CYAN);
|
||||
// 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);
|
||||
render.rdrawString(data.globalHashRate.c_str(), 274, 145-139, TFT_BLACK);
|
||||
|
||||
// Draw percentage rectangle
|
||||
int x2 = 2 + (138 * data.progressPercent / 100);
|
||||
background.fillRect(2, 149, x2, 168, 0xDEDB);
|
||||
background.fillRect(2, 149-139, 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);
|
||||
background.drawString(data.remainingBlocks.c_str(), 72, 159-139, FONT2);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
|
||||
background.pushSprite(0, 139);
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
|
||||
// Create background sprite to print data at once
|
||||
createBackgroundSprite(140,40);
|
||||
// Print background screen
|
||||
background.pushImage(-5, -100, minerClockWidth, minerClockHeight, globalHashScreen);
|
||||
//background.fillSprite(TFT_CYAN);
|
||||
// Print BlockHeight
|
||||
render.setFontSize(28);
|
||||
render.rdrawString(data.blockHeight.c_str(), 140-5, 104-100, 0xDEDB);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(5, 100);
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
#ifdef ESP32_2432S028R
|
||||
printPoolData();
|
||||
#endif
|
||||
@ -292,6 +358,7 @@ void esp32_2432S028R_LoadingScreen(void)
|
||||
tft.drawString(CURRENT_VERSION, 24, 147, FONT2);
|
||||
delay(2000);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.pushImage(0, 0, initWidth, initHeight, MinerScreen);
|
||||
}
|
||||
|
||||
void esp32_2432S028R_SetupScreen(void)
|
||||
@ -305,11 +372,45 @@ void esp32_2432S028R_AnimateCurrentScreen(unsigned long frame)
|
||||
|
||||
// Variables para controlar el parpadeo con millis()
|
||||
unsigned long previousMillis = 0;
|
||||
unsigned long previousTouchMillis = 0;
|
||||
char currentScreen = 0;
|
||||
|
||||
void esp32_2432S028R_DoLedStuff(unsigned long frame)
|
||||
{
|
||||
unsigned long currentMillis = millis();
|
||||
|
||||
// / Check the touch coordinates 110x185 210x240
|
||||
if (currentMillis - previousTouchMillis >= 500)
|
||||
{
|
||||
int16_t t_x , t_y; // To store the touch coordinates
|
||||
bool pressed = touch.getXY(t_x, t_y);
|
||||
if (pressed) {
|
||||
if (((t_x > 109)&&(t_x < 211)) && ((t_y > 185)&&(t_y < 241))) bottomScreenBlue ^= true;
|
||||
else
|
||||
if (t_x > 160) {
|
||||
// next screen
|
||||
Serial.print(t_x);
|
||||
Serial.print(":x Próxima Tela y:");
|
||||
Serial.println(t_y);
|
||||
currentDisplayDriver->current_cyclic_screen = (currentDisplayDriver->current_cyclic_screen + 1) % currentDisplayDriver->num_cyclic_screens;
|
||||
} else if (t_x < 160)
|
||||
{
|
||||
// Previus screen
|
||||
Serial.print(t_x);
|
||||
Serial.print(":x Tela anterior y:");
|
||||
Serial.println(t_y);
|
||||
/* Serial.println(currentDisplayDriver->current_cyclic_screen); */
|
||||
currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->current_cyclic_screen - 1;
|
||||
if (currentDisplayDriver->current_cyclic_screen<0) currentDisplayDriver->current_cyclic_screen = currentDisplayDriver->num_cyclic_screens - 1;
|
||||
Serial.println(currentDisplayDriver->current_cyclic_screen);
|
||||
}
|
||||
}
|
||||
previousTouchMillis = currentMillis;
|
||||
}
|
||||
|
||||
if (currentScreen != currentDisplayDriver->current_cyclic_screen) hasChangedScreen ^= true;
|
||||
currentScreen = currentDisplayDriver->current_cyclic_screen;
|
||||
|
||||
switch (mMonitor.NerdStatus)
|
||||
{
|
||||
case NM_waitingConfig:
|
||||
@ -332,6 +433,8 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
CyclicScreenFunction esp32_2432S028RCyclicScreens[] = {esp32_2432S028R_MinerScreen, esp32_2432S028R_ClockScreen, esp32_2432S028R_GlobalHashScreen};
|
||||
|
@ -287,7 +287,7 @@ coin_data getCoinData(unsigned long mElapsed)
|
||||
return data;
|
||||
}
|
||||
|
||||
pool_data updatePoolData(void){
|
||||
pool_data getPoolData(void){
|
||||
//pool_data pData;
|
||||
if((mPoolUpdate == 0) || (millis() - mPoolUpdate > UPDATE_POOL_min * 60 * 1000)){
|
||||
if (WiFi.status() != WL_CONNECTED) return pData;
|
||||
@ -296,10 +296,12 @@ pool_data updatePoolData(void){
|
||||
HTTPClient http;
|
||||
http.setReuse(true);
|
||||
try {
|
||||
http.begin(String(getPublicPool)+btcString);
|
||||
String btcWallet = btcString;
|
||||
Serial.println(btcWallet);
|
||||
if (btcWallet.indexOf(".")>0) btcWallet = btcWallet.substring(0,btcWallet.indexOf("."));
|
||||
http.begin(String(getPublicPool)+btcWallet);
|
||||
int httpCode = http.GET();
|
||||
|
||||
if (httpCode > 0) {
|
||||
if (httpCode == HTTP_CODE_OK) {
|
||||
String payload = http.getString();
|
||||
// Serial.println(payload);
|
||||
DynamicJsonDocument doc(1024);
|
||||
@ -312,11 +314,12 @@ pool_data updatePoolData(void){
|
||||
totalhashs += worker["hashRate"].as<float>();
|
||||
}
|
||||
pData.workersHash = String(totalhashs/1000);
|
||||
|
||||
String temp = "";
|
||||
double temp;
|
||||
if (doc.containsKey("bestDifficulty")) {
|
||||
temp = doc["bestDifficulty"].as<float>();
|
||||
pData.bestDifficulty = String(temp);
|
||||
temp = doc["bestDifficulty"].as<double>();
|
||||
char best_diff_string[16] = {0};
|
||||
suffix_string(temp, best_diff_string, 16, 0);
|
||||
pData.bestDifficulty = String(best_diff_string);
|
||||
}
|
||||
doc.clear();
|
||||
mPoolUpdate = millis();
|
||||
|
@ -111,7 +111,7 @@ void setup_monitor(void);
|
||||
mining_data getMiningData(unsigned long mElapsed);
|
||||
clock_data getClockData(unsigned long mElapsed);
|
||||
coin_data getCoinData(unsigned long mElapsed);
|
||||
pool_data updatePoolData(void);
|
||||
pool_data getPoolData(void);
|
||||
|
||||
clock_data_t getClockData_t(unsigned long mElapsed);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user