seperate display drivers

This commit is contained in:
elmo128 2023-09-15 07:36:46 +02:00
parent 9d7aa2eef2
commit bcd8b2f60d
16 changed files with 44 additions and 60 deletions

View File

@ -145,5 +145,6 @@ lib_deps =
https://github.com/tzapu/WiFiManager.git https://github.com/tzapu/WiFiManager.git
mathertel/OneButton @ ^2.0.3 mathertel/OneButton @ ^2.0.3
arduino-libraries/NTPClient arduino-libraries/NTPClient
;https://github.com/jbtronics/ESP32Console.git#v1.2.1
lib_ignore = lib_ignore =
TFT_eSPI TFT_eSPI

View File

@ -10,7 +10,7 @@
#include "wManager.h" #include "wManager.h"
#include "mining.h" #include "mining.h"
#include "monitor.h" #include "monitor.h"
#include "drivers/display.h" #include "drivers/displays/display.h"
//3 seconds WDT //3 seconds WDT
#define WDT_TIMEOUT 3 #define WDT_TIMEOUT 3
@ -57,7 +57,7 @@ void setup()
button1.setPressTicks(5000); button1.setPressTicks(5000);
button1.attachClick(switchToNextScreen); button1.attachClick(switchToNextScreen);
button1.attachDoubleClick(alternateScreenRotation); button1.attachDoubleClick(alternateScreenRotation);
button1.attachLongPressStart(reset_configurations); button1.attachLongPressStart(reset_configuration);
#endif #endif
#if defined(PIN_BUTTON_1) && defined(PIN_BUTTON_2) //Button 1 of two button device #if defined(PIN_BUTTON_1) && defined(PIN_BUTTON_2) //Button 1 of two button device
@ -69,7 +69,7 @@ void setup()
#if defined(PIN_BUTTON_2) //Button 2 of two button device #if defined(PIN_BUTTON_2) //Button 2 of two button device
button2.setPressTicks(5000); button2.setPressTicks(5000);
button2.attachClick(switchToNextScreen); button2.attachClick(switchToNextScreen);
button2.attachLongPressStart(reset_configurations); button2.attachLongPressStart(reset_configuration);
#endif #endif
/******** INIT NERDMINER ************/ /******** INIT NERDMINER ************/

View File

@ -0,0 +1,20 @@
#ifndef __DEVICE_H__
#define __DEVICE_H__
#if defined(NERDMINERV2)
#include "nerdMinerV2.h"
#elif defined(DEVKITV1)
#include "esp32DevKit.h"
#elif defined(TDISPLAY)
#include "lilygoS3TDisplay.h"
#elif defined(NERMINER_S3_AMOLED)
#include "lilygoS3Amoled.h"
#elif defined(NERMINER_S3_DONGLE)
#include "lilygoS3Dongle.h"
#elif defined(ESP32_CAM)
#include "esp32CAM.h"
#else
#error "No device defined"
#endif
#endif // __DEVICE_H__

View File

@ -1,4 +1,4 @@
#include "../drivers.h" #include "DisplayDriver.h"
#ifdef AMOLED_DISPLAY #ifdef AMOLED_DISPLAY

View File

@ -1,7 +1,7 @@
#ifndef DISPLAY_H #ifndef DISPLAY_H
#define DISPLAY_H #define DISPLAY_H
#include "drivers.h" #include "DisplayDriver.h"
extern DisplayDriver *currentDisplayDriver; extern DisplayDriver *currentDisplayDriver;

View File

@ -1,21 +1,7 @@
#ifndef DRIVERS_H #ifndef DISPLAYDRIVER_H_
#define DRIVERS_H #define DISPLAYDRIVER_H_
#if defined(NERDMINERV2) #include "..\devices\device.h"
#include "devices/nerdMinerV2.h"
#elif defined(DEVKITV1)
#include "devices/esp32DevKit.h"
#elif defined(TDISPLAY)
#include "devices/lilygoS3TDisplay.h"
#elif defined(NERMINER_S3_AMOLED)
#include "devices/lilygoS3Amoled.h"
#elif defined(NERMINER_S3_DONGLE)
#include "devices/lilygoS3Dongle.h"
#elif defined(ESP32_CAM)
#include "devices/esp32CAM.h"
#else
#error "No device defined"
#endif
typedef void (*AlternateFunction)(void); typedef void (*AlternateFunction)(void);
typedef void (*DriverInitFunction)(void); typedef void (*DriverInitFunction)(void);
@ -49,4 +35,4 @@ extern DisplayDriver dongleDisplayDriver;
#define SCREENS_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define SCREENS_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif // DRIVERS_H #endif // DISPLAYDRIVER_H_

View File

@ -1,4 +1,4 @@
#include "../drivers.h" #include "DisplayDriver.h"
#ifdef DONGLE_DISPLAY #ifdef DONGLE_DISPLAY
@ -45,15 +45,15 @@ extern monitor_data mMonitor;
int32_t x = 8, y = 8; \ int32_t x = 8, y = 8; \
background.setTextSize(1); \ background.setTextSize(1); \
background.setTextFont(FONT2); \ background.setTextFont(FONT2); \
\ \
background.setTextColor(KEY_COLOR); \ background.setTextColor(KEY_COLOR); \
\ \
render.setFontSize(18); render.setFontSize(18);
#define CLEAR_SCREEN() \ #define CLEAR_SCREEN() \
RESET_SCREEN(); \ RESET_SCREEN(); \
background.fillRect(0, 0, BUFFER_WIDTH, BUFFER_HEIGHT, BACK_COLOR); \ background.fillRect(0, 0, BUFFER_WIDTH, BUFFER_HEIGHT, BACK_COLOR); \
\ \
#define PRINT_STR(str) \ #define PRINT_STR(str) \

View File

@ -1,4 +1,4 @@
#include "../drivers.h" #include "DisplayDriver.h"
#ifdef NO_DISPLAY #ifdef NO_DISPLAY

View File

@ -1,4 +1,4 @@
#include "../drivers.h" #include "DisplayDriver.h"
#ifdef T_DISPLAY #ifdef T_DISPLAY

View File

@ -1,7 +1,7 @@
#ifndef _SDCARD_H_ #ifndef _SDCARD_H_
#define _SDCARD_H_ #define _SDCARD_H_
#include "..\drivers.h" #include "..\devices\device.h"
#include "storage.h" #include "storage.h"
#include "nvMemory.h" #include "nvMemory.h"

View File

@ -4,7 +4,7 @@
// we only have one implementation right now and nothing to choose from. // we only have one implementation right now and nothing to choose from.
#define NVMEM_SPIFFS #define NVMEM_SPIFFS
#include "..\drivers.h" #include "..\devices\device.h"
#include "storage.h" #include "storage.h"
// Handles load and store of user settings, except wifi credentials. Those are managed by the wifimanager. // Handles load and store of user settings, except wifi credentials. Those are managed by the wifimanager.

View File

@ -17,37 +17,14 @@
#define JSON_KEY_POOLPORT "PoolPort" #define JSON_KEY_POOLPORT "PoolPort"
#define JSON_KEY_TIMEZONE "Timezone" #define JSON_KEY_TIMEZONE "Timezone"
class TSettings struct TSettings
{ {
public:
char WifiSSID[80]{ DEFAULT_SSID }; char WifiSSID[80]{ DEFAULT_SSID };
char WifiPW[80]{ DEFAULT_WIFIPW }; char WifiPW[80]{ DEFAULT_WIFIPW };
char PoolAddress[80]{ DEFAULT_POOLURL }; char PoolAddress[80]{ DEFAULT_POOLURL };
char BtcWallet[80]{ DEFAULT_WALLETID }; char BtcWallet[80]{ DEFAULT_WALLETID };
uint32_t PoolPort{ DEFAULT_POOLPORT }; uint32_t PoolPort{ DEFAULT_POOLPORT };
uint32_t Timezone{ DEFAULT_TIMEZONE }; uint32_t Timezone{ DEFAULT_TIMEZONE };
void print()
{
Serial.print("WifiSSID:>");
Serial.print(WifiSSID);
Serial.print("<, ");
Serial.print("WifiPW:>");
Serial.print(WifiPW);
Serial.print("<, ");
Serial.print("PoolAddress:>");
Serial.print(PoolAddress);
Serial.print("<, ");
Serial.print("BtcWallet:>");
Serial.print(BtcWallet);
Serial.print("<, ");
Serial.print("PoolPort:>");
Serial.print(PoolPort);
Serial.print("<, ");
Serial.print("Timezone:>");
Serial.print(Timezone);
Serial.println("<");
}
}; };
#endif // _STORAGE_H_ #endif // _STORAGE_H_

View File

@ -8,7 +8,7 @@
#include "mining.h" #include "mining.h"
#include "utils.h" #include "utils.h"
#include "monitor.h" #include "monitor.h"
#include "drivers/display.h" #include "drivers/displays/display.h"
#include "drivers/storage/storage.h" #include "drivers/storage/storage.h"
unsigned long templates = 0; unsigned long templates = 0;

View File

@ -7,7 +7,7 @@
#include "wManager.h" #include "wManager.h"
#include "monitor.h" #include "monitor.h"
#include "drivers/display.h" #include "drivers/displays/display.h"
#include "drivers/storage/SDCard.h" #include "drivers/storage/SDCard.h"
#include "drivers/storage/nvMemory.h" #include "drivers/storage/nvMemory.h"
#include "drivers/storage/storage.h" #include "drivers/storage/storage.h"
@ -46,7 +46,7 @@ void configModeCallback(WiFiManager* myWiFiManager)
Serial.println(WiFi.softAPIP()); Serial.println(WiFi.softAPIP());
} }
void reset_configurations() void reset_configuration()
{ {
Serial.println("Erasing Config, restarting"); Serial.println("Erasing Config, restarting");
nvMem.deleteConfig(); nvMem.deleteConfig();
@ -76,7 +76,7 @@ void init_WifiManager()
// Check if button2 is pressed to enter configMode with actual configuration // Check if button2 is pressed to enter configMode with actual configuration
if (!digitalRead(PIN_BUTTON_2)) { if (!digitalRead(PIN_BUTTON_2)) {
Serial.println(F("Button pressed to force start config mode")); Serial.println(F("Button pressed to force start config mode"));
reset_configurations(); reset_configuration();
forceConfig = true; forceConfig = true;
wm.setBreakAfterConfig(true); //Set to detect config edition and save wm.setBreakAfterConfig(true); //Set to detect config edition and save
} }

View File

@ -3,6 +3,6 @@
void init_WifiManager(); void init_WifiManager();
void wifiManagerProcess(); void wifiManagerProcess();
void reset_configurations(); void reset_configuration();
#endif // _WMANAGER_H #endif // _WMANAGER_H