feat: Implement Ethernet and Wi-Fi network connectivity with LED status indication and configuration.
This commit is contained in:
@@ -7,7 +7,13 @@
|
||||
// Could be a config but its the GPIO on my ESP32-S3-ETH
|
||||
#define LED_GPIO GPIO_NUM_21
|
||||
|
||||
enum class led_status : uint8 { Connecting, Ready, Failed };
|
||||
enum class led_status : uint8 {
|
||||
ConnectingEthernet,
|
||||
ConnectingWifi,
|
||||
ReadyEthernet,
|
||||
ReadyWifi,
|
||||
Failed
|
||||
};
|
||||
|
||||
internal led_strip_handle_t led_strip;
|
||||
|
||||
@@ -30,11 +36,17 @@ internal void destroy_led(void) { led_strip_clear(led_strip); }
|
||||
|
||||
internal void set_led_status(led_status status) {
|
||||
switch (status) {
|
||||
case led_status::Connecting:
|
||||
led_strip_set_pixel(led_strip, 0, 255, 255, 0);
|
||||
case led_status::ConnectingEthernet:
|
||||
led_strip_set_pixel(led_strip, 0, 255, 165, 0);
|
||||
break;
|
||||
case led_status::Ready:
|
||||
led_strip_set_pixel(led_strip, 0, 0, 255, 0);
|
||||
case led_status::ConnectingWifi:
|
||||
led_strip_set_pixel(led_strip, 0, 148, 0, 211);
|
||||
break;
|
||||
case led_status::ReadyEthernet:
|
||||
led_strip_set_pixel(led_strip, 0, 0, 255, 0); // Green
|
||||
break;
|
||||
case led_status::ReadyWifi:
|
||||
led_strip_set_pixel(led_strip, 0, 0, 0, 255); // Blue
|
||||
break;
|
||||
case led_status::Failed:
|
||||
led_strip_set_pixel(led_strip, 0, 255, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user