aboutsummaryrefslogtreecommitdiff
path: root/main/tcp_server.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-12-01 21:29:34 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-12-01 21:29:34 -0700
commit05e3f6bb7293c771629c7b3599392c8f335e7dd8 (patch)
treec2a5cd4d27d7673b3a58071c0656f87c92ee9ff3 /main/tcp_server.c
parent8d379bf60e50960f6c855cd6b9c83956a082f73d (diff)
downloadesp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.tar.gz
esp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.tar.bz2
esp32-ws2812b-05e3f6bb7293c771629c7b3599392c8f335e7dd8.zip
Add an HTTP Server.
This server allows the user to control the parameters of the state for displaying the lights.
Diffstat (limited to 'main/tcp_server.c')
-rw-r--r--main/tcp_server.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/tcp_server.c b/main/tcp_server.c
index 434f014..2ee7e51 100644
--- a/main/tcp_server.c
+++ b/main/tcp_server.c
@@ -130,7 +130,7 @@ static void handle_set_cmd(
{
if (false) {}
-#define STATE_PARAM(ty, attr) \
+#define STATE_PARAM(ty, attr, ...) \
else if (!strcmp_(key, #attr)) { \
handle_ ## ty ## _option(#attr, sockbuf, &ws_params->state. attr); \
}
@@ -147,7 +147,7 @@ static void handle_set_cmd(
static void print_uint32_t(sockbuf_t* sockbuf, const char* attr, uint32_t val)
{
char buf[128];
- snprintf(buf, sizeof(buf), "%s: %d :: uint32_t\n", attr, val);
+ snprintf(buf, sizeof(buf), "%s: %ld :: uint32_t\n", attr, val);
sockbuf_write(sockbuf, buf);
}
@@ -174,7 +174,7 @@ static void print_int(sockbuf_t* sockbuf, const char* attr, int val)
static void handle_print_cmd(sockbuf_t* sockbuf, ws_params_t* ws_params)
{
-#define STATE_PARAM(ty, attr) \
+#define STATE_PARAM(ty, attr, ...) \
print_ ## ty ( sockbuf, #attr, ws_params->state. attr );
#include "state_params.i"
#undef STATE_PARAM
@@ -215,8 +215,6 @@ portTASK_FUNCTION(tcp_server, params)
{
ws_params_t* ws_params = (ws_params_t*) params;
- wifi_init_station("Wort", "JoshIsBau5");
-
int s = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));