Added new screen + changed version
This commit is contained in:
parent
42c5647456
commit
7bafc8fe17
@ -356,6 +356,68 @@ void esp32_2432S028R_GlobalHashScreen(unsigned long mElapsed)
|
||||
printheap();
|
||||
#endif
|
||||
}
|
||||
void esp32_2432S028R_BTCprice(unsigned long mElapsed)
|
||||
{
|
||||
|
||||
if (hasChangedScreen) tft.pushImage(0, 0, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||
hasChangedScreen = false;
|
||||
|
||||
clock_data data = getClockData(mElapsed);
|
||||
|
||||
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, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||
// Hashrate
|
||||
render.setFontSize(25);
|
||||
render.setFontColor(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_WHITE);
|
||||
|
||||
// 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, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||
|
||||
// Print BTC Price
|
||||
background.setFreeFont(FSSB9);
|
||||
background.setTextSize(1);
|
||||
background.setTextDatum(TL_DATUM);
|
||||
background.setTextColor(TFT_BLACK);
|
||||
background.drawString(data.currentTime.c_str(), 202-130, 0, GFXFF);
|
||||
|
||||
// Print Hour
|
||||
background.setFreeFont(FF23);
|
||||
background.setTextSize(2);
|
||||
background.setTextColor(0xDEDB, TFT_BLACK);
|
||||
background.drawString(data.btcPrice.c_str(), 0, 50, GFXFF);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(130, 3);
|
||||
|
||||
// Delete sprite to free the memory heap
|
||||
background.deleteSprite();
|
||||
|
||||
#ifdef ESP32_2432S028R
|
||||
printPoolData();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
// Print heap
|
||||
printheap();
|
||||
#endif
|
||||
}
|
||||
|
||||
void esp32_2432S028R_LoadingScreen(void)
|
||||
{
|
||||
@ -443,7 +505,7 @@ void esp32_2432S028R_DoLedStuff(unsigned long frame)
|
||||
|
||||
}
|
||||
|
||||
CyclicScreenFunction esp32_2432S028RCyclicScreens[] = {esp32_2432S028R_MinerScreen, esp32_2432S028R_ClockScreen, esp32_2432S028R_GlobalHashScreen};
|
||||
CyclicScreenFunction esp32_2432S028RCyclicScreens[] = {esp32_2432S028R_MinerScreen, esp32_2432S028R_ClockScreen, esp32_2432S028R_GlobalHashScreen, esp32_2432S028R_BTCprice};
|
||||
|
||||
DisplayDriver esp32_2432S028RDriver = {
|
||||
esp32_2432S028R_Init,
|
||||
|
@ -195,9 +195,13 @@ void tDisplay_GlobalHashScreen(unsigned long mElapsed)
|
||||
background.pushSprite(0, 0);
|
||||
}
|
||||
|
||||
|
||||
void tDisplay_BTCprice(unsigned long mElapsed)
|
||||
{
|
||||
clock_data data = getClockData(mElapsed);
|
||||
data.currentDate ="01/12/2023";
|
||||
|
||||
//if(data.currentDate.indexOf("12/2023")>) { tDisplay_ChristmasContent(data); return; }
|
||||
|
||||
// Print background screen
|
||||
background.pushImage(0, 0, priceScreenWidth, priceScreenHeight, priceScreen);
|
||||
@ -211,25 +215,24 @@ void tDisplay_BTCprice(unsigned long mElapsed)
|
||||
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(), 202, 3, GFXFF);
|
||||
|
||||
// Print BlockHeight
|
||||
render.setFontSize(18);
|
||||
render.rdrawString(data.blockHeight.c_str(), 254, 140, TFT_WHITE);
|
||||
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, 60, GFXFF);
|
||||
background.drawString(data.btcPrice.c_str(), 300, 58, GFXFF);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
|
@ -195,6 +195,44 @@ void tDisplay_GlobalHashScreen(unsigned long mElapsed)
|
||||
background.pushSprite(0, 0);
|
||||
}
|
||||
|
||||
void tDisplay_BTCprice(unsigned long mElapsed)
|
||||
{
|
||||
clock_data data = getClockData(mElapsed);
|
||||
|
||||
// Print background screen
|
||||
background.pushImage(0, 0, priceScreenWidth, 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(), 70, 103, TFT_BLACK);
|
||||
|
||||
// Print BlockHeight
|
||||
render.setFontSize(18);
|
||||
render.rdrawString(data.blockHeight.c_str(), 190, 110, TFT_WHITE);
|
||||
|
||||
// Print Hour
|
||||
background.setFreeFont(FSSB9);
|
||||
background.setTextSize(1);
|
||||
background.setTextDatum(TL_DATUM);
|
||||
background.setTextColor(TFT_BLACK);
|
||||
background.drawString(data.currentTime.c_str(), 148, 1, 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(), 70, 25, GFXFF);
|
||||
|
||||
// Push prepared background to screen
|
||||
background.pushSprite(0, 0);
|
||||
}
|
||||
|
||||
void tDisplay_LoadingScreen(void)
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -133,26 +133,12 @@ void runStratumWorker(void *name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Test vars:
|
||||
//************
|
||||
//Nerdminerpool
|
||||
// strcpy(poolString, "nerdminerPool");
|
||||
// portNumber = 3002;
|
||||
// strcpy(btcString,"test");
|
||||
//Braiins
|
||||
//strcpy(poolString, "eu.stratum.braiins.com");
|
||||
//portNumber = 3333;
|
||||
//strcpy(btcString,"Bitmaker.01");
|
||||
//CKpool
|
||||
//strcpy(poolString, "solo.ckpool.org");
|
||||
//portNumber = 3333;
|
||||
//strcpy(btcString,"test");
|
||||
|
||||
if(!checkPoolConnection())
|
||||
if(!checkPoolConnection()){
|
||||
//If server is not reachable add random delay for connection retries
|
||||
srand(millis());
|
||||
//Generate value between 1 and 15 secs
|
||||
vTaskDelay(((1 + rand() % 15) * 1000) / portTICK_PERIOD_MS);
|
||||
//Generate value between 1 and 120 secs
|
||||
vTaskDelay(((1 + rand() % 120) * 1000) / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
if(!isMinerSuscribed){
|
||||
|
||||
|
@ -193,6 +193,24 @@ void getTime(unsigned long* currentHours, unsigned long* currentMinutes, unsigne
|
||||
*currentSeconds = currentTime % 60;
|
||||
}
|
||||
|
||||
String getDate(){
|
||||
|
||||
unsigned long elapsedTime = (millis() - mTriggerUpdate) / 1000; // Tiempo transcurrido en segundos
|
||||
unsigned long currentTime = initialTime + elapsedTime; // La hora actual
|
||||
|
||||
// Convierte la hora actual (epoch time) en una estructura tm
|
||||
struct tm *tm = localtime((time_t *)¤tTime);
|
||||
|
||||
int year = tm->tm_year + 1900; // tm_year es el número de años desde 1900
|
||||
int month = tm->tm_mon + 1; // tm_mon es el mes del año desde 0 (enero) hasta 11 (diciembre)
|
||||
int day = tm->tm_mday; // tm_mday es el día del mes
|
||||
|
||||
char currentDate[20];
|
||||
sprintf(currentDate, "%02d/%02d/%04d", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900);
|
||||
|
||||
return String(currentDate);
|
||||
}
|
||||
|
||||
String getTime(void){
|
||||
unsigned long currentHours, currentMinutes, currentSeconds;
|
||||
getTime(¤tHours, ¤tMinutes, ¤tSeconds);
|
||||
@ -248,6 +266,7 @@ clock_data getClockData(unsigned long mElapsed)
|
||||
data.btcPrice = getBTCprice();
|
||||
data.blockHeight = getBlockHeight();
|
||||
data.currentTime = getTime();
|
||||
data.currentDate = getDate();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ typedef struct {
|
||||
String btcPrice;
|
||||
String blockHeight;
|
||||
String currentTime;
|
||||
String currentDate;
|
||||
}clock_data;
|
||||
|
||||
typedef struct {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define CURRENT_VERSION "V1.6.2"
|
||||
#define CURRENT_VERSION "V1.6.3"
|
||||
|
||||
#endif // VERSION_H
|
||||
|
Loading…
Reference in New Issue
Block a user