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
mathertel/OneButton @ ^2.0.3
arduino-libraries/NTPClient
;https://github.com/jbtronics/ESP32Console.git#v1.2.1
lib_ignore =
TFT_eSPI

View File

@ -10,7 +10,7 @@
#include "wManager.h"
#include "mining.h"
#include "monitor.h"
#include "drivers/display.h"
#include "drivers/displays/display.h"
//3 seconds WDT
#define WDT_TIMEOUT 3
@ -57,7 +57,7 @@ void setup()
button1.setPressTicks(5000);
button1.attachClick(switchToNextScreen);
button1.attachDoubleClick(alternateScreenRotation);
button1.attachLongPressStart(reset_configurations);
button1.attachLongPressStart(reset_configuration);
#endif
#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
button2.setPressTicks(5000);
button2.attachClick(switchToNextScreen);
button2.attachLongPressStart(reset_configurations);
button2.attachLongPressStart(reset_configuration);
#endif
/******** 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

View File

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

View File

@ -1,21 +1,7 @@
#ifndef DRIVERS_H
#define DRIVERS_H
#ifndef DISPLAYDRIVER_H_
#define DISPLAYDRIVER_H_
#if defined(NERDMINERV2)
#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
#include "..\devices\device.h"
typedef void (*AlternateFunction)(void);
typedef void (*DriverInitFunction)(void);
@ -49,4 +35,4 @@ extern DisplayDriver dongleDisplayDriver;
#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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// we only have one implementation right now and nothing to choose from.
#define NVMEM_SPIFFS
#include "..\drivers.h"
#include "..\devices\device.h"
#include "storage.h"
// 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_TIMEZONE "Timezone"
class TSettings
struct TSettings
{
public:
char WifiSSID[80]{ DEFAULT_SSID };
char WifiPW[80]{ DEFAULT_WIFIPW };
char PoolAddress[80]{ DEFAULT_POOLURL };
char BtcWallet[80]{ DEFAULT_WALLETID };
uint32_t PoolPort{ DEFAULT_POOLPORT };
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_

View File

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

View File

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

View File

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