feat: WLAN-Treiber mit Onboarding-AP, Build-Credentials und Befehl net
This commit is contained in:
@@ -25,4 +25,7 @@ void nl_app_factory_reset(void);
|
||||
* function instead of calling nl_app_factory_reset() directly from another task. */
|
||||
void nl_app_request_factory_reset(void);
|
||||
|
||||
/* Stores new station credentials (from a successful onboarding test) and persists them. */
|
||||
int nl_app_set_wifi_credentials(const char *ssid, const char *pass);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "light/nl_control.h"
|
||||
#include "light/nl_engine.h"
|
||||
#include "net/nl_wifi.h"
|
||||
#include "sys/nl_app.h"
|
||||
#include "sys/nl_console.h"
|
||||
#include "sys/nl_console_cmd.h"
|
||||
@@ -101,6 +102,13 @@ static void exec(const nl_cmd_t *c)
|
||||
case NL_CMD_REBOOT:
|
||||
nl_app_reboot();
|
||||
return;
|
||||
case NL_CMD_NET: {
|
||||
nl_wifi_status_t w;
|
||||
nl_wifi_status(&w);
|
||||
printf("net: mode=%s ssid=%s ip=%s sta_ip=%s rssi=%d error=%s host=%s\r\n", w.mode, w.ssid, w.ip,
|
||||
w.sta_ip[0] ? w.sta_ip : "-", w.rssi, w.error ? w.error : "-", nl_wifi_hostname());
|
||||
return;
|
||||
}
|
||||
case NL_CMD_WDTEST:
|
||||
printf("wdtest: holding app lock forever\r\n");
|
||||
nl_app_lock(); /* deliberately never released: light_task and app_task stall on it,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
const char nl_console_help[] =
|
||||
"on [ms] | off [ms] | bri <1-100> [ms] | rgb <r> <g> <b> [ms] | ct <K> [ms]\r\n"
|
||||
"pob last|on|off | fade <in> <out> | blink [n] | pulse on|off\r\n"
|
||||
"state | factory | reboot | wdtest | help\r\n";
|
||||
"state | net | factory | reboot | wdtest | help\r\n";
|
||||
|
||||
static bool num(const char *s, int32_t lo, int32_t hi, int32_t *out)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ nl_cmd_t nl_console_parse(const char *line)
|
||||
} else {
|
||||
static const struct { const char *name; nl_cmd_type_t type; } SIMPLE[] = {
|
||||
{"state", NL_CMD_STATE}, {"factory", NL_CMD_FACTORY}, {"reboot", NL_CMD_REBOOT},
|
||||
{"help", NL_CMD_HELP}, {"wdtest", NL_CMD_WDTEST}};
|
||||
{"help", NL_CMD_HELP}, {"wdtest", NL_CMD_WDTEST}, {"net", NL_CMD_NET}};
|
||||
ok = false;
|
||||
for (size_t i = 0; i < sizeof SIMPLE / sizeof SIMPLE[0]; i++)
|
||||
if (!strcmp(tok[0], SIMPLE[i].name)) {
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef enum {
|
||||
NL_CMD_REBOOT,
|
||||
NL_CMD_HELP,
|
||||
NL_CMD_WDTEST,
|
||||
NL_CMD_NET,
|
||||
NL_CMD_ERROR
|
||||
} nl_cmd_type_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user