Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
ESP32 compatibility
Browse files Browse the repository at this point in the history
-Added hint for right onboard LED
-Workaround for the EnhancedThread compiling problems
-ESP32Webserver now used for ESP32
  • Loading branch information
SciLor committed May 5, 2018
1 parent d821506 commit 4903fd3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 30 deletions.
31 changes: 6 additions & 25 deletions HyperionRGB/EnhancedThread.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
#include "EnhancedThread.h"

void EnhancedThread::run() {
Thread::run();
if (_runOnce)
Thread::enabled = false;
}

void EnhancedThread::runIfNeeded(void) {
if(Thread::shouldRun())
Thread::run();
}

void EnhancedThread::reset(void) {
Thread::enabled = true;
Thread::runned();
}

void EnhancedThread::setRunOnce(bool runOnce) {
_runOnce = runOnce;
}
unsigned long EnhancedThread::getInterval(void) {
return interval;
}

//#include "EnhancedThread.h"
/*
* Put everything into the EnhancedThread.h to make it compatible with the ESP32
* There seems to be a bug in the ArduinoThread lib
*
*/
25 changes: 24 additions & 1 deletion HyperionRGB/EnhancedThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "BaseHeader.h"
#include <Thread.h>

class EnhancedThread: public Thread {
class EnhancedThread : public Thread {
public:
void
run(void),
Expand All @@ -16,4 +16,27 @@ class EnhancedThread: public Thread {
bool _runOnce;
};

void EnhancedThread::run() {
Thread::run();
if (_runOnce)
Thread::enabled = false;
}

void EnhancedThread::runIfNeeded(void) {
if(Thread::shouldRun())
Thread::run();
}

void EnhancedThread::reset(void) {
Thread::enabled = true;
Thread::runned();
}

void EnhancedThread::setRunOnce(bool runOnce) {
_runOnce = runOnce;
}
unsigned long EnhancedThread::getInterval(void) {
return interval;
}

#endif
2 changes: 1 addition & 1 deletion HyperionRGB/HyperionRGB.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "WrapperWebconfig.h"

#define LED D0 // LED in NodeMCU at pin GPIO16 (D0).
#define LED LED_BUILTIN // LED in NodeMCU at pin GPIO16 (D0) or LED_BUILTIN @Lolin32.
int ledState = LOW;

LoggerInit loggerInit;
Expand Down
10 changes: 7 additions & 3 deletions HyperionRGB/WrapperWebconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ class WrapperWebconfig {
template<typename T>
T getSelectedEntry(String selectedEntryValue, LinkedList<SelectEntryBase*>* target);

LinkedList<SelectEntryBase*>* _idleModes;;

ESP8266WebServer _server = ESP8266WebServer(80);
LinkedList<SelectEntryBase*>* _idleModes;

#if defined(ESP8266)
ESP8266WebServer _server = ESP8266WebServer(80);
#elif defined(ESP32)
ESP32WebServer _server = ESP32WebServer(80);
#endif
};

#endif

0 comments on commit 4903fd3

Please sign in to comment.