feat(sacn): UDP-Empfangs-Task und Verdrahtung in App und API
This commit is contained in:
+24
-6
@@ -13,10 +13,12 @@
|
||||
#include "drivers/nl_led.h"
|
||||
#include "light/nl_boot_state.h"
|
||||
#include "light/nl_control.h"
|
||||
#include "light/nl_dmx.h"
|
||||
#include "light/nl_engine.h"
|
||||
#include "net/nl_http_server.h"
|
||||
#include "net/nl_mdns.h"
|
||||
#include "net/nl_recovery.h"
|
||||
#include "net/nl_sacn.h"
|
||||
#include "net/nl_wifi.h"
|
||||
#include "sys/nl_app.h"
|
||||
#include "sys/nl_app_api.h"
|
||||
@@ -147,6 +149,7 @@ static void light_task(void *arg)
|
||||
now = nl_app_now_ms();
|
||||
nl_app_lock();
|
||||
nl_engine_tick(now - last);
|
||||
nl_dmx_tick(now);
|
||||
nl_app_unlock();
|
||||
last = now;
|
||||
s_light_beat++;
|
||||
@@ -160,9 +163,9 @@ static void app_task(void *arg)
|
||||
nl_engine_cfg_t cfg;
|
||||
nl_light_state_t last, initial, pending;
|
||||
bool have_last, after_ota;
|
||||
bool light_alive = false, net_alive = false, http_alive = false;
|
||||
bool light_alive = false, net_alive = false, http_alive = false, sacn_alive = false;
|
||||
uint8_t boots;
|
||||
uint32_t boot_ms, light_seen, net_seen, http_seen;
|
||||
uint32_t boot_ms, light_seen, net_seen, http_seen, sacn_seen;
|
||||
|
||||
(void)arg;
|
||||
/* I2: the 5 s of spec 3.4 step 7 / 5.5 count from power-up, not from "after the recovery
|
||||
@@ -205,6 +208,7 @@ static void app_task(void *arg)
|
||||
nl_ctrl_init(board, s_settings.fade_in_ms, s_settings.fade_out_ms, s_settings.transition_ms,
|
||||
s_settings.wake_on_change != 0);
|
||||
nl_ctrl_boot(&initial);
|
||||
nl_dmx_init(board);
|
||||
nl_app_unlock();
|
||||
|
||||
tls_os_task_create(NULL, "nl_light", light_task, NULL, (u8 *)s_light_stack, sizeof(s_light_stack), NL_LIGHT_PRIO, 0);
|
||||
@@ -231,9 +235,19 @@ static void app_task(void *arg)
|
||||
|
||||
nl_http_server_start(nl_app_api_ctx());
|
||||
|
||||
{
|
||||
static nl_settings_t sacn_boot; /* copy: the network task may change s_settings later */
|
||||
nl_app_lock();
|
||||
sacn_boot = s_settings;
|
||||
nl_app_unlock();
|
||||
nl_sacn_apply_settings(&sacn_boot);
|
||||
}
|
||||
nl_sacn_start();
|
||||
|
||||
light_seen = s_light_beat;
|
||||
net_seen = nl_net_beat;
|
||||
http_seen = nl_http_beat;
|
||||
sacn_seen = nl_sacn_beat;
|
||||
for (;;) {
|
||||
uint32_t now;
|
||||
bool due;
|
||||
@@ -262,8 +276,8 @@ static void app_task(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Feed the watchdog only once the light, network and HTTP tasks have each made
|
||||
* progress since the last feed - a single stuck task (e.g. nl_app_lock() held
|
||||
/* Feed the watchdog only once the light, network, HTTP and sACN tasks have each
|
||||
* made progress since the last feed - a single stuck task (e.g. nl_app_lock() held
|
||||
* forever) must still starve the watchdog, not just the light task. */
|
||||
if (s_light_beat != light_seen) {
|
||||
light_seen = s_light_beat;
|
||||
@@ -277,8 +291,12 @@ static void app_task(void *arg)
|
||||
http_seen = nl_http_beat;
|
||||
http_alive = true;
|
||||
}
|
||||
if (light_alive && net_alive && http_alive) {
|
||||
light_alive = net_alive = http_alive = false;
|
||||
if (nl_sacn_beat != sacn_seen) {
|
||||
sacn_seen = nl_sacn_beat;
|
||||
sacn_alive = true;
|
||||
}
|
||||
if (light_alive && net_alive && http_alive && sacn_alive) {
|
||||
light_alive = net_alive = http_alive = sacn_alive = false;
|
||||
tls_watchdog_clr();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user