If the code hasn't been touched in this long, its probably release-worthy.
This commit is contained in:
@@ -13,14 +13,7 @@ class Platform : public Task {
|
||||
static int getTimezone() { return s_timezone; }
|
||||
|
||||
static void addLEDs(CRGB* leds, unsigned int ledCount) {
|
||||
#ifdef PLATFORM_PHOTON
|
||||
FastLED.addLeds<NEOPIXEL, 6>(leds, ledCount);
|
||||
#elif defined(BOARD_ESP32)
|
||||
FastLED.addLeds<WS2812B, 13, GRB>(leds, ledCount);
|
||||
#else
|
||||
//FastLED.addLeds<WS2812B, 14, GRB>(leds, ledCount);
|
||||
FastLED.addLeds<WS2812B, 14, RGB>(leds, ledCount);
|
||||
#endif
|
||||
FastLED.addLeds<WS2812B, RENDERBUG_LED_PIN, RENDERBUG_LED_PACKING>(leds, ledCount);
|
||||
}
|
||||
|
||||
static const char* name();
|
||||
@@ -39,5 +32,58 @@ class Platform : public Task {
|
||||
void loop() override;
|
||||
static bool getLocalTime(struct tm* timedata);
|
||||
static const char* deviceID();
|
||||
};
|
||||
|
||||
struct TaskRegistration {
|
||||
Task* task = 0;
|
||||
TaskRegistration* next = 0;
|
||||
|
||||
TaskRegistration(Task* task) : task(task) {}
|
||||
};
|
||||
|
||||
static TaskRegistration* firstTask;
|
||||
static TaskRegistration* lastTask;
|
||||
|
||||
static void registerTask(TaskRegistration* reg) {
|
||||
if (firstTask == NULL) {
|
||||
firstTask = reg;
|
||||
lastTask = firstTask;
|
||||
} else {
|
||||
lastTask->next = reg;
|
||||
lastTask = reg;
|
||||
}
|
||||
}
|
||||
|
||||
struct task_iterator: public std::iterator<std::input_iterator_tag, Task*> {
|
||||
TaskRegistration* cur;
|
||||
explicit task_iterator() : cur(NULL) {}
|
||||
explicit task_iterator(TaskRegistration* head) : cur(head) {}
|
||||
task_iterator& operator++() {
|
||||
if (cur) {
|
||||
cur = cur->next;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
task_iterator operator++(int) {task_iterator ret = *this; ++(*this); return ret;}
|
||||
bool operator==(task_iterator other) const { return cur == other.cur; }
|
||||
bool operator!=(task_iterator other) const { return !(*this == other); }
|
||||
Task* operator*() const { return cur->task; }
|
||||
};
|
||||
|
||||
static task_iterator beginTasks() {
|
||||
return task_iterator(firstTask);
|
||||
}
|
||||
|
||||
static task_iterator endTasks() {
|
||||
return task_iterator(NULL);
|
||||
}
|
||||
|
||||
static void restart() {
|
||||
#ifdef BOARD_ESP8266
|
||||
ESP.wdtDisable();
|
||||
ESP.restart();
|
||||
#elif defined(BOARD_ESP32)
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user