From 19d200108e3fb098e2fcc2dc06ef09318a6f5e87 Mon Sep 17 00:00:00 2001 From: cuav-chen2 Date: Sat, 15 Feb 2025 09:32:07 +0800 Subject: [PATCH 1/3] supports WS2812 LED number configuration --- RemoteIDModule/board_config.h | 8 ++++++++ RemoteIDModule/led.cpp | 6 +++++- RemoteIDModule/led.h | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RemoteIDModule/board_config.h b/RemoteIDModule/board_config.h index 1070732..47a2995 100644 --- a/RemoteIDModule/board_config.h +++ b/RemoteIDModule/board_config.h @@ -13,6 +13,7 @@ #define PIN_UART_RX 17 #define WS2812_LED_PIN GPIO_NUM_48 +#define WS2812_LED_NUM 1 #elif defined(BOARD_ESP32C3_DEV) #define BOARD_ID 2 @@ -23,6 +24,7 @@ #define PIN_UART_RX 2 #define WS2812_LED_PIN GPIO_NUM_8 +#define WS2812_LED_NUM 1 #elif defined(BOARD_BLUEMARK_DB200) #define BOARD_ID 3 @@ -77,6 +79,8 @@ #define PIN_UART_RX 5 #define WS2812_LED_PIN GPIO_NUM_2 +#define WS2812_LED_NUM 1 + #define CAN_APP_NODE_NAME "mRobotics RemoteID" #elif defined(BOARD_JWRID_ESP32S3) @@ -88,6 +92,7 @@ #define PIN_UART_RX 36 #define WS2812_LED_PIN GPIO_NUM_5 +#define WS2812_LED_NUM 1 #define CAN_APP_NODE_NAME "JWRID_ESP32S3" @@ -119,6 +124,7 @@ #define BUZZER_PIN GPIO_NUM_39 //at the moment easiest is to have active buzzer support. (Buzzer on if GPIO is high) #define WS2812_LED_PIN GPIO_NUM_8 //there are two WS2812 LEDs on this GPIO +#define WS2812_LED_NUM 2 #define CAN_APP_NODE_NAME "BlueMark DB210PRO" //#define PIN_CAN_TERM GPIO_NUM_42 // if set to ON, the termination resistors of the CAN bus are enabled @@ -148,6 +154,7 @@ #define PIN_UART_RX 2 #define WS2812_LED_PIN GPIO_NUM_8 +#define WS2812_LED_NUM 1 #elif defined(BOARD_CUAV_RID) #define BOARD_ID 12 @@ -159,6 +166,7 @@ #define PIN_UART_RX 17 #define WS2812_LED_PIN GPIO_NUM_48 +#define WS2812_LED_NUM 1 #define PIN_CAN_TERM GPIO_NUM_37 #define CAN_TERM_EN LOW diff --git a/RemoteIDModule/led.cpp b/RemoteIDModule/led.cpp index 49d133f..d550cc3 100644 --- a/RemoteIDModule/led.cpp +++ b/RemoteIDModule/led.cpp @@ -48,12 +48,16 @@ void Led::update(void) switch (state) { case LedState::ARM_OK: ledStrip.setPixelColor(0, ledStrip.Color(0, 255, 0)); - ledStrip.setPixelColor(0, ledStrip.Color(1, 255, 0)); //for db210pro, set the second LED to have the same output (for now) +#if WS2812_LED_NUM > 1 + ledStrip.setPixelColor(1, ledStrip.Color(0, 255, 0)); //for db210pro, set the second LED to have the same output (for now) +#endif break; default: ledStrip.setPixelColor(0, ledStrip.Color(255, 0, 0)); +#if WS2812_LED_NUM > 1 ledStrip.setPixelColor(1, ledStrip.Color(255, 0, 0)); //for db210pro, set the second LED to have the same output (for now) +#endif break; } if (now_ms - last_led_strip_ms >= 200) { diff --git a/RemoteIDModule/led.h b/RemoteIDModule/led.h index 3f193f6..6a1c63e 100644 --- a/RemoteIDModule/led.h +++ b/RemoteIDModule/led.h @@ -29,7 +29,7 @@ class Led { #ifdef WS2812_LED_PIN uint32_t last_led_strip_ms; - Adafruit_NeoPixel ledStrip{2, WS2812_LED_PIN, NEO_GRB + NEO_KHZ800}; //the BlueMark db210pro boards has two LEDs, therefore we need to use 2. + Adafruit_NeoPixel ledStrip{WS2812_LED_NUM, WS2812_LED_PIN, NEO_GRB + NEO_KHZ800}; #endif }; From d961e6b9d05db57816729924c82a2e276b223ae8 Mon Sep 17 00:00:00 2001 From: cuav-chen2 Date: Sat, 15 Feb 2025 09:35:32 +0800 Subject: [PATCH 2/3] support SSID prefix configuration --- RemoteIDModule/board_config.h | 2 ++ RemoteIDModule/parameters.cpp | 2 +- RemoteIDModule/parameters.h | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RemoteIDModule/board_config.h b/RemoteIDModule/board_config.h index 47a2995..6e82c75 100644 --- a/RemoteIDModule/board_config.h +++ b/RemoteIDModule/board_config.h @@ -172,6 +172,8 @@ #define CAN_TERM_EN LOW #define CAN_APP_NODE_NAME "net.cuav.c-rid" +#define WIFI_SSID_PREFIX "C-RID" + #else #error "unsupported board" #endif diff --git a/RemoteIDModule/parameters.cpp b/RemoteIDModule/parameters.cpp index 9acd4ab..0b071f9 100644 --- a/RemoteIDModule/parameters.cpp +++ b/RemoteIDModule/parameters.cpp @@ -346,7 +346,7 @@ void Parameters::init(void) if (strlen(g.wifi_ssid) == 0) { uint8_t mac[6] {}; esp_read_mac(mac, ESP_MAC_WIFI_STA); - snprintf(wifi_ssid, 20, "RID_%02x%02x%02x%02x%02x%02x", + snprintf(wifi_ssid, 20, WIFI_SSID_PREFIX "_%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } diff --git a/RemoteIDModule/parameters.h b/RemoteIDModule/parameters.h index 38c05d8..df1422c 100644 --- a/RemoteIDModule/parameters.h +++ b/RemoteIDModule/parameters.h @@ -11,6 +11,10 @@ #define PARAM_FLAG_PASSWORD (1U<<0) #define PARAM_FLAG_HIDDEN (1U<<1) +#ifndef WIFI_SSID_PREFIX +#define WIFI_SSID_PREFIX "RID" +#endif + class Parameters { public: #if defined(PIN_CAN_TERM) From d88d186e26d2fd51264c94fec7adc4db333e0017 Mon Sep 17 00:00:00 2001 From: cuav-chen2 Date: Sat, 15 Feb 2025 09:36:46 +0800 Subject: [PATCH 3/3] support wifi password configuration --- RemoteIDModule/board_config.h | 1 + RemoteIDModule/parameters.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RemoteIDModule/board_config.h b/RemoteIDModule/board_config.h index 6e82c75..fa8e107 100644 --- a/RemoteIDModule/board_config.h +++ b/RemoteIDModule/board_config.h @@ -173,6 +173,7 @@ #define CAN_APP_NODE_NAME "net.cuav.c-rid" #define WIFI_SSID_PREFIX "C-RID" +#define WIFI_PASSWORD "cuav12345678" #else #error "unsupported board" diff --git a/RemoteIDModule/parameters.h b/RemoteIDModule/parameters.h index df1422c..1e727a1 100644 --- a/RemoteIDModule/parameters.h +++ b/RemoteIDModule/parameters.h @@ -15,6 +15,10 @@ #define WIFI_SSID_PREFIX "RID" #endif +#ifndef WIFI_PASSWORD +#define WIFI_PASSWORD "ArduRemoteID" +#endif + class Parameters { public: #if defined(PIN_CAN_TERM) @@ -41,7 +45,7 @@ class Parameters { uint8_t webserver_enable; uint8_t mavlink_sysid; char wifi_ssid[21] = ""; - char wifi_password[21] = "ArduRemoteID"; + char wifi_password[21] = WIFI_PASSWORD; uint8_t wifi_channel = 6; uint8_t to_factory_defaults = 0; uint8_t options;