2020-03-31 02:38:08 +02:00
|
|
|
#ifndef WLED_CONST_H
|
|
|
|
#define WLED_CONST_H
|
2020-02-19 15:53:42 +01:00
|
|
|
|
2020-04-07 00:04:09 +02:00
|
|
|
/*
|
|
|
|
* Readability defines and their associated numerical values + compile-time constants
|
|
|
|
*/
|
|
|
|
|
2020-02-24 18:48:21 +01:00
|
|
|
//Defaults
|
|
|
|
#define DEFAULT_CLIENT_SSID "Your_Network"
|
|
|
|
#define DEFAULT_AP_PASS "wled1234"
|
|
|
|
#define DEFAULT_OTA_PASS "wledota"
|
|
|
|
|
2020-05-28 02:20:02 +02:00
|
|
|
//increase if you need more
|
2021-05-07 12:41:39 +02:00
|
|
|
#ifndef WLED_MAX_USERMODS
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define WLED_MAX_USERMODS 4
|
|
|
|
#else
|
|
|
|
#define WLED_MAX_USERMODS 6
|
|
|
|
#endif
|
|
|
|
#endif
|
2020-05-28 02:20:02 +02:00
|
|
|
|
2021-05-07 12:41:39 +02:00
|
|
|
#ifndef WLED_MAX_BUSSES
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define WLED_MAX_BUSSES 3
|
|
|
|
#else
|
|
|
|
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
|
|
|
#define WLED_MAX_BUSSES 5
|
|
|
|
#else
|
|
|
|
#define WLED_MAX_BUSSES 10
|
|
|
|
#endif
|
|
|
|
#endif
|
2020-12-01 00:33:47 +01:00
|
|
|
#endif
|
|
|
|
|
2021-05-20 19:54:07 +02:00
|
|
|
#ifndef WLED_MAX_BUTTONS
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define WLED_MAX_BUTTONS 2
|
|
|
|
#else
|
|
|
|
#define WLED_MAX_BUTTONS 4
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2020-05-28 02:20:02 +02:00
|
|
|
//Usermod IDs
|
2021-05-20 19:54:07 +02:00
|
|
|
#define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present
|
|
|
|
#define USERMOD_ID_UNSPECIFIED 1 //Default value for a general user mod that does not specify a custom ID
|
|
|
|
#define USERMOD_ID_EXAMPLE 2 //Usermod "usermod_v2_example.h"
|
|
|
|
#define USERMOD_ID_TEMPERATURE 3 //Usermod "usermod_temperature.h"
|
|
|
|
#define USERMOD_ID_FIXNETSERVICES 4 //Usermod "usermod_Fix_unreachable_netservices.h"
|
|
|
|
#define USERMOD_ID_PIRSWITCH 5 //Usermod "usermod_PIR_sensor_switch.h"
|
|
|
|
#define USERMOD_ID_IMU 6 //Usermod "usermod_mpu6050_imu.h"
|
|
|
|
#define USERMOD_ID_FOUR_LINE_DISP 7 //Usermod "usermod_v2_four_line_display.h
|
|
|
|
#define USERMOD_ID_ROTARY_ENC_UI 8 //Usermod "usermod_v2_rotary_encoder_ui.h"
|
|
|
|
#define USERMOD_ID_AUTO_SAVE 9 //Usermod "usermod_v2_auto_save.h"
|
|
|
|
#define USERMOD_ID_DHT 10 //Usermod "usermod_dht.h"
|
|
|
|
#define USERMOD_ID_MODE_SORT 11 //Usermod "usermod_v2_mode_sort.h"
|
|
|
|
#define USERMOD_ID_VL53L0X 12 //Usermod "usermod_vl53l0x_gestures.h"
|
|
|
|
#define USERMOD_ID_MULTI_RELAY 13 //Usermod "usermod_multi_relay.h"
|
|
|
|
#define USERMOD_ID_ANIMATED_STAIRCASE 14 //Usermod "Animated_Staircase.h"
|
2021-05-28 10:03:27 +02:00
|
|
|
#define USERMOD_ID_RTC 15 //Usermod "usermod_rtc.h"
|
|
|
|
#define USERMOD_ID_ELEKSTUBE_IPS 16 //Usermod "usermod_elekstube_ips.h"
|
2020-05-28 02:20:02 +02:00
|
|
|
|
2020-02-19 15:53:42 +01:00
|
|
|
//Access point behavior
|
2021-05-20 19:54:07 +02:00
|
|
|
#define AP_BEHAVIOR_BOOT_NO_CONN 0 //Open AP when no connection after boot
|
|
|
|
#define AP_BEHAVIOR_NO_CONN 1 //Open when no connection (either after boot or if connection is lost)
|
|
|
|
#define AP_BEHAVIOR_ALWAYS 2 //Always open
|
|
|
|
#define AP_BEHAVIOR_BUTTON_ONLY 3 //Only when button pressed for 6 sec
|
2020-02-19 15:53:42 +01:00
|
|
|
|
2020-02-22 16:17:32 +01:00
|
|
|
//Notifier callMode
|
2021-05-20 19:54:07 +02:00
|
|
|
#define NOTIFIER_CALL_MODE_INIT 0 //no updates on init, can be used to disable updates
|
2020-02-22 16:17:32 +01:00
|
|
|
#define NOTIFIER_CALL_MODE_DIRECT_CHANGE 1
|
|
|
|
#define NOTIFIER_CALL_MODE_BUTTON 2
|
|
|
|
#define NOTIFIER_CALL_MODE_NOTIFICATION 3
|
|
|
|
#define NOTIFIER_CALL_MODE_NIGHTLIGHT 4
|
|
|
|
#define NOTIFIER_CALL_MODE_NO_NOTIFY 5
|
2021-05-20 19:54:07 +02:00
|
|
|
#define NOTIFIER_CALL_MODE_FX_CHANGED 6 //no longer used
|
2020-02-22 16:17:32 +01:00
|
|
|
#define NOTIFIER_CALL_MODE_HUE 7
|
|
|
|
#define NOTIFIER_CALL_MODE_PRESET_CYCLE 8
|
|
|
|
#define NOTIFIER_CALL_MODE_BLYNK 9
|
|
|
|
#define NOTIFIER_CALL_MODE_ALEXA 10
|
|
|
|
|
2020-02-20 00:45:09 +01:00
|
|
|
//RGB to RGBW conversion mode
|
|
|
|
#define RGBW_MODE_MANUAL_ONLY 0 //No automatic white channel calculation. Manual white channel slider
|
|
|
|
#define RGBW_MODE_AUTO_BRIGHTER 1 //New algorithm. Adds as much white as the darkest RGBW channel
|
|
|
|
#define RGBW_MODE_AUTO_ACCURATE 2 //New algorithm. Adds as much white as the darkest RGBW channel and subtracts this amount from each RGB channel
|
|
|
|
#define RGBW_MODE_DUAL 3 //Manual slider + auto calculation. Automatically calculates only if manual slider is set to off (0)
|
|
|
|
#define RGBW_MODE_LEGACY 4 //Old floating algorithm. Too slow for realtime and palette support
|
|
|
|
|
2020-02-19 15:53:42 +01:00
|
|
|
//realtime modes
|
|
|
|
#define REALTIME_MODE_INACTIVE 0
|
|
|
|
#define REALTIME_MODE_GENERIC 1
|
|
|
|
#define REALTIME_MODE_UDP 2
|
|
|
|
#define REALTIME_MODE_HYPERION 3
|
|
|
|
#define REALTIME_MODE_E131 4
|
|
|
|
#define REALTIME_MODE_ADALIGHT 5
|
2020-04-13 00:42:27 +02:00
|
|
|
#define REALTIME_MODE_ARTNET 6
|
2020-05-18 16:36:31 +02:00
|
|
|
#define REALTIME_MODE_TPM2NET 7
|
2020-09-28 16:29:01 +02:00
|
|
|
#define REALTIME_MODE_DDP 8
|
2020-02-19 15:53:42 +01:00
|
|
|
|
2020-04-30 01:52:36 +02:00
|
|
|
//realtime override modes
|
|
|
|
#define REALTIME_OVERRIDE_NONE 0
|
|
|
|
#define REALTIME_OVERRIDE_ONCE 1
|
|
|
|
#define REALTIME_OVERRIDE_ALWAYS 2
|
|
|
|
|
2020-02-19 15:53:42 +01:00
|
|
|
//E1.31 DMX modes
|
2020-02-24 17:25:40 +01:00
|
|
|
#define DMX_MODE_DISABLED 0 //not used
|
|
|
|
#define DMX_MODE_SINGLE_RGB 1 //all LEDs same RGB color (3 channels)
|
|
|
|
#define DMX_MODE_SINGLE_DRGB 2 //all LEDs same RGB color and master dimmer (4 channels)
|
|
|
|
#define DMX_MODE_EFFECT 3 //trigger standalone effects of WLED (11 channels)
|
|
|
|
#define DMX_MODE_MULTIPLE_RGB 4 //every LED is addressed with its own RGB (ledCount * 3 channels)
|
|
|
|
#define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels)
|
2020-11-27 11:37:39 +01:00
|
|
|
#define DMX_MODE_MULTIPLE_RGBW 6 //every LED is addressed with its own RGBW (ledCount * 4 channels)
|
2020-02-24 17:25:40 +01:00
|
|
|
|
2020-11-04 11:04:40 +01:00
|
|
|
//Light capability byte (unused) 0bRRCCTTTT
|
|
|
|
//bits 0/1/2/3: specifies a type of LED driver. A single "driver" may have different chip models but must have the same protocol/behavior
|
|
|
|
//bits 4/5: specifies the class of LED driver - 0b00 (dec. 0-15) unconfigured/reserved
|
|
|
|
// - 0b01 (dec. 16-31) digital (data pin only)
|
|
|
|
// - 0b10 (dec. 32-47) analog (PWM)
|
|
|
|
// - 0b11 (dec. 48-63) digital (data + clock / SPI)
|
|
|
|
//bits 6/7 are reserved and set to 0b00
|
|
|
|
|
2020-03-04 11:45:25 +01:00
|
|
|
#define TYPE_NONE 0 //light is not configured
|
|
|
|
#define TYPE_RESERVED 1 //unused. Might indicate a "virtual" light
|
2020-11-04 11:04:40 +01:00
|
|
|
//Digital types (data pin only) (16-31)
|
|
|
|
#define TYPE_WS2812_1CH 20 //white-only chips
|
|
|
|
#define TYPE_WS2812_WWA 21 //amber + warm + cold white
|
|
|
|
#define TYPE_WS2812_RGB 22
|
|
|
|
#define TYPE_GS8608 23 //same driver as WS2812, but will require signal 2x per second (else displays test pattern)
|
|
|
|
#define TYPE_WS2811_400KHZ 24 //half-speed WS2812 protocol, used by very old WS2811 units
|
|
|
|
#define TYPE_SK6812_RGBW 30
|
2021-01-26 01:58:34 +01:00
|
|
|
#define TYPE_TM1814 31
|
2020-11-11 15:50:15 +01:00
|
|
|
//"Analog" types (PWM) (32-47)
|
|
|
|
#define TYPE_ONOFF 40 //binary output (relays etc.)
|
2020-11-04 11:04:40 +01:00
|
|
|
#define TYPE_ANALOG_1CH 41 //single channel PWM. Uses value of brightest RGBW channel
|
|
|
|
#define TYPE_ANALOG_2CH 42 //analog WW + CW
|
|
|
|
#define TYPE_ANALOG_3CH 43 //analog RGB
|
|
|
|
#define TYPE_ANALOG_4CH 44 //analog RGBW
|
|
|
|
#define TYPE_ANALOG_5CH 45 //analog RGB + WW + CW
|
|
|
|
//Digital types (data + clock / SPI) (48-63)
|
|
|
|
#define TYPE_WS2801 50
|
|
|
|
#define TYPE_APA102 51
|
|
|
|
#define TYPE_LPD8806 52
|
|
|
|
#define TYPE_P9813 53
|
|
|
|
|
2021-05-07 12:41:39 +02:00
|
|
|
#define IS_DIGITAL(t) ((t) & 0x10) //digital are 16-31 and 48-63
|
|
|
|
#define IS_PWM(t) ((t) > 40 && (t) < 46)
|
|
|
|
#define NUM_PWM_PINS(t) ((t) - 40) //for analog PWM 41-45 only
|
|
|
|
#define IS_2PIN(t) ((t) > 47)
|
2020-11-04 11:04:40 +01:00
|
|
|
|
2020-11-27 23:59:00 +01:00
|
|
|
//Color orders
|
|
|
|
#define COL_ORDER_GRB 0 //GRB(w),defaut
|
|
|
|
#define COL_ORDER_RGB 1 //common for WS2811
|
|
|
|
#define COL_ORDER_BRG 2
|
|
|
|
#define COL_ORDER_RBG 3
|
|
|
|
#define COL_ORDER_BGR 4
|
|
|
|
#define COL_ORDER_GBR 5
|
|
|
|
|
|
|
|
|
2020-11-04 11:04:40 +01:00
|
|
|
//Button type
|
|
|
|
#define BTN_TYPE_NONE 0
|
|
|
|
#define BTN_TYPE_RESERVED 1
|
|
|
|
#define BTN_TYPE_PUSH 2
|
2021-05-20 19:54:07 +02:00
|
|
|
#define BTN_TYPE_PUSH_ACT_HIGH 3
|
2021-04-12 00:45:33 +02:00
|
|
|
#define BTN_TYPE_SWITCH 4
|
2021-05-20 19:54:07 +02:00
|
|
|
#define BTN_TYPE_SWITCH_ACT_HIGH 5
|
|
|
|
#define BTN_TYPE_TOUCH 6
|
2021-05-21 13:33:22 +02:00
|
|
|
#define BTN_TYPE_ANALOG 7
|
2020-11-04 11:04:40 +01:00
|
|
|
|
2021-01-15 10:37:45 +01:00
|
|
|
//Ethernet board types
|
2021-02-23 00:47:48 +01:00
|
|
|
#define WLED_NUM_ETH_TYPES 5
|
|
|
|
|
2021-01-15 10:37:45 +01:00
|
|
|
#define WLED_ETH_NONE 0
|
|
|
|
#define WLED_ETH_WT32_ETH01 1
|
|
|
|
#define WLED_ETH_ESP32_POE 2
|
2021-02-11 10:36:15 +01:00
|
|
|
#define WLED_ETH_WESP32 3
|
2021-02-23 00:47:48 +01:00
|
|
|
#define WLED_ETH_QUINLED 4
|
2020-02-19 15:53:42 +01:00
|
|
|
|
2020-02-25 02:19:12 +01:00
|
|
|
//Hue error codes
|
|
|
|
#define HUE_ERROR_INACTIVE 0
|
|
|
|
#define HUE_ERROR_UNAUTHORIZED 1
|
|
|
|
#define HUE_ERROR_LIGHTID 3
|
|
|
|
#define HUE_ERROR_PUSHLINK 101
|
|
|
|
#define HUE_ERROR_JSON_PARSING 250
|
|
|
|
#define HUE_ERROR_TIMEOUT 251
|
|
|
|
#define HUE_ERROR_ACTIVE 255
|
|
|
|
|
2020-04-23 23:52:33 +02:00
|
|
|
//Segment option byte bits
|
|
|
|
#define SEG_OPTION_SELECTED 0
|
|
|
|
#define SEG_OPTION_REVERSED 1
|
|
|
|
#define SEG_OPTION_ON 2
|
2020-08-04 18:50:16 +02:00
|
|
|
#define SEG_OPTION_MIRROR 3 //Indicates that the effect will be mirrored within the segment
|
2020-05-10 23:58:50 +02:00
|
|
|
#define SEG_OPTION_NONUNITY 4 //Indicates that the effect does not use FRAMETIME or needs getPixelColor
|
2020-08-29 22:26:39 +02:00
|
|
|
#define SEG_OPTION_FREEZE 5 //Segment contents will not be refreshed
|
2020-04-23 23:52:33 +02:00
|
|
|
#define SEG_OPTION_TRANSITIONAL 7
|
|
|
|
|
2020-09-21 19:48:12 +02:00
|
|
|
// WLED Error modes
|
|
|
|
#define ERR_NONE 0 // All good :)
|
|
|
|
#define ERR_EEP_COMMIT 2 // Could not commit to EEPROM (wrong flash layout?)
|
|
|
|
#define ERR_JSON 9 // JSON parsing failed (input too large?)
|
|
|
|
#define ERR_FS_BEGIN 10 // Could not init filesystem (no partition?)
|
|
|
|
#define ERR_FS_QUOTA 11 // The FS is full or the maximum file size is reached
|
|
|
|
#define ERR_FS_PLOAD 12 // It was attempted to load a preset that does not exist
|
|
|
|
#define ERR_FS_GENERAL 19 // A general unspecified filesystem error occured
|
2021-01-26 00:19:41 +01:00
|
|
|
#define ERR_OVERTEMP 30 // An attached temperature sensor has measured above threshold temperature (not implemented)
|
|
|
|
#define ERR_OVERCURRENT 31 // An attached current sensor has measured a current above the threshold (not implemented)
|
|
|
|
#define ERR_UNDERVOLT 32 // An attached voltmeter has measured a voltage below the threshold (not implemented)
|
2020-09-21 19:48:12 +02:00
|
|
|
|
2020-06-22 12:30:31 +02:00
|
|
|
//Timer mode types
|
|
|
|
#define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness
|
|
|
|
#define NL_MODE_FADE 1 //Fade to target brightness gradually
|
|
|
|
#define NL_MODE_COLORFADE 2 //Fade to target brightness and secondary color gradually
|
|
|
|
#define NL_MODE_SUN 3 //Sunrise/sunset. Target brightness is set immediately, then Sunrise effect is started. Max 60 min.
|
|
|
|
|
2020-03-31 02:38:08 +02:00
|
|
|
|
2020-04-06 02:25:17 +02:00
|
|
|
#define NTP_PACKET_SIZE 48
|
|
|
|
|
2020-11-18 00:54:41 +01:00
|
|
|
// maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266
|
|
|
|
#ifndef MAX_LEDS
|
2021-01-18 20:51:32 +01:00
|
|
|
#ifdef ESP8266
|
2021-05-20 19:54:07 +02:00
|
|
|
#define MAX_LEDS 1664 // can't rely on memory limit to limit this to 1600 LEDs
|
2021-01-18 20:51:32 +01:00
|
|
|
#else
|
|
|
|
#define MAX_LEDS 8192
|
|
|
|
#endif
|
2020-11-18 00:54:41 +01:00
|
|
|
#endif
|
|
|
|
|
2021-02-27 00:57:12 +01:00
|
|
|
#ifndef MAX_LED_MEMORY
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define MAX_LED_MEMORY 5000
|
|
|
|
#else
|
|
|
|
#define MAX_LED_MEMORY 64000
|
|
|
|
#endif
|
2020-11-18 00:54:41 +01:00
|
|
|
#endif
|
|
|
|
|
2021-03-07 00:42:21 +01:00
|
|
|
#ifndef MAX_LEDS_PER_BUS
|
|
|
|
#define MAX_LEDS_PER_BUS 4096
|
|
|
|
#endif
|
2020-04-06 02:25:17 +02:00
|
|
|
|
|
|
|
// string temp buffer (now stored in stack locally)
|
|
|
|
#define OMAX 2048
|
|
|
|
|
|
|
|
#define E131_MAX_UNIVERSE_COUNT 9
|
|
|
|
|
2020-12-07 01:39:42 +01:00
|
|
|
#define ABL_MILLIAMPS_DEFAULT 850 // auto lower brightness to stay close to milliampere limit
|
2020-04-06 02:25:17 +02:00
|
|
|
|
2020-12-07 01:39:42 +01:00
|
|
|
// PWM settings
|
2021-02-23 00:47:48 +01:00
|
|
|
#ifndef WLED_PWM_FREQ
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define WLED_PWM_FREQ 880 //PWM frequency proven as good for LEDs
|
|
|
|
#else
|
|
|
|
#define WLED_PWM_FREQ 19531
|
|
|
|
#endif
|
|
|
|
#endif
|
2020-09-21 19:48:12 +02:00
|
|
|
|
2020-09-20 16:12:46 +02:00
|
|
|
#define TOUCH_THRESHOLD 32 // limit to recognize a touch, higher value means more sensitive
|
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
// Size of buffer for API JSON object (increase for more segments)
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define JSON_BUFFER_SIZE 9216
|
|
|
|
#else
|
2021-05-20 19:54:07 +02:00
|
|
|
#define JSON_BUFFER_SIZE 20480
|
2020-09-20 01:18:31 +02:00
|
|
|
#endif
|
|
|
|
|
2021-03-09 16:23:19 +01:00
|
|
|
// Maximum size of node map (list of other WLED instances)
|
|
|
|
#ifdef ESP8266
|
|
|
|
#define WLED_MAX_NODES 15
|
|
|
|
#else
|
|
|
|
#define WLED_MAX_NODES 150
|
|
|
|
#endif
|
|
|
|
|
2021-01-21 01:21:16 +01:00
|
|
|
//this is merely a default now and can be changed at runtime
|
|
|
|
#ifndef LEDPIN
|
2021-05-07 12:41:39 +02:00
|
|
|
#ifdef ESP8266
|
|
|
|
#define LEDPIN 2 // GPIO2 (D4) on Wemod D1 mini compatible boards
|
|
|
|
#else
|
|
|
|
#define LEDPIN 16 // alligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards
|
|
|
|
#endif
|
2021-01-21 01:21:16 +01:00
|
|
|
#endif
|
|
|
|
|
2021-03-13 22:04:37 +01:00
|
|
|
#ifdef WLED_ENABLE_DMX
|
|
|
|
#if (LEDPIN == 2)
|
|
|
|
#undef LEDPIN
|
|
|
|
#define LEDPIN 3
|
|
|
|
#warning "Pin conflict compiling with DMX and LEDs on pin 2. The default LED pin has been changed to pin 3."
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2021-04-15 10:55:22 +02:00
|
|
|
#ifndef DEFAULT_LED_COUNT
|
|
|
|
#define DEFAULT_LED_COUNT 30
|
|
|
|
#endif
|
|
|
|
|
2020-02-19 15:53:42 +01:00
|
|
|
#endif
|