put wifi and server config in a separate file

This commit is contained in:
Crispy 2025-07-03 18:35:21 +02:00
parent cdccb0843c
commit 721a69e6cd
2 changed files with 14 additions and 8 deletions

View file

@ -3,20 +3,19 @@
#include "pico/cyw43_arch.h" #include "pico/cyw43_arch.h"
#include "pico/cyw43_driver.h" #include "pico/cyw43_driver.h"
#include "hardware/adc.h" #include "hardware/adc.h"
#include "lwip/tcp.h" #include "lwip/tcp.h"
#include "lwip/apps/http_client.h"
#include "wifi_cred.h"
#define u32 uint32_t #define u32 uint32_t
#define u16 uint16_t #define u16 uint16_t
#define u8 uint8_t #define u8 uint8_t
char ssid[] = "TODO"; char ssid[] = CONFIG_WIFI_SSID;
char pass[] = "secret"; char pass[] = CONFIG_WIFI_PASSWORD;
const ip_addr_t SERVER_IP = IPADDR4_INIT_BYTES(192, 168, 0, 108);
#define SERVER_PORT 25564
const ip_addr_t SERVER_IP = CONFIG_SERVER_IP;
#define SERVER_PORT CONFIG_SERVER_PORT
#define SET_LED(state) cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, state) #define SET_LED(state) cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, state)
@ -80,7 +79,6 @@ void update_encoder_value() {
rotary_encoder_bits |= !rotary_encoder_bit[b]; // inverse to make white = 0 rotary_encoder_bits |= !rotary_encoder_bit[b]; // inverse to make white = 0
} }
// const u8 reverse_gray_code[1 << ENCODER_BITS] = {0, 1, 3, 2, 7, 6, 4, 5};
// gray code: 0 1 5 7 3 2 6 4 // gray code: 0 1 5 7 3 2 6 4
// index: 0 1 2 3 4 5 6 7 // index: 0 1 2 3 4 5 6 7
// reverse : 0 1 5 4 7 2 6 3 // reverse : 0 1 5 4 7 2 6 3

8
pico/src/wifi_cred.h Normal file
View file

@ -0,0 +1,8 @@
#define CONFIG_WIFI_SSID "Wifi network here"
#define CONFIG_WIFI_PASSWORD "password123"
// local IP of the computer running the server software
// public IP would work too but requires port forwarding
#define CONFIG_SERVER_IP IPADDR4_INIT_BYTES(192, 168, 0, 108)
#define CONFIG_SERVER_PORT 13122