mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-11 16:40:17 +00:00
Restore logging, make WiFi creds settable from make
This commit is contained in:
1 parent
a9a94a6904
commit
b68da1548b
11 files changed
+74
-4
No files matched your search
@@ -16,3 +16,12 @@ pico_enable_stdio_usb(firmware 1) # Route stdio to USB
|
||||
|
||||
# Prevent extreme optimization from breaking OTA
|
||||
target_compile_options(firmware PRIVATE -fno-tree-loop-distribute-patterns)
|
||||
|
||||
# Wi-Fi credentials from the environment, e.g. make WIFI_NAME=... WIFI_PASS=...
|
||||
# Read when build/ is configured: run "make clean" after changing them
|
||||
if (DEFINED ENV{WIFI_NAME})
|
||||
target_compile_definitions(firmware PRIVATE "WIFI_NAME=\"$ENV{WIFI_NAME}\"")
|
||||
endif()
|
||||
if (DEFINED ENV{WIFI_PASS})
|
||||
target_compile_definitions(firmware PRIVATE "WIFI_PASS=\"$ENV{WIFI_PASS}\"")
|
||||
endif()
|
||||
@@ -23,9 +23,15 @@ static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
}
|
||||
}
|
||||
|
||||
static void log_fn(char ch, void *param) {
|
||||
(void) param;
|
||||
putchar(ch);
|
||||
}
|
||||
|
||||
// In an RTOS environment, give this task 8 KB of stack space.
|
||||
static void run_mongoose(void) {
|
||||
struct mg_mgr mgr;
|
||||
mg_log_set_fn(log_fn, NULL);
|
||||
mg_mgr_init(&mgr);
|
||||
mg_http_listen(&mgr, "http://0.0.0.0", http_ev_handler, NULL);
|
||||
|
||||
|
||||
@@ -3,8 +3,13 @@
|
||||
|
||||
#include "mongoose.h"
|
||||
|
||||
#define WIFI_NAME "YOUR_WIFI_NETWORK" // SET THIS!
|
||||
#define WIFI_PASS "YOUR_WIFI_PASSWORD" // SET THIS!
|
||||
// Set these, or pass on the command line: make WIFI_NAME=... WIFI_PASS=...
|
||||
#ifndef WIFI_NAME
|
||||
#define WIFI_NAME "YOUR_WIFI_NETWORK"
|
||||
#endif
|
||||
#ifndef WIFI_PASS
|
||||
#define WIFI_PASS "YOUR_WIFI_PASSWORD"
|
||||
#endif
|
||||
|
||||
// Access point setup
|
||||
#define ENABLE_AP false // Change to true to enable
|
||||
|
||||
Reference in new issue
Block a user