updated the webserver to properly use post
This commit is contained in:
45
src/main.cpp
45
src/main.cpp
@@ -4,11 +4,11 @@
|
||||
#include "lwip/apps/httpd.h"
|
||||
#include "pico/cyw43_arch.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "webserver.h"
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
void ap_init() {
|
||||
/* void ap_init() {
|
||||
cyw43_arch_enable_ap_mode("SensorAP", "passwort123", CYW43_AUTH_WPA2_AES_PSK);
|
||||
|
||||
ip_addr_t gw{};
|
||||
@@ -18,38 +18,41 @@ void ap_init() {
|
||||
|
||||
static dhcp_server_t dhcp_server{};
|
||||
dhcp_server_init(&dhcp_server, &gw, &mask);
|
||||
}
|
||||
} */
|
||||
|
||||
int main() {
|
||||
|
||||
int ret{};
|
||||
stdio_init_all();
|
||||
sleep_ms(3000);
|
||||
cyw43_arch_init();
|
||||
httpd_init();
|
||||
webserver_init();
|
||||
|
||||
while (true) {
|
||||
memset(saved_ssid, 0, sizeof(saved_ssid));
|
||||
memset(saved_password, 0, sizeof(saved_password));
|
||||
ap_init();
|
||||
/* memset(saved_ssid, 0, sizeof(saved_ssid));
|
||||
memset(saved_password, 0, sizeof(saved_password));
|
||||
ap_init(); */
|
||||
printf("Return Code: %d\n", ret);
|
||||
|
||||
while (saved_ssid[0] == '\0') {
|
||||
cyw43_arch_poll();
|
||||
sleep_ms(100);
|
||||
}
|
||||
cyw43_arch_disable_ap_mode();
|
||||
/* while (saved_ssid[0] == '\0') {
|
||||
cyw43_arch_poll();
|
||||
sleep_ms(100);
|
||||
} */
|
||||
// cyw43_arch_disable_ap_mode();
|
||||
cyw43_arch_enable_sta_mode();
|
||||
|
||||
if (!(cyw43_arch_wifi_connect_timeout_ms(saved_ssid, saved_password,
|
||||
CYW43_AUTH_WPA2_AES_PSK, 20000))) {
|
||||
ret = cyw43_arch_wifi_connect_timeout_ms("HainerErnst-IoT",
|
||||
"vpUaR68xLZzXanS7",
|
||||
CYW43_AUTH_WPA2_MIXED_PSK, 10000);
|
||||
if (ret == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
|
||||
sleep_ms(200);
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
|
||||
sleep_ms(200);
|
||||
while (true) {
|
||||
cyw43_arch_poll();
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
|
||||
sleep_ms(100);
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
|
||||
sleep_ms(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user