NerdMiner_v2 icon indicating copy to clipboard operation
NerdMiner_v2 copied to clipboard

Feature Request - Support for Waveshare esp32s3 lcd 1.47 inch dongle

Open DragonPerl opened this issue 9 months ago • 8 comments

I have this board lying around and it would be amazing if I could turn this into a NerdMiner.

I saw it on another site where they sell this board with the firmware already ported, but I can't find the code anywhere. So it would be nice if the guys selling it would provide the code to this open source project, as they profit from it. ;)

https://bitcoinmerch.com/products/nerdminer2?variant=45551650537702

Thanks a lot! BR Markus

DragonPerl avatar Feb 18 '25 08:02 DragonPerl

actually it is working with nerdminer-prerelease-V1.7.0_NerdminerV2-S3-AMOLED but the screen stays black... anyone could help please?

DarKOrange75 avatar Mar 20 '25 18:03 DarKOrange75

I couldn't manage to support it with tft_spi library but I managed to support it with adafruit library.

just configure it like this

build_flags = -D WAVESHARE_DISPLAY=1 -D LED_PIN=5 -D TFT_CS=42 -D TFT_DC=41 -D TFT_RST=39 -D TFT_BL=48 -D TFT_CLK=40 -D TFT_DIN=45

write your new display class and activate it with WAVESHARE_DISPLAY

also add those dependencies : adafruit/Adafruit GFX Library@^1.11.11 adafruit/Adafruit ST7735 and ST7789 Library@^1.11.0

KralMurat avatar Apr 22 '25 11:04 KralMurat

I appreciate the response to this issue but it's way above my abilities to make that work lol. Any chance you can provide more details? I am useless at C dev. If it was in python, I could probably figure it out hahaha

theklunky avatar Apr 22 '25 14:04 theklunky

in platformio.ini add this:

[env:waveshare] platform = [email protected] board = adafruit_feather_esp32s3_tft framework = arduino monitor_speed = 115200 upload_speed = 115200 board_build.partitions = huge_app.csv build_flags = -D WAVESHARE_DISPLAY=1 -D LED_PIN=5 -D TFT_CS=42 -D TFT_DC=41 -D TFT_RST=39 -D TFT_BL=48 -D TFT_CLK=40 -D TFT_DIN=45 lib_deps = https://github.com/takkaO/OpenFontRender#v1.2 bblanchon/ArduinoJson@^6.21.5 https://github.com/tzapu/WiFiManager.git#v2.0.17 mathertel/OneButton@^2.5.0 https://github.com/arduino-libraries/NTPClient@^3.2.1 https://github.com/ESP32Async/ESPAsyncWebServer.git adafruit/Adafruit GFX Library@^1.11.11 adafruit/Adafruit ST7735 and ST7789 Library@^1.11.0 lib_ignore = HANSOLOminerv2

create waveShareESP32S3TFTDisplay.h and add it under src/drivers/devices

#ifndef _WAVESHARE_DISPLAY #define _WAVESHARE_DISPLAY

#define PIN_BUTTON_1 0 #define PIN_BUTTON_2 35

#define WAVESHARE_DISPLAY

#define LED_PIN 5 #define TFT_CS 42 #define TFT_DC 41 #define TFT_RST 39 #define TFT_BL 48 #define TFT_CLK 40 #define TFT_DIN 45

#endif

create waveShareDisplayDriver.cpp and add it under src/drivers/displays

#include "displayDriver.h"

#ifdef WAVESHARE_DISPLAY

#include <Adafruit_GFX.h> #include <Adafruit_ST7789.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 "rotation.h"

#define WIDTH 172 #define HEIGHT 320

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); bool isInitialized = false;

void waveShareDisplay_Init(void) { Serial.println("Initializing display..."); tft.init(172, 320); tft.setRotation(ROTATION_270); tft.fillScreen(ST77XX_BLACK); pinMode(TFT_BL, OUTPUT); digitalWrite(TFT_BL, HIGH); // Turn on backlight }

void waveShareDisplay_AlternateScreenState(void) { Serial.println("Toggling display state"); int screen_state = digitalRead(TFT_BL); digitalWrite(TFT_BL, !screen_state); }

void waveShareDisplay_AlternateRotation(void) { tft.setRotation(flipRotation(tft.getRotation())); }

void waveShareDisplay_MinerScreen(unsigned long mElapsed) { if (!isInitialized) { waveShareDisplay_Init(); isInitialized = true; }

mining_data data = getMiningData(mElapsed);
Serial.println("Displaying miner screen");

tft.drawRGBBitmap(0, 0, MinerScreen, MinerWidth, MinerHeight);

tft.setTextColor(ST77XX_BLACK);
tft.setTextSize(3);
tft.setCursor(40, 135);
tft.print(data.currentHashRate.c_str());
 
tft.setTextSize(2);
tft.setCursor(240, 145);
tft.print(data.totalMHashes.c_str());

tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(2);
tft.setCursor(185, 27);
tft.print(data.templates.c_str());

tft.setTextSize(2);
tft.setCursor(185, 54);
tft.print(data.bestDiff.c_str());

tft.setTextSize(2);
tft.setCursor(185, 81);
tft.print(data.completedShares.c_str());

tft.setTextSize(2);
tft.setCursor(185, 108);
tft.print(data.timeMining.c_str());

tft.setTextSize(3);
tft.setCursor(283, 63);
tft.print(data.valids.c_str());  

}

void waveShareDisplay_ClockScreen(unsigned long mElapsed) { clock_data data = getClockData(mElapsed); Serial.println("Displaying clock screen");

tft.drawRGBBitmap(0, 0, minerClockScreen, minerClockWidth, minerClockHeight);

tft.setTextColor(ST77XX_BLACK);
tft.setTextSize(2);
tft.setCursor(70, 25);
tft.print(data.currentTime.c_str());

}

void waveShareDisplay_GlobalHashScreen(unsigned long mElapsed) { coin_data data = getCoinData(mElapsed); Serial.println("Displaying global hash screen");

tft.drawRGBBitmap(0, 0, globalHashScreen, globalHashWidth, globalHashHeight);

tft.setTextColor(ST77XX_BLACK);
tft.setTextSize(2);
tft.setCursor(70, 25);
tft.print(data.globalHashRate.c_str());

}

void waveShareDisplay_BTCprice(unsigned long mElapsed) { Serial.println("Displaying BTC price screen"); clock_data data = getClockData(mElapsed);

tft.drawRGBBitmap(0, 0, priceScreen, priceScreenWidth, priceScreenHeight);

tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(2);
tft.setCursor(70, 25);
tft.print(data.btcPrice.c_str());

}

void waveShareDisplay_LoadingScreen(void) { Serial.println("Displaying loading screen"); tft.fillScreen(ST77XX_BLACK); tft.drawRGBBitmap(0, 0, initScreen, initWidth, initHeight); tft.setTextColor(ST77XX_WHITE); tft.setCursor(24, 147); // tft.print(CURRENT_VERSION); }

void waveShareDisplay_SetupScreen(void) { Serial.println("Displaying setup screen"); tft.drawRGBBitmap(0, 0, setupModeScreen, setupModeWidth, setupModeHeight); }

void waveShareDisplay_AnimateCurrentScreen(unsigned long frame) {}

void waveShareDisplay_DoLedStuff(unsigned long frame) {}

CyclicScreenFunction waveShareDisplayCyclicScreens[] = { waveShareDisplay_MinerScreen, waveShareDisplay_ClockScreen, waveShareDisplay_GlobalHashScreen };

DisplayDriver waveShareDisplayDriver = { waveShareDisplay_Init, waveShareDisplay_AlternateScreenState, waveShareDisplay_AlternateRotation, waveShareDisplay_LoadingScreen, waveShareDisplay_SetupScreen, waveShareDisplayCyclicScreens, waveShareDisplay_AnimateCurrentScreen, waveShareDisplay_DoLedStuff, SCREENS_ARRAY_SIZE(waveShareDisplayCyclicScreens), 0, WIDTH, HEIGHT }; #endif

in device.h add this: #elif defined(WAVESHARE_DISPLAY) #include "waveShareESP32S3TFTDisplay.h"

in display.cpp add this:

#ifdef WAVESHARE_DISPLAY DisplayDriver *currentDisplayDriver = &waveShareDisplayDriver; #endif

in displayDriver.h add this: extern DisplayDriver waveShareDisplayDriver;

and that should be it :D If you receive any error regarding undefined variables etc just remove them, I customized project a lot for my own needs so probably you won't need them :)

KralMurat avatar Apr 22 '25 14:04 KralMurat

Wow, you delivered!! Unfortunately it fails to build. Lots of errors. The compile output was too large for here so I uploaded it here: https://pastebin.com/ZjUg1FVC Any tips on next steps?

theklunky avatar Apr 22 '25 14:04 theklunky

Same... Used VS to try and build. So many errors. Anyway to just upload the finished files if anyone gets it to work?

BlueVenom1 avatar Apr 23 '25 23:04 BlueVenom1

Cannot read properties of undefined (reading 'id')

has anyone figured this out??

Cjohnson233 avatar May 22 '25 09:05 Cjohnson233

Hey all, great project. I also have an ESP32-C6 1.47" display device lying around. Can somebody compile a working binary to flash? I have the LilyGos working, but the ESP32-C6 is so nice and slim. Thanks.

odroegehorn avatar Aug 13 '25 00:08 odroegehorn