add wifi status led

");
");
");
");
");
");
");
", link_status);
This commit is contained in:
Travis Shears 2026-02-22 10:41:06 +01:00
parent 0dc7f23744
commit ca48e9a039
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 17 additions and 3 deletions

14
node1.c
View file

@ -8,6 +8,7 @@
#include <stdio.h> #include <stdio.h>
#define SENSOR_READING_INTERVAL_US (1000000 * 10) // 10 seconds #define SENSOR_READING_INTERVAL_US (1000000 * 10) // 10 seconds
#define WIFI_STATUS_LED_PIN 16
static tcp_client_config tcp_config; static tcp_client_config tcp_config;
static bme280_config bem_config; static bme280_config bem_config;
@ -23,6 +24,9 @@ static void send_msg(char *msg) {
} }
} }
void comms_led_init() {
}
int main() { int main() {
stdio_init_all(); stdio_init_all();
watchdog_enable(120000, 1); // 120 second watchdog watchdog_enable(120000, 1); // 120 second watchdog
@ -31,6 +35,11 @@ int main() {
printf("Initializing board...\n"); printf("Initializing board...\n");
sleep_ms(2000); sleep_ms(2000);
printf("Initializing WIFI status LED...\n");
gpio_init(WIFI_STATUS_LED_PIN);
gpio_set_dir(WIFI_STATUS_LED_PIN, GPIO_OUT);
gpio_put(WIFI_STATUS_LED_PIN, false);
printf("Initializing BME280...\n"); printf("Initializing BME280...\n");
bme280_init(&bem_config, i2c1, 14, 15); bme280_init(&bem_config, i2c1, 14, 15);
@ -106,18 +115,23 @@ int main() {
switch (link_status) { switch (link_status) {
case CYW43_LINK_DOWN: case CYW43_LINK_DOWN:
printf("DOWN\n"); printf("DOWN\n");
gpio_put(WIFI_STATUS_LED_PIN, false);
break; break;
case CYW43_LINK_JOIN: case CYW43_LINK_JOIN:
printf("JOINING\n"); printf("JOINING\n");
gpio_put(WIFI_STATUS_LED_PIN, false);
break; break;
case CYW43_LINK_NOIP: case CYW43_LINK_NOIP:
printf("NO IP\n"); printf("NO IP\n");
gpio_put(WIFI_STATUS_LED_PIN, false);
break; break;
case CYW43_LINK_UP: case CYW43_LINK_UP:
printf("UP\n"); printf("UP\n");
gpio_put(WIFI_STATUS_LED_PIN, true);
break; break;
default: default:
printf("UNKNOWN (%d)\n", link_status); printf("UNKNOWN (%d)\n", link_status);
gpio_put(WIFI_STATUS_LED_PIN, false);
break; break;
} }

View file

@ -1,9 +1,9 @@
task: create text based architecture diagram of event proxy task: create text based architecture diagram of event proxy
task: split event proxy into multiple files following the architecture pattern task: split event proxy into multiple files following the architecture pattern
task: add deps files to event proxy needed for MQTT
task: finish node1 by creating a M002 for the air quility sensor readings task: finish node1 by creating a M002 for the air quility sensor readings
------------------------------ ------------------------------
DONE task: get sending tempature, humidity, pressure working
DONE task: add deps files to event proxy needed for MQTT