Merge branch 'wellenvogel:master' into master
This commit is contained in:
commit
5a6801b2d8
|
@ -72,7 +72,7 @@ public:
|
||||||
if (handled > 0){
|
if (handled > 0){
|
||||||
memmove(logBuffer,logBuffer+handled,wp-handled);
|
memmove(logBuffer,logBuffer+handled,wp-handled);
|
||||||
wp-=handled;
|
wp-=handled;
|
||||||
logBuffer[handled]=0;
|
logBuffer[wp]=0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
#include "GwLedTask.h"
|
#include "GwLedTask.h"
|
||||||
#include "GwHardware.h"
|
#include "GwHardware.h"
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
|
|
||||||
|
void handleLeds(GwApi *api);
|
||||||
|
void initLeds(GwApi *param)
|
||||||
|
{
|
||||||
|
#ifdef GWLED_FASTLED
|
||||||
|
param->addUserTask(handleLeds, "handleLeds");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GWLED_FASTLED
|
||||||
#include "FastLED.h"
|
#include "FastLED.h"
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
LED_OFF,
|
LED_OFF,
|
||||||
LED_GREEN,
|
LED_GREEN,
|
||||||
LED_BLUE,
|
LED_BLUE,
|
||||||
|
@ -10,41 +21,38 @@ typedef enum {
|
||||||
LED_WHITE
|
LED_WHITE
|
||||||
} GwLedMode;
|
} GwLedMode;
|
||||||
|
|
||||||
static CRGB::HTMLColorCode colorFromMode(GwLedMode cmode){
|
static CRGB::HTMLColorCode colorFromMode(GwLedMode cmode)
|
||||||
switch(cmode){
|
{
|
||||||
case LED_BLUE:
|
switch (cmode)
|
||||||
return CRGB::Blue;
|
{
|
||||||
case LED_GREEN:
|
case LED_BLUE:
|
||||||
return CRGB::Green;
|
return CRGB::Blue;
|
||||||
case LED_RED:
|
case LED_GREEN:
|
||||||
return CRGB::Red;
|
return CRGB::Green;
|
||||||
case LED_WHITE:
|
case LED_RED:
|
||||||
return CRGB::White;
|
return CRGB::Red;
|
||||||
default:
|
case LED_WHITE:
|
||||||
return CRGB::Black;
|
return CRGB::White;
|
||||||
|
default:
|
||||||
|
return CRGB::Black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void handleLeds(GwApi *api){
|
void handleLeds(GwApi *api)
|
||||||
GwLog *logger=api->getLogger();
|
{
|
||||||
#ifndef GWLED_FASTLED
|
GwLog *logger = api->getLogger();
|
||||||
LOG_DEBUG(GwLog::LOG,"currently only fastled handling");
|
|
||||||
delay(50);
|
|
||||||
vTaskDelete(NULL);
|
|
||||||
return;
|
|
||||||
#else
|
|
||||||
CRGB leds[1];
|
CRGB leds[1];
|
||||||
#ifdef GWLED_SCHEMA
|
#ifdef GWLED_SCHEMA
|
||||||
FastLED.addLeds<GWLED_TYPE,GWLED_PIN,(EOrder)GWLED_SCHEMA>(leds,1);
|
FastLED.addLeds<GWLED_TYPE, GWLED_PIN, (EOrder)GWLED_SCHEMA>(leds, 1);
|
||||||
#else
|
#else
|
||||||
FastLED.addLeds<GWLED_TYPE,GWLED_PIN>(leds,1);
|
FastLED.addLeds<GWLED_TYPE, GWLED_PIN>(leds, 1);
|
||||||
#endif
|
#endif
|
||||||
uint8_t brightness=api->getConfig()->getInt(GwConfigDefinitions::ledBrightness,128);
|
uint8_t brightness = api->getConfig()->getInt(GwConfigDefinitions::ledBrightness, 128);
|
||||||
GwLedMode currentMode=LED_GREEN;
|
GwLedMode currentMode = LED_GREEN;
|
||||||
leds[0]=colorFromMode(currentMode);
|
leds[0] = colorFromMode(currentMode);
|
||||||
FastLED.setBrightness(brightness);
|
FastLED.setBrightness(brightness);
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
LOG_DEBUG(GwLog::LOG,"led task started with mode %d",(int)currentMode);
|
LOG_DEBUG(GwLog::LOG, "led task started with mode %d, brightness=%d", (int)currentMode, (int)brightness);
|
||||||
int apiResult=0;
|
int apiResult = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
delay(50);
|
delay(50);
|
||||||
|
@ -77,5 +85,5 @@ void handleLeds(GwApi *api){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,8 +1,9 @@
|
||||||
#ifndef _GWLEDS_H
|
#ifndef _GWLEDS_H
|
||||||
#define _GWLEDS_H
|
#define _GWLEDS_H
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
//task function
|
//task init function
|
||||||
void handleLeds(GwApi *param);
|
|
||||||
|
|
||||||
DECLARE_USERTASK(handleLeds);
|
void initLeds(GwApi *param);
|
||||||
|
|
||||||
|
DECLARE_INITFUNCTION(initLeds);
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,15 @@
|
||||||
|
[platformio]
|
||||||
|
#if you want a pio run to only build
|
||||||
|
#your special environments you can set this here
|
||||||
|
#by uncommenting the next line
|
||||||
|
#default_envs = testboard
|
||||||
|
[env:nodemculed]
|
||||||
|
board = nodemcu-32s
|
||||||
|
lib_deps = ${env.lib_deps}
|
||||||
|
build_flags =
|
||||||
|
-D BOARD_HOMBERGER
|
||||||
|
-D GWLED_CODE=1
|
||||||
|
-D GWLED_PIN=33
|
||||||
|
${env.build_flags}
|
||||||
|
upload_port = /dev/esp32
|
||||||
|
upload_protocol = esptool
|
|
@ -16,6 +16,19 @@ default_envs=
|
||||||
extra_configs=
|
extra_configs=
|
||||||
lib/*task*/platformio.ini
|
lib/*task*/platformio.ini
|
||||||
|
|
||||||
|
[basedeps]
|
||||||
|
lib_deps =
|
||||||
|
ttlappalainen/NMEA2000-library @ 4.18.9
|
||||||
|
ttlappalainen/NMEA0183 @ 1.9.1
|
||||||
|
ArduinoJson @ 6.18.5
|
||||||
|
AsyncTCP-esphome @ 2.0.1
|
||||||
|
ottowinter/ESPAsyncWebServer-esphome@2.0.1
|
||||||
|
FS
|
||||||
|
Preferences
|
||||||
|
ESPmDNS
|
||||||
|
WiFi
|
||||||
|
Update
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
platform = espressif32 @ 6.3.2
|
platform = espressif32 @ 6.3.2
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
@ -23,18 +36,8 @@ framework = arduino
|
||||||
; framework-arduinoespressif32 @ 3.20011.230801
|
; framework-arduinoespressif32 @ 3.20011.230801
|
||||||
; framework-espidf @ 3.50101.0
|
; framework-espidf @ 3.50101.0
|
||||||
lib_deps =
|
lib_deps =
|
||||||
ttlappalainen/NMEA2000-library @ 4.18.9
|
${basedeps.lib_deps}
|
||||||
ttlappalainen/NMEA0183 @ 1.9.1
|
fastled/FastLED @ 3.6.0
|
||||||
ArduinoJson @ 6.18.5
|
|
||||||
AsyncTCP-esphome @ 2.0.1
|
|
||||||
ottowinter/ESPAsyncWebServer-esphome@2.0.1
|
|
||||||
fastled/FastLED @ 3.6.0
|
|
||||||
FS
|
|
||||||
Preferences
|
|
||||||
ESPmDNS
|
|
||||||
WiFi
|
|
||||||
Update
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
board_build.embed_files =
|
board_build.embed_files =
|
||||||
|
|
Loading…
Reference in New Issue