2023-11-07 20:26:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Adafruit_NeoPixel.h>
|
2023-11-30 21:38:01 +00:00
|
|
|
#include <Arduino.h>
|
2023-11-18 13:03:47 +00:00
|
|
|
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <freertos/task.h>
|
2023-11-07 20:26:15 +00:00
|
|
|
|
2023-11-30 21:56:50 +00:00
|
|
|
#include "lib/shared.hpp"
|
|
|
|
#include "lib/webserver.hpp"
|
|
|
|
|
2023-11-08 11:18:59 +00:00
|
|
|
#ifndef NEOPIXEL_PIN
|
|
|
|
#define NEOPIXEL_PIN 34
|
|
|
|
#endif
|
|
|
|
#ifndef NEOPIXEL_COUNT
|
|
|
|
#define NEOPIXEL_COUNT 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const int LED_FLASH_ERROR = 0;
|
|
|
|
const int LED_FLASH_SUCCESS = 1;
|
|
|
|
const int LED_FLASH_UPDATE = 2;
|
|
|
|
const int LED_FLASH_BLOCK_NOTIFY = 3;
|
|
|
|
const int LED_EFFECT_START_TIMER = 4;
|
|
|
|
const int LED_EFFECT_PAUSE_TIMER = 5;
|
2023-11-14 15:55:18 +00:00
|
|
|
const int LED_EFFECT_HEARTBEAT = 6;
|
2023-11-10 12:02:05 +00:00
|
|
|
const int LED_EFFECT_WIFI_WAIT_FOR_CONFIG = 100;
|
|
|
|
const int LED_EFFECT_WIFI_CONNECTING = 101;
|
|
|
|
const int LED_EFFECT_WIFI_CONNECT_ERROR = 102;
|
|
|
|
const int LED_EFFECT_WIFI_CONNECT_SUCCESS = 103;
|
2023-11-10 18:52:06 +00:00
|
|
|
const int LED_EFFECT_WIFI_ERASE_SETTINGS = 104;
|
2024-01-31 22:45:26 +00:00
|
|
|
|
2023-11-12 23:33:48 +00:00
|
|
|
const int LED_PROGRESS_25 = 200;
|
|
|
|
const int LED_PROGRESS_50 = 201;
|
|
|
|
const int LED_PROGRESS_75 = 202;
|
|
|
|
const int LED_PROGRESS_100 = 203;
|
2024-01-31 22:45:26 +00:00
|
|
|
|
|
|
|
const int LED_DATA_PRICE_ERROR = 300;
|
|
|
|
const int LED_DATA_BLOCK_ERROR = 301;
|
2024-05-18 23:32:45 +00:00
|
|
|
const int LED_FLASH_IDENTIFY = 990;
|
2023-11-10 18:52:06 +00:00
|
|
|
const int LED_POWER_TEST = 999;
|
2023-11-07 20:26:15 +00:00
|
|
|
extern TaskHandle_t ledTaskHandle;
|
2023-11-12 23:33:48 +00:00
|
|
|
extern Adafruit_NeoPixel pixels;
|
2023-11-07 20:26:15 +00:00
|
|
|
|
|
|
|
void ledTask(void *pvParameters);
|
2023-11-08 11:18:59 +00:00
|
|
|
void setupLeds();
|
2023-11-07 20:26:15 +00:00
|
|
|
void setupLedTask();
|
2023-11-08 11:18:59 +00:00
|
|
|
void blinkDelay(int d, int times);
|
|
|
|
void blinkDelayColor(int d, int times, uint r, uint g, uint b);
|
|
|
|
void blinkDelayTwoColor(int d, int times, uint32_t c1, uint32_t c2);
|
|
|
|
void clearLeds();
|
2023-11-18 13:03:47 +00:00
|
|
|
void saveLedState();
|
|
|
|
void restoreLedState();
|
2023-11-08 11:18:59 +00:00
|
|
|
QueueHandle_t getLedTaskQueue();
|
|
|
|
bool queueLedEffect(uint effect);
|
2023-11-08 14:27:22 +00:00
|
|
|
void setLights(int r, int g, int b);
|
2023-11-12 23:33:48 +00:00
|
|
|
void setLights(uint32_t color);
|
|
|
|
void ledRainbow(int wait);
|
|
|
|
void ledTheaterChaseRainbow(int wait);
|
|
|
|
void ledTheaterChase(uint32_t color, int wait);
|
2024-04-27 14:48:06 +00:00
|
|
|
Adafruit_NeoPixel getPixels();
|
|
|
|
|
|
|
|
#ifdef HAS_FRONTLIGHT
|
2024-06-07 23:00:52 +00:00
|
|
|
void frontlightFlash(int flDelayTime);
|
2024-04-27 14:48:06 +00:00
|
|
|
void frontlightFadeInAll();
|
|
|
|
void frontlightFadeOutAll();
|
|
|
|
void frontlightFadeIn(uint num);
|
|
|
|
void frontlightFadeOut(uint num);
|
2024-06-07 23:00:52 +00:00
|
|
|
|
|
|
|
void frontlightSetBrightness(uint brightness);
|
|
|
|
|
|
|
|
void frontlightFadeInAll(int flDelayTime);
|
|
|
|
void frontlightFadeInAll(int flDelayTime, bool staggered);
|
|
|
|
void frontlightFadeOutAll(int flDelayTime);
|
|
|
|
void frontlightFadeOutAll(int flDelayTime, bool staggered);
|
|
|
|
|
|
|
|
void frontlightFadeIn(uint num, int flDelayTime);
|
|
|
|
void frontlightFadeOut(uint num, int flDelayTime);
|
2024-04-27 14:48:06 +00:00
|
|
|
#endif
|