diff --git a/handlers.h b/bmc_handler.h similarity index 94% rename from handlers.h rename to bmc_handler.h index 7f9ac40..2032d74 100644 --- a/handlers.h +++ b/bmc_handler.h @@ -1,5 +1,5 @@ -#ifndef HANDLERS_H -#define HANDLERS_H +#ifndef BMC_HANDLER_H +#define BMC_HANDLER_H #define PW_SWITCH_PIN 0 #define PW_SWITCH_DELAY_MS 100 diff --git a/main.c b/main.c index c1a6c95..25c41f0 100644 --- a/main.c +++ b/main.c @@ -2,10 +2,18 @@ #define DEBUG_printf printf #include "pico_lib.h" -#include "handlers.h" +#include "bmc_handler.h" #include "http_serv.h" #include "secret.h" +void set_host_name(const char * hostname) { + cyw43_arch_lwip_begin(); + struct netif *n = &cyw43_state.netif[CYW43_ITF_STA]; + netif_set_hostname(n, hostname); + netif_set_up(n); + cyw43_arch_lwip_end(); +} + int main() { stdio_init_all(); @@ -15,6 +23,8 @@ int main() { } cyw43_arch_enable_sta_mode(); + set_host_name(BMC_HOSTNAME); + DEBUG_printf("[INIT] [OK ] Set hostname to %s\n", BMC_HOSTNAME); if (cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASS, CYW43_AUTH_WPA2_AES_PSK, 30000)){ DEBUG_printf("[INIT] [ERR] Wi-Fi failed to connect\n"); diff --git a/template.secret.h b/template.secret.h index 2e3d414..0d1df2f 100644 --- a/template.secret.h +++ b/template.secret.h @@ -1,6 +1,7 @@ #ifndef SECRET_H #define SECRET_H +const char BMC_HOSTNAME[] = "pico_bmc"; const char WIFI_SSID[] = "ssid"; const char WIFI_PASS[] = "pass";