platform: fix crash, move some code from h to cpp
This commit is contained in:
parent
0700dfaf92
commit
8223688d7b
@ -74,6 +74,9 @@ Platform::freeRam()
|
||||
#ifdef BOARD_ESP8266
|
||||
return ESP.getFreeHeap();
|
||||
#endif
|
||||
#ifdef BOARD_ESP32
|
||||
return ESP.getFreeHeap();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -206,6 +209,28 @@ Platform::deviceID()
|
||||
return s_deviceID;
|
||||
}
|
||||
|
||||
void
|
||||
Platform::addLEDs(CRGB* leds, unsigned int ledCount) {
|
||||
FastLED.addLeds<WS2812B, RENDERBUG_LED_PIN, RENDERBUG_LED_PACKING>(leds, ledCount);
|
||||
}
|
||||
|
||||
const String
|
||||
Platform::model()
|
||||
{
|
||||
static String modelName = String("Renderbug " ) + Platform::name();
|
||||
return modelName;
|
||||
}
|
||||
|
||||
void
|
||||
Platform::restart() {
|
||||
#ifdef BOARD_ESP8266
|
||||
ESP.wdtDisable();
|
||||
ESP.restart();
|
||||
#elif defined(BOARD_ESP32)
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
|
||||
BootOptions
|
||||
Platform::bootopts;
|
||||
|
||||
|
@ -11,17 +11,11 @@ class Platform : public Task {
|
||||
static BootOptions bootopts;
|
||||
static void setTimezone(int tz) { s_timezone = tz; }
|
||||
static int getTimezone() { return s_timezone; }
|
||||
|
||||
static void addLEDs(CRGB* leds, unsigned int ledCount) {
|
||||
FastLED.addLeds<WS2812B, RENDERBUG_LED_PIN, RENDERBUG_LED_PACKING>(leds, ledCount);
|
||||
}
|
||||
static void addLEDs(CRGB* leds, unsigned int ledCount);
|
||||
|
||||
static const char* name();
|
||||
static const char* version();
|
||||
static const String model() {
|
||||
static String modelName = String("Renderbug " ) + Platform::name();
|
||||
return modelName;
|
||||
}
|
||||
static const String model();
|
||||
static const String deviceName() {
|
||||
static String devName = model() + " " + Platform::deviceID();
|
||||
return devName;
|
||||
@ -110,12 +104,5 @@ class Platform : public Task {
|
||||
return task_iterator(NULL);
|
||||
}
|
||||
|
||||
static void restart() {
|
||||
#ifdef BOARD_ESP8266
|
||||
ESP.wdtDisable();
|
||||
ESP.restart();
|
||||
#elif defined(BOARD_ESP32)
|
||||
ESP.restart();
|
||||
#endif
|
||||
}
|
||||
static void restart();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user