mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-14 06:23:07 +01:00
handle the leds as user task
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "GwButtons.h"
|
||||
#include "GwHardware.h"
|
||||
#include "GwApi.h"
|
||||
#include "GwLeds.h"
|
||||
#include "GwLedTask.h"
|
||||
|
||||
class FactoryResetRequest: public GwMessage{
|
||||
private:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "GwLeds.h"
|
||||
#include "GwLedTask.h"
|
||||
#include "GwHardware.h"
|
||||
#include "GwApi.h"
|
||||
#include "FastLED.h"
|
||||
@@ -23,8 +23,7 @@ static CRGB::HTMLColorCode colorFromMode(GwLedMode cmode){
|
||||
return CRGB::Black;
|
||||
}
|
||||
}
|
||||
void handleLeds(void *param){
|
||||
GwApi *api=(GwApi*)param;
|
||||
void handleLeds(GwApi *api){
|
||||
GwLog *logger=api->getLogger();
|
||||
#ifndef GWLED_FASTLED
|
||||
LOG_DEBUG(GwLog::LOG,"currently only fastled handling");
|
||||
@@ -43,6 +42,7 @@ void handleLeds(void *param){
|
||||
leds[0]=colorFromMode(currentMode);
|
||||
FastLED.setBrightness(brightness);
|
||||
FastLED.show();
|
||||
LOG_DEBUG(GwLog::LOG,"led task started with mode %d",(int)currentMode);
|
||||
while(true){
|
||||
delay(50);
|
||||
GwLedMode newMode=mode;
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef _GWLEDS_H
|
||||
#define _GWLEDS_H
|
||||
#include "GwApi.h"
|
||||
//task function
|
||||
void handleLeds(void *param);
|
||||
void handleLeds(GwApi *param);
|
||||
typedef enum {
|
||||
LED_OFF,
|
||||
LED_GREEN,
|
||||
@@ -10,4 +11,5 @@ typedef enum {
|
||||
LED_WHITE
|
||||
} GwLedMode;
|
||||
void setLedMode(GwLedMode mode);
|
||||
DECLARE_USERTASK(handleLeds);
|
||||
#endif
|
||||
Reference in New Issue
Block a user