Все работает, просто usb плохо припаял

Переделал дефолтные значения цветов: теперь они выставляются если настройка не найдена
This commit is contained in:
Razvalyaev 2025-05-21 03:14:26 +03:00
parent a3a3498bc3
commit 220e0b9e2e
3 changed files with 9 additions and 8 deletions

View File

@ -86,10 +86,10 @@ void LedControl::setupBLEService(BLEServer *server) {
void LedControl::loadSettings() { void LedControl::loadSettings() {
preferences.begin(LED_NAMESPACE, true); preferences.begin(LED_NAMESPACE, true);
currentR = preferences.getUChar("r", 0); currentR = preferences.getUChar("r", RED_DEFAULT);
currentG = preferences.getUChar("g", 0); currentG = preferences.getUChar("g", GREEN_DEFAULT);
currentB = preferences.getUChar("b", 0); currentB = preferences.getUChar("b", BLUE_DEFAULT);
currentBrightness = preferences.getUChar("br", 0); currentBrightness = preferences.getUChar("br", BRIGHT_DEFAULT);
preferences.end(); preferences.end();
} }

View File

@ -15,6 +15,11 @@
#define COLOR_CHAR_B_UUID "12345678-1234-5678-1234-56789abcdef3" #define COLOR_CHAR_B_UUID "12345678-1234-5678-1234-56789abcdef3"
#define COLOR_CHAR_BRIGHTNESS_UUID "12345678-1234-5678-1234-56789abcdef4" #define COLOR_CHAR_BRIGHTNESS_UUID "12345678-1234-5678-1234-56789abcdef4"
#define RED_DEFAULT 255
#define GREEN_DEFAULT 0
#define BLUE_DEFAULT 255
#define BRIGHT_DEFAULT 50
class LedControl { class LedControl {
public: public:
LedControl(Adafruit_NeoPixel &led) LedControl(Adafruit_NeoPixel &led)

View File

@ -5,10 +5,6 @@
#define LED_PIN 21 // GPIO пин светодиода (скорее всего 48) #define LED_PIN 21 // GPIO пин светодиода (скорее всего 48)
#define NUM_LEDS 1 // Один RGB светодиод #define NUM_LEDS 1 // Один RGB светодиод
#define RED_DEFAULT 255
#define GREEN_DEFAULT 0
#define BLUE_DEFAULT 255
#define BRIGHT_DEFAULT 50
// #define DISABLE_RGB_UUID // #define DISABLE_RGB_UUID
// #define DISABLE_USB // #define DISABLE_USB