diff --git a/platformio.ini b/platformio.ini index ee68b263..931dc38f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -399,10 +399,10 @@ build_unflags = ${common.build_unflags} lib_deps = ${esp32c3.lib_deps} [env:esp32s3dev_8MB] -;; ESP32-S3-DevKitC-1 development board, with 8MB FLASH, no PSRAM +;; ESP32-S3-DevKitC-1 development board, with 8MB FLASH, no PSRAM (flash_mode: qio) board = esp32-s3-devkitc-1 platform = espressif32@5.1.1 -platform_packages = platformio/framework-arduinoespressif32@3.20004.220825 +platform_packages = upload_speed = 921600 build_unflags = ${common.build_unflags} build_flags = ${common.build_flags} ${esp32s3.build_flags} -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0 @@ -412,6 +412,26 @@ board_build.f_flash = 80000000L board_build.flash_mode = qio monitor_filters = esp32_exception_decoder +[env:esp32s3dev_8MB_PSRAM] +;; ESP32-TinyS3 development board, with 8MB FLASH and 8MB PSRAM (memory_type: qio_opi, qio_qspi, or opi_opi) +;board = um_tinys3 ; -> needs workaround from https://github.com/Aircoookie/WLED/pull/2905#issuecomment-1328049860 +;board = esp32s3box ; -> error: 'esp32_adc2gpio' was not declared in this scope +board = esp32-s3-devkitc-1 ; -> compiles, but does not support PSRAM +platform = espressif32 @ ~5.2.0 +platform_packages = +upload_speed = 921600 +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags} ${esp32s3.build_flags} + -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D ARDUINO_USB_MODE=1 -D ARDUINO_USB_MSC_ON_BOOT=0 + ; -D ARDUINO_USB_CDC_ON_BOOT=0 + ; -D WLED_RELEASE_NAME=ESP32-S3_PSRAM + -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used +lib_deps = ${esp32s3.lib_deps} +board_build.partitions = tools/WLED_ESP32_8MB.csv +board_build.f_flash = 80000000L +board_build.flash_mode = qio +monitor_filters = esp32_exception_decoder + [env:esp8285_4CH_MagicHome] board = esp8285 platform = ${common.platform_wled_default} @@ -515,9 +535,12 @@ build_flags = ${common.build_flags_esp32} -D USERMOD_DALLASTEMPERATURE -D USERMOD_FOUR_LINE_DISPLAY -D TEMPERATURE_PIN=23 + -D USE_ALT_DISPlAY ; new versions of USERMOD_FOUR_LINE_DISPLAY and USERMOD_ROTARY_ENCODER_UI + -D USERMOD_AUDIOREACTIVE lib_deps = ${esp32.lib_deps} OneWire@~2.3.5 olikraus/U8g2 @ ^2.28.8 + https://github.com/blazoncek/arduinoFFT.git board_build.partitions = ${esp32.default_partitions} [env:m5atom] diff --git a/usermods/BME280_v2/usermod_bme280.h b/usermods/BME280_v2/usermod_bme280.h index 6b42fc80..c27adfc8 100644 --- a/usermods/BME280_v2/usermod_bme280.h +++ b/usermods/BME280_v2/usermod_bme280.h @@ -16,14 +16,15 @@ private: // NOTE: Do not implement any compile-time variables, anything the user needs to configure // should be configurable from the Usermod menu using the methods below // key settings set via usermod menu - unsigned long TemperatureDecimals = 0; // Number of decimal places in published temperaure values - unsigned long HumidityDecimals = 0; // Number of decimal places in published humidity values - unsigned long PressureDecimals = 0; // Number of decimal places in published pressure values - unsigned long TemperatureInterval = 5; // Interval to measure temperature (and humidity, dew point if available) in seconds - unsigned long PressureInterval = 300; // Interval to measure pressure in seconds + uint8_t TemperatureDecimals = 0; // Number of decimal places in published temperaure values + uint8_t HumidityDecimals = 0; // Number of decimal places in published humidity values + uint8_t PressureDecimals = 0; // Number of decimal places in published pressure values + uint16_t TemperatureInterval = 5; // Interval to measure temperature (and humidity, dew point if available) in seconds + uint16_t PressureInterval = 300; // Interval to measure pressure in seconds bool PublishAlways = false; // Publish values even when they have not changed bool UseCelsius = true; // Use Celsius for Reporting bool HomeAssistantDiscovery = false; // Publish Home Assistant Device Information + bool enabled = true; // set the default pins based on the architecture, these get overridden by Usermod menu settings #ifdef ESP8266 @@ -70,15 +71,10 @@ private: // MQTT topic strings for publishing Home Assistant discovery topics bool mqttInitialized = false; - String mqttTemperatureTopic = ""; - String mqttHumidityTopic = ""; - String mqttPressureTopic = ""; - String mqttHeatIndexTopic = ""; - String mqttDewPointTopic = ""; - // Store packet IDs of MQTT publications - uint16_t mqttTemperaturePub = 0; - uint16_t mqttPressurePub = 0; + // strings to reduce flash memory usage (used more than twice) + static const char _name[]; + static const char _enabled[]; // Read the BME280/BMP280 Sensor (which one runs depends on whether Celsius or Farenheit being set in Usermod Menu) void UpdateBME280Data(int SensorType) @@ -95,7 +91,7 @@ private: sensorTemperature = _temperature; sensorHumidity = _humidity; sensorPressure = _pressure; - tempScale = "°C"; + tempScale = F("°C"); if (sensorType == 1) { sensorHeatIndex = EnvironmentCalculations::HeatIndex(_temperature, _humidity, envTempUnit); @@ -111,7 +107,7 @@ private: sensorTemperature = _temperature; sensorHumidity = _humidity; sensorPressure = _pressure; - tempScale = "°F"; + tempScale = F("°F"); if (sensorType == 1) { sensorHeatIndex = EnvironmentCalculations::HeatIndex(_temperature, _humidity, envTempUnit); @@ -123,18 +119,23 @@ private: // Procedure to define all MQTT discovery Topics void _mqttInitialize() { - mqttTemperatureTopic = String(mqttDeviceTopic) + F("/temperature"); - mqttPressureTopic = String(mqttDeviceTopic) + F("/pressure"); - mqttHumidityTopic = String(mqttDeviceTopic) + F("/humidity"); - mqttHeatIndexTopic = String(mqttDeviceTopic) + F("/heat_index"); - mqttDewPointTopic = String(mqttDeviceTopic) + F("/dew_point"); + char mqttTemperatureTopic[128]; + char mqttHumidityTopic[128]; + char mqttPressureTopic[128]; + char mqttHeatIndexTopic[128]; + char mqttDewPointTopic[128]; + snprintf_P(mqttTemperatureTopic, 127, PSTR("%s/temperature"), mqttDeviceTopic); + snprintf_P(mqttPressureTopic, 127, PSTR("%s/pressure"), mqttDeviceTopic); + snprintf_P(mqttHumidityTopic, 127, PSTR("%s/humidity"), mqttDeviceTopic); + snprintf_P(mqttHeatIndexTopic, 127, PSTR("%s/heat_index"), mqttDeviceTopic); + snprintf_P(mqttDewPointTopic, 127, PSTR("%s/dew_point"), mqttDeviceTopic); if (HomeAssistantDiscovery) { - _createMqttSensor(F("Temperature"), mqttTemperatureTopic, F("temperature"), tempScale); - _createMqttSensor(F("Pressure"), mqttPressureTopic, F("pressure"), F("hPa")); - _createMqttSensor(F("Humidity"), mqttHumidityTopic, F("humidity"), F("%")); - _createMqttSensor(F("HeatIndex"), mqttHeatIndexTopic, F("temperature"), tempScale); - _createMqttSensor(F("DewPoint"), mqttDewPointTopic, F("temperature"), tempScale); + _createMqttSensor(F("Temperature"), mqttTemperatureTopic, "temperature", tempScale); + _createMqttSensor(F("Pressure"), mqttPressureTopic, "pressure", F("hPa")); + _createMqttSensor(F("Humidity"), mqttHumidityTopic, "humidity", F("%")); + _createMqttSensor(F("HeatIndex"), mqttHeatIndexTopic, "temperature", tempScale); + _createMqttSensor(F("DewPoint"), mqttDewPointTopic, "temperature", tempScale); } } @@ -169,6 +170,15 @@ private: mqtt->publish(t.c_str(), 0, true, temp.c_str()); } + void publishMqtt(const char *topic, const char* state) { + //Check if MQTT Connected, otherwise it will crash the 8266 + if (WLED_MQTT_CONNECTED){ + char subuf[128]; + snprintf_P(subuf, 127, PSTR("%s/%s"), mqttDeviceTopic, topic); + mqtt->publish(subuf, 0, false, state); + } + } + public: void setup() { @@ -183,7 +193,7 @@ public: if (!bme.begin()) { sensorType = 0; - DEBUG_PRINTLN(F("Could not find BME280I2C sensor!")); + DEBUG_PRINTLN(F("Could not find BME280 I2C sensor!")); } else { @@ -207,14 +217,16 @@ public: void loop() { + if (!enabled || strip.isUpdating()) return; + // BME280 sensor MQTT publishing - // Check if sensor present and MQTT Connected, otherwise it will crash the MCU - if (sensorType != 0 && WLED_MQTT_CONNECTED) + // Check if sensor present and Connected, otherwise it will crash the MCU + if (sensorType != 0) { // Timer to fetch new temperature, humidity and pressure data at intervals timer = millis(); - if (timer - lastTemperatureMeasure >= TemperatureInterval * 1000 || mqttTemperaturePub == 0) + if (timer - lastTemperatureMeasure >= TemperatureInterval * 1000) { lastTemperatureMeasure = timer; @@ -223,18 +235,11 @@ public: float temperature = roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); float humidity, heatIndex, dewPoint; - if (WLED_MQTT_CONNECTED && !mqttInitialized) - { - _mqttInitialize(); - mqttInitialized = true; - } - // If temperature has changed since last measure, create string populated with device topic // from the UI and values read from sensor, then publish to broker if (temperature != lastTemperature || PublishAlways) { - String topic = String(mqttDeviceTopic) + "/temperature"; - mqttTemperaturePub = mqtt->publish(topic.c_str(), 0, false, String(temperature, TemperatureDecimals).c_str()); + publishMqtt("temperature", String(temperature, TemperatureDecimals).c_str()); } lastTemperature = temperature; // Update last sensor temperature for next loop @@ -247,20 +252,17 @@ public: if (humidity != lastHumidity || PublishAlways) { - String topic = String(mqttDeviceTopic) + F("/humidity"); - mqtt->publish(topic.c_str(), 0, false, String(humidity, HumidityDecimals).c_str()); + publishMqtt("humidity", String(humidity, HumidityDecimals).c_str()); } if (heatIndex != lastHeatIndex || PublishAlways) { - String topic = String(mqttDeviceTopic) + F("/heat_index"); - mqtt->publish(topic.c_str(), 0, false, String(heatIndex, TemperatureDecimals).c_str()); + publishMqtt("heat_index", String(heatIndex, TemperatureDecimals).c_str()); } if (dewPoint != lastDewPoint || PublishAlways) { - String topic = String(mqttDeviceTopic) + F("/dew_point"); - mqtt->publish(topic.c_str(), 0, false, String(dewPoint, TemperatureDecimals).c_str()); + publishMqtt("dew_point", String(dewPoint, TemperatureDecimals).c_str()); } lastHumidity = humidity; @@ -269,7 +271,7 @@ public: } } - if (timer - lastPressureMeasure >= PressureInterval * 1000 || mqttPressurePub == 0) + if (timer - lastPressureMeasure >= PressureInterval * 1000) { lastPressureMeasure = timer; @@ -277,15 +279,23 @@ public: if (pressure != lastPressure || PublishAlways) { - String topic = String(mqttDeviceTopic) + F("/pressure"); - mqttPressurePub = mqtt->publish(topic.c_str(), 0, true, String(pressure, PressureDecimals).c_str()); + publishMqtt("pressure", String(pressure, PressureDecimals).c_str()); } lastPressure = pressure; } } } - + + void onMqttConnect(bool sessionPresent) + { + if (WLED_MQTT_CONNECTED && !mqttInitialized) + { + _mqttInitialize(); + mqttInitialized = true; + } + } + /* * API calls te enable data exchange between WLED modules */ @@ -294,9 +304,9 @@ public: return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); } else { return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32; - } - + } } + inline float getTemperatureF() { if (UseCelsius) { return ((float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f; @@ -304,12 +314,15 @@ public: return (float)roundf(sensorTemperature * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); } } + inline float getHumidity() { return (float)roundf(sensorHumidity * powf(10, HumidityDecimals)); } + inline float getPressure() { return (float)roundf(sensorPressure * powf(10, PressureDecimals)); } + inline float getDewPointC() { if (UseCelsius) { return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); @@ -317,6 +330,7 @@ public: return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32; } } + inline float getDewPointF() { if (UseCelsius) { return ((float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f; @@ -324,13 +338,16 @@ public: return (float)roundf(sensorDewPoint * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); } } + inline float getHeatIndexC() { if (UseCelsius) { return (float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals); } else { return (float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) * 1.8f + 32; } - }inline float getHeatIndexF() { + } + + inline float getHeatIndexF() { if (UseCelsius) { return ((float)roundf(sensorHeatIndex * powf(10, TemperatureDecimals)) / powf(10, TemperatureDecimals) -32) * 0.56f; } else { @@ -384,7 +401,8 @@ public: // Save Usermod Config Settings void addToConfig(JsonObject& root) { - JsonObject top = root.createNestedObject(F("BME280/BMP280")); + JsonObject top = root.createNestedObject(FPSTR(_name)); + top[FPSTR(_enabled)] = enabled; top[F("TemperatureDecimals")] = TemperatureDecimals; top[F("HumidityDecimals")] = HumidityDecimals; top[F("PressureDecimals")] = PressureDecimals; @@ -405,17 +423,17 @@ public: // default settings values could be set here (or below using the 3-argument getJsonValue()) instead of in the class definition or constructor // setting them inside readFromConfig() is slightly more robust, handling the rare but plausible use case of single value being missing after boot (e.g. if the cfg.json was manually edited and a value was removed) - int8_t newPin[2]; for (byte i=0; i<2; i++) newPin[i] = ioPin[i]; // prepare to note changed pins - JsonObject top = root[F("BME280/BMP280")]; + JsonObject top = root[FPSTR(_name)]; if (top.isNull()) { - DEBUG_PRINT(F("BME280/BMP280")); + DEBUG_PRINT(F(_name)); DEBUG_PRINTLN(F(": No config found. (Using defaults.)")); return false; } bool configComplete = !top.isNull(); + configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled); // A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing configComplete &= getJsonValue(top[F("TemperatureDecimals")], TemperatureDecimals, 1); configComplete &= getJsonValue(top[F("HumidityDecimals")], HumidityDecimals, 0); @@ -427,7 +445,7 @@ public: configComplete &= getJsonValue(top[F("HomeAssistantDiscovery")], HomeAssistantDiscovery, false); for (byte i=0; i<2; i++) configComplete &= getJsonValue(top[F("pin")][i], newPin[i], ioPin[i]); - DEBUG_PRINT(FPSTR(F("BME280/BMP280"))); + DEBUG_PRINT(FPSTR(_name)); if (!initDone) { // first run: reading from cfg.json for (byte i=0; i<2; i++) ioPin[i] = newPin[i]; @@ -454,4 +472,7 @@ public: uint16_t getId() { return USERMOD_ID_BME280; } -}; \ No newline at end of file +}; + +const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280"; +const char UsermodBME280::_enabled[] PROGMEM = "enabled"; diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 7f09fc78..384e2e2b 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1554,18 +1554,18 @@ class AudioReactive : public Usermod { pinArray.add(sdaPin); pinArray.add(sclPin); - JsonObject cfg = top.createNestedObject("cfg"); + JsonObject cfg = top.createNestedObject("config"); cfg[F("squelch")] = soundSquelch; cfg[F("gain")] = sampleGain; cfg[F("AGC")] = soundAgc; JsonObject dynLim = top.createNestedObject("dynamics"); - dynLim[F("Limiter")] = limiterOn; - dynLim[F("Rise")] = attackTime; - dynLim[F("Fall")] = decayTime; + dynLim[F("limiter")] = limiterOn; + dynLim[F("rise")] = attackTime; + dynLim[F("fall")] = decayTime; - JsonObject freqScale = top.createNestedObject("Frequency"); - freqScale[F("Scale")] = FFTScalingMode; + JsonObject freqScale = top.createNestedObject("frequency"); + freqScale[F("scale")] = FFTScalingMode; JsonObject sync = top.createNestedObject("sync"); sync[F("port")] = audioSyncPort; @@ -1605,15 +1605,15 @@ class AudioReactive : public Usermod { configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][4], sdaPin); configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][5], sclPin); - configComplete &= getJsonValue(top["cfg"][F("squelch")], soundSquelch); - configComplete &= getJsonValue(top["cfg"][F("gain")], sampleGain); - configComplete &= getJsonValue(top["cfg"][F("AGC")], soundAgc); + configComplete &= getJsonValue(top["config"][F("squelch")], soundSquelch); + configComplete &= getJsonValue(top["config"][F("gain")], sampleGain); + configComplete &= getJsonValue(top["config"][F("AGC")], soundAgc); - configComplete &= getJsonValue(top["dynamics"][F("Limiter")], limiterOn); - configComplete &= getJsonValue(top["dynamics"][F("Rise")], attackTime); - configComplete &= getJsonValue(top["dynamics"][F("Fall")], decayTime); + configComplete &= getJsonValue(top["dynamics"][F("limiter")], limiterOn); + configComplete &= getJsonValue(top["dynamics"][F("rise")], attackTime); + configComplete &= getJsonValue(top["dynamics"][F("fall")], decayTime); - configComplete &= getJsonValue(top["Frequency"][F("Scale")], FFTScalingMode); + configComplete &= getJsonValue(top["frequency"][F("scale")], FFTScalingMode); configComplete &= getJsonValue(top["sync"][F("port")], audioSyncPort); configComplete &= getJsonValue(top["sync"][F("mode")], audioSyncEnabled); @@ -1635,20 +1635,20 @@ class AudioReactive : public Usermod { #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) oappend(SET_F("addOption(dd,'Generic I2S PDM',5);")); #endif - oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');")); + oappend(SET_F("dd=addDropdown('AudioReactive','config:AGC');")); oappend(SET_F("addOption(dd,'Off',0);")); oappend(SET_F("addOption(dd,'Normal',1);")); oappend(SET_F("addOption(dd,'Vivid',2);")); oappend(SET_F("addOption(dd,'Lazy',3);")); - oappend(SET_F("dd=addDropdown('AudioReactive','dynamics:Limiter');")); + oappend(SET_F("dd=addDropdown('AudioReactive','dynamics:limiter');")); oappend(SET_F("addOption(dd,'Off',0);")); oappend(SET_F("addOption(dd,'On',1);")); - oappend(SET_F("addInfo('AudioReactive:dynamics:Limiter',0,' On ');")); // 0 is field type, 1 is actual field - oappend(SET_F("addInfo('AudioReactive:dynamics:Rise',1,'ms (♪ effects only)');")); - oappend(SET_F("addInfo('AudioReactive:dynamics:Fall',1,'ms (♪ effects only)');")); + oappend(SET_F("addInfo('AudioReactive:dynamics:limiter',0,' On ');")); // 0 is field type, 1 is actual field + oappend(SET_F("addInfo('AudioReactive:dynamics:rise',1,'ms (♪ effects only)');")); + oappend(SET_F("addInfo('AudioReactive:dynamics:fall',1,'ms (♪ effects only)');")); - oappend(SET_F("dd=addDropdown('AudioReactive','Frequency:Scale');")); + oappend(SET_F("dd=addDropdown('AudioReactive','frequency:scale');")); oappend(SET_F("addOption(dd,'None',0);")); oappend(SET_F("addOption(dd,'Linear (Amplitude)',2);")); oappend(SET_F("addOption(dd,'Square Root (Energy)',3);")); @@ -1659,16 +1659,16 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'Send',1);")); oappend(SET_F("addOption(dd,'Receive',2);")); oappend(SET_F("addInfo('AudioReactive:digitalmic:type',1,'requires reboot!');")); // 0 is field type, 1 is actual field - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S SD');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S WS');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S SCK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',0,'I2S Serial Data', 'sd/data/dout');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',1,'I2S L/R Clock','ws/clk/lrck');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',2,'I2S Serial Clock','sck/bclk');")); #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK only use -1, 0, 1 or 3 for MCLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK','only use -1, 0, 1 or 3');")); #else - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'I2S Master CLK');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',3,'', 'I2S Master CLK');")); #endif - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'I2C SDA');")); - oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'I2C SCL');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'', 'I2C SDA');")); + oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'', 'I2C SCL');")); } diff --git a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h index 2c373158..372830b9 100644 --- a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h +++ b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h @@ -1032,11 +1032,11 @@ class FourLineDisplayUsermod : public Usermod { oappend(SET_F("addOption(dd,'SSD1305 128x64',5);")); oappend(SET_F("addOption(dd,'SSD1306 SPI',6);")); oappend(SET_F("addOption(dd,'SSD1306 SPI 128x64',7);")); - oappend(SET_F("addInfo('4LineDisplay:pin[]',0,'I2C/SPI CLK (-1 use global)');")); - oappend(SET_F("addInfo('4LineDisplay:pin[]',1,'I2C/SPI DTA (-1 use global)');")); - oappend(SET_F("addInfo('4LineDisplay:pin[]',2,'SPI CS');")); - oappend(SET_F("addInfo('4LineDisplay:pin[]',3,'SPI DC');")); - oappend(SET_F("addInfo('4LineDisplay:pin[]',4,'SPI RST');")); + oappend(SET_F("addInfo('4LineDisplay:pin[]',0,'-1 use global','I2C/SPI CLK');")); + oappend(SET_F("addInfo('4LineDisplay:pin[]',1,'-1 use global','I2C/SPI DTA');")); + oappend(SET_F("addInfo('4LineDisplay:pin[]',2,'','SPI CS');")); + oappend(SET_F("addInfo('4LineDisplay:pin[]',3,'','SPI DC');")); + oappend(SET_F("addInfo('4LineDisplay:pin[]',4,'','SPI RST');")); } /* diff --git a/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h b/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h index ecc994e6..b5aed94d 100644 --- a/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h +++ b/usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h @@ -191,7 +191,7 @@ private: re_sortModes(modes_qstrings, modes_alpha_indexes, strip.getModeCount(), MODE_SORT_SKIP_COUNT); palettes_qstrings = re_findModeStrings(JSON_palette_names, strip.getPaletteCount()); - palettes_alpha_indexes = re_initIndexArray(strip.getPaletteCount()); + palettes_alpha_indexes = re_initIndexArray(strip.getPaletteCount()); // only use internal palettes // How many palette names start with '*' and should not be sorted? // (Also skipping the first one, 'Default'). diff --git a/wled00/FX.cpp b/wled00/FX.cpp index e89958dc..dab05581 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -596,7 +596,7 @@ uint16_t mode_twinkle(void) { return FRAMETIME; } -static const char _data_FX_MODE_TWINKLE[] PROGMEM = "Twinkle@!;!,!;!;mp12=0,1d"; //pixels +static const char _data_FX_MODE_TWINKLE[] PROGMEM = "Twinkle@!;!,!;!;m12=0,1d"; //pixels /* @@ -673,7 +673,7 @@ uint16_t mode_sparkle(void) { SEGMENT.setPixelColor(SEGENV.aux0, SEGCOLOR(0)); return FRAMETIME; } -static const char _data_FX_MODE_SPARKLE[] PROGMEM = "Sparkle@!;!,!;!;mp12=0,1d"; +static const char _data_FX_MODE_SPARKLE[] PROGMEM = "Sparkle@!;!,!;!;m12=0,1d"; /* @@ -694,7 +694,7 @@ uint16_t mode_flash_sparkle(void) { } return FRAMETIME; } -static const char _data_FX_MODE_FLASH_SPARKLE[] PROGMEM = "Sparkle Dark@!,!;Bg,Fx;!;mp12=0,1d"; +static const char _data_FX_MODE_FLASH_SPARKLE[] PROGMEM = "Sparkle Dark@!,!;Bg,Fx;!;m12=0,1d"; /* @@ -717,7 +717,7 @@ uint16_t mode_hyper_sparkle(void) { } return FRAMETIME; } -static const char _data_FX_MODE_HYPER_SPARKLE[] PROGMEM = "Sparkle+@!,!;Bg,Fx;!;mp12=0,1d"; +static const char _data_FX_MODE_HYPER_SPARKLE[] PROGMEM = "Sparkle+@!,!;Bg,Fx;!;m12=0,1d"; /* @@ -799,7 +799,7 @@ uint16_t mode_android(void) { return 3 + ((8 * (uint32_t)(255 - SEGMENT.speed)) / SEGLEN); } -static const char _data_FX_MODE_ANDROID[] PROGMEM = "Android@!,Width;!,!;!;mp12=1,1d"; //vertical +static const char _data_FX_MODE_ANDROID[] PROGMEM = "Android@!,Width;!,!;!;m12=1,1d"; //vertical /* @@ -1146,7 +1146,7 @@ uint16_t larson_scanner(bool dual) { uint16_t mode_larson_scanner(void){ return larson_scanner(false); } -static const char _data_FX_MODE_LARSON_SCANNER[] PROGMEM = "Scanner@!,Fade rate;!,!;!;mp12=0,1d"; +static const char _data_FX_MODE_LARSON_SCANNER[] PROGMEM = "Scanner@!,Fade rate;!,!;!;m12=0,1d"; /* @@ -1156,7 +1156,7 @@ static const char _data_FX_MODE_LARSON_SCANNER[] PROGMEM = "Scanner@!,Fade rate; uint16_t mode_dual_larson_scanner(void){ return larson_scanner(true); } -static const char _data_FX_MODE_DUAL_LARSON_SCANNER[] PROGMEM = "Scanner Dual@!,Fade rate;!,!;!;mp12=0,1d"; +static const char _data_FX_MODE_DUAL_LARSON_SCANNER[] PROGMEM = "Scanner Dual@!,Fade rate;!,!;!;m12=0,1d"; /* @@ -1508,7 +1508,7 @@ uint16_t mode_fairytwinkle() { } return FRAMETIME; } -static const char _data_FX_MODE_FAIRYTWINKLE[] PROGMEM = "Fairy Twinkle@;;;mp12=0,1d"; //pixels +static const char _data_FX_MODE_FAIRYTWINKLE[] PROGMEM = "Fairy Twinkle@;;;m12=0,1d"; //pixels /* @@ -2016,7 +2016,7 @@ uint16_t mode_fire_2012() return FRAMETIME; } -static const char _data_FX_MODE_FIRE_2012[] PROGMEM = "Fire 2012@Cooling,Spark rate;1,2,3;!;sx=120,ix=64,mp12=1,1d"; //bars +static const char _data_FX_MODE_FIRE_2012[] PROGMEM = "Fire 2012@Cooling,Spark rate;1,2,3;!;sx=120,ix=64,m12=1,1d"; //bars // ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb @@ -2248,7 +2248,7 @@ uint16_t mode_colortwinkle() } return FRAMETIME_FIXED; } -static const char _data_FX_MODE_COLORTWINKLE[] PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!;mp12=0,1d"; //pixels +static const char _data_FX_MODE_COLORTWINKLE[] PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!;m12=0,1d"; //pixels //Calm effect, like a lake at night @@ -2857,7 +2857,7 @@ uint16_t mode_bouncing_balls(void) { return FRAMETIME; } -static const char _data_FX_MODE_BOUNCINGBALLS[] PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,!;!;mp12=1,1d"; //bar +static const char _data_FX_MODE_BOUNCINGBALLS[] PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,!;!;m12=1,1d"; //bar /* @@ -2927,7 +2927,7 @@ uint16_t mode_glitter() return FRAMETIME; } -static const char _data_FX_MODE_GLITTER[] PROGMEM = "Glitter@,!;!,!,!;!;mp12=0,1d"; //pixels +static const char _data_FX_MODE_GLITTER[] PROGMEM = "Glitter@,!;!,!,!;!;m12=0,1d"; //pixels //each needs 19 bytes @@ -3000,7 +3000,7 @@ uint16_t mode_popcorn(void) { return FRAMETIME; } -static const char _data_FX_MODE_POPCORN[] PROGMEM = "Popcorn@!,!;!,!,!;!;mp12=1,1d"; //bar +static const char _data_FX_MODE_POPCORN[] PROGMEM = "Popcorn@!,!;!,!,!;!;m12=1,1d"; //bar //values close to 100 produce 5Hz flicker, which looks very candle-y @@ -3227,7 +3227,7 @@ uint16_t mode_starburst(void) { return FRAMETIME; } #undef STARBURST_MAX_FRAG -static const char _data_FX_MODE_STARBURST[] PROGMEM = "Fireworks Starburst@Chance,Fragments;,!;!;pal=11,mp12=0,1d"; +static const char _data_FX_MODE_STARBURST[] PROGMEM = "Fireworks Starburst@Chance,Fragments;,!;!;pal=11,m12=0,1d"; /* @@ -3449,7 +3449,7 @@ uint16_t mode_drip(void) return FRAMETIME; } -static const char _data_FX_MODE_DRIP[] PROGMEM = "Drip@Gravity,# of drips;!,!;!;mp12=1,1d"; //bar +static const char _data_FX_MODE_DRIP[] PROGMEM = "Drip@Gravity,# of drips;!,!;!;m12=1,1d"; //bar /* @@ -3538,7 +3538,7 @@ uint16_t mode_tetrix(void) { return FRAMETIME; } -static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width;!,!;!;sx=0,ix=0,pal=11,mp12=1,1d"; +static const char _data_FX_MODE_TETRIX[] PROGMEM = "Tetrix@!,Width;!,!;!;sx=0,ix=0,pal=11,m12=1,1d"; /* @@ -3650,7 +3650,7 @@ uint16_t mode_heartbeat(void) { return FRAMETIME; } -static const char _data_FX_MODE_HEARTBEAT[] PROGMEM = "Heartbeat@!,!;!,!;!;mp12=1,1d"; +static const char _data_FX_MODE_HEARTBEAT[] PROGMEM = "Heartbeat@!,!;!,!;!;m12=1,1d"; // "Pacifica" @@ -3782,7 +3782,7 @@ uint16_t mode_solid_glitter() return FRAMETIME; } -static const char _data_FX_MODE_SOLID_GLITTER[] PROGMEM = "Solid Glitter@,!;!;0;mp12=0,1d"; +static const char _data_FX_MODE_SOLID_GLITTER[] PROGMEM = "Solid Glitter@,!;!;0;m12=0,1d"; /* @@ -3891,7 +3891,7 @@ uint16_t mode_twinkleup(void) { // A very short twinkle routine return FRAMETIME; } -static const char _data_FX_MODE_TWINKLEUP[] PROGMEM = "Twinkleup@!,Intensity;!,!;!;mp12=0,1d"; +static const char _data_FX_MODE_TWINKLEUP[] PROGMEM = "Twinkleup@!,Intensity;!,!;!;m12=0,1d"; // Peaceful noise that's slow and with gradually changing palettes. Does not support WLED palettes or default colours or controls. @@ -3990,7 +3990,7 @@ uint16_t mode_flow(void) return FRAMETIME; } -static const char _data_FX_MODE_FLOW[] PROGMEM = "Flow@!,!;!,!,!;!;mp12=1,1d"; //vertical +static const char _data_FX_MODE_FLOW[] PROGMEM = "Flow@!,!;!,!,!;!;m12=1,1d"; //vertical /* @@ -6048,7 +6048,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli return FRAMETIME; } // mode_ripplepeak() -static const char _data_FX_MODE_RIPPLEPEAK[] PROGMEM = "Ripple Peak@Fade rate,Max # of ripples,Select bin,Volume (min);!,!;!;c2=0,mp12=0,ssim=0,1d,vo"; // Pixel, Beatsin +static const char _data_FX_MODE_RIPPLEPEAK[] PROGMEM = "Ripple Peak@Fade rate,Max # of ripples,Select bin,Volume (min);!,!;!;c2=0,m12=0,si=0,1d,vo"; // Pixel, Beatsin #ifndef WLED_DISABLE_2D @@ -6096,7 +6096,7 @@ uint16_t mode_2DSwirl(void) { return FRAMETIME; } // mode_2DSwirl() -static const char _data_FX_MODE_2DSWIRL[] PROGMEM = "Swirl@!,Sensitivity,Blur;,Bg Swirl;!;ix=64ssim=0,2d,vo"; // Beatsin +static const char _data_FX_MODE_2DSWIRL[] PROGMEM = "Swirl@!,Sensitivity,Blur;,Bg Swirl;!;ix=64si=0,2d,vo"; // Beatsin ///////////////////////// @@ -6142,7 +6142,7 @@ uint16_t mode_2DWaverly(void) { return FRAMETIME; } // mode_2DWaverly() -static const char _data_FX_MODE_2DWAVERLY[] PROGMEM = "Waverly@Amplification,Sensitivity;;!;ix=64,ssim=0,2d,vo"; // Beatsin +static const char _data_FX_MODE_2DWAVERLY[] PROGMEM = "Waverly@Amplification,Sensitivity;;!;ix=64,si=0,2d,vo"; // Beatsin #endif // WLED_DISABLE_2D @@ -6202,7 +6202,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline. return FRAMETIME; } // mode_gravcenter() -static const char _data_FX_MODE_GRAVCENTER[] PROGMEM = "Gravcenter@Rate of fall,Sensitivity;,!;!;ix=128,mp12=2,ssim=0,1d,vo"; // Circle, Beatsin +static const char _data_FX_MODE_GRAVCENTER[] PROGMEM = "Gravcenter@Rate of fall,Sensitivity;,!;!;ix=128,m12=2,si=0,1d,vo"; // Circle, Beatsin /////////////////////// @@ -6253,7 +6253,7 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew return FRAMETIME; } // mode_gravcentric() -static const char _data_FX_MODE_GRAVCENTRIC[] PROGMEM = "Gravcentric@Rate of fall,Sensitivity;!;!;ix=128,mp12=3,ssim=0,1d,vo"; // Corner, Beatsin +static const char _data_FX_MODE_GRAVCENTRIC[] PROGMEM = "Gravcentric@Rate of fall,Sensitivity;!;!;ix=128,m12=3,si=0,1d,vo"; // Corner, Beatsin /////////////////////// @@ -6299,7 +6299,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline. return FRAMETIME; } // mode_gravimeter() -static const char _data_FX_MODE_GRAVIMETER[] PROGMEM = "Gravimeter@Rate of fall,Sensitivity;!,!;!;ix=128,mp12=2,ssim=0,1d,vo"; // Circle, Beatsin +static const char _data_FX_MODE_GRAVIMETER[] PROGMEM = "Gravimeter@Rate of fall,Sensitivity;!,!;!;ix=128,m12=2,si=0,1d,vo"; // Circle, Beatsin ////////////////////// @@ -6322,7 +6322,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline. return FRAMETIME; } // mode_juggles() -static const char _data_FX_MODE_JUGGLES[] PROGMEM = "Juggles@!,# of balls;,!;!;mp12=0,ssim=0,1d,vo"; // Pixels, Beatsin +static const char _data_FX_MODE_JUGGLES[] PROGMEM = "Juggles@!,# of balls;,!;!;m12=0,si=0,1d,vo"; // Pixels, Beatsin ////////////////////// @@ -6354,7 +6354,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline. return FRAMETIME; } // mode_matripix() -static const char _data_FX_MODE_MATRIPIX[] PROGMEM = "Matripix@!,Brightness;!,!;!;ix=64,mp12=2,ssim=1,1d,vo"; //,rev=1,mi=1,rY=1,mY=1 Circle, WeWillRockYou, reverseX +static const char _data_FX_MODE_MATRIPIX[] PROGMEM = "Matripix@!,Brightness;!,!;!;ix=64,m12=2,si=1,1d,vo"; //,rev=1,mi=1,rY=1,mY=1 Circle, WeWillRockYou, reverseX ////////////////////// @@ -6389,7 +6389,7 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline. return FRAMETIME; } // mode_midnoise() -static const char _data_FX_MODE_MIDNOISE[] PROGMEM = "Midnoise@Fade rate,Maximum length;,!;!;ix=128,mp12=1,ssim=0,1d,vo"; // Bar, Beatsin +static const char _data_FX_MODE_MIDNOISE[] PROGMEM = "Midnoise@Fade rate,Maximum length;,!;!;ix=128,m12=1,si=0,1d,vo"; // Bar, Beatsin ////////////////////// @@ -6422,7 +6422,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline. return FRAMETIME; } // mode_noisefire() -static const char _data_FX_MODE_NOISEFIRE[] PROGMEM = "Noisefire@!,!;;;mp12=2,ssim=0,1d,vo"; // Circle, Beatsin +static const char _data_FX_MODE_NOISEFIRE[] PROGMEM = "Noisefire@!,!;;;m12=2,si=0,1d,vo"; // Circle, Beatsin /////////////////////// @@ -6457,7 +6457,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline. return FRAMETIME; } // mode_noisemeter() -static const char _data_FX_MODE_NOISEMETER[] PROGMEM = "Noisemeter@Fade rate,Width;!,!;!;ix=128,mp12=2,ssim=0,1d,vo"; // Circle, Beatsin +static const char _data_FX_MODE_NOISEMETER[] PROGMEM = "Noisemeter@Fade rate,Width;!,!;!;ix=128,m12=2,si=0,1d,vo"; // Circle, Beatsin ////////////////////// @@ -6491,7 +6491,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline. return FRAMETIME; } // mode_pixelwave() -static const char _data_FX_MODE_PIXELWAVE[] PROGMEM = "Pixelwave@!,Sensitivity;!,!;!;ix=64,mp12=2,ssim=0,1d,vo"; // Circle, Beatsin +static const char _data_FX_MODE_PIXELWAVE[] PROGMEM = "Pixelwave@!,Sensitivity;!,!;!;ix=64,m12=2,si=0,1d,vo"; // Circle, Beatsin ////////////////////// @@ -6532,7 +6532,7 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline. return FRAMETIME; } // mode_plasmoid() -static const char _data_FX_MODE_PLASMOID[] PROGMEM = "Plasmoid@Phase,# of pixels;!,!;!;sx=128,ix=128,mp12=0,ssim=0,1d,vo"; // Pixels, Beatsin +static const char _data_FX_MODE_PLASMOID[] PROGMEM = "Plasmoid@Phase,# of pixels;!,!;!;sx=128,ix=128,m12=0,si=0,1d,vo"; // Pixels, Beatsin /////////////////////// @@ -6576,7 +6576,7 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline. return FRAMETIME; } // mode_puddlepeak() -static const char _data_FX_MODE_PUDDLEPEAK[] PROGMEM = "Puddlepeak@Fade rate,Puddle size,Select bin,Volume (min);!,!;!;c2=0,mp12=0,ssim=0,1d,vo"; // Pixels, Beatsin +static const char _data_FX_MODE_PUDDLEPEAK[] PROGMEM = "Puddlepeak@Fade rate,Puddle size,Select bin,Volume (min);!,!;!;c2=0,m12=0,si=0,1d,vo"; // Pixels, Beatsin ////////////////////// @@ -6607,7 +6607,7 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline. return FRAMETIME; } // mode_puddles() -static const char _data_FX_MODE_PUDDLES[] PROGMEM = "Puddles@Fade rate,Puddle size;!,!;!;mp12=0,ssim=0,1d,vo"; // Pixels, Beatsin +static const char _data_FX_MODE_PUDDLES[] PROGMEM = "Puddles@Fade rate,Puddle size;!,!;!;m12=0,si=0,1d,vo"; // Pixels, Beatsin ////////////////////// @@ -6635,7 +6635,7 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline. return FRAMETIME; } // mode_pixels() -static const char _data_FX_MODE_PIXELS[] PROGMEM = "Pixels@Fade rate,# of pixels;,!;!;mp12=0,ssim=0,1d,vo"; // Pixels, Beatsin +static const char _data_FX_MODE_PIXELS[] PROGMEM = "Pixels@Fade rate,# of pixels;,!;!;m12=0,si=0,1d,vo"; // Pixels, Beatsin /////////////////////////////// @@ -6676,7 +6676,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline. return FRAMETIME; } // mode_blurz() -static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz@Fade rate,Blur amount;!,Color mix;!;mp12=0,ssim=0,1d,fr"; // Pixels, Beatsin +static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz@Fade rate,Blur amount;!,Color mix;!;m12=0,si=0,1d,fr"; // Pixels, Beatsin ///////////////////////// @@ -6711,7 +6711,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil return FRAMETIME; } // mode_DJLight() -static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed;;;mp12=2,ssim=0,1d,fr"; // Circle, Beatsin +static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed;;;m12=2,si=0,1d,fr"; // Circle, Beatsin //////////////////// @@ -6747,7 +6747,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN. return FRAMETIME; } // mode_freqmap() -static const char _data_FX_MODE_FREQMAP[] PROGMEM = "Freqmap@Fade rate,Starting color;,!;!;mp12=0,ssim=0,1d,fr"; // Pixels, Beatsin +static const char _data_FX_MODE_FREQMAP[] PROGMEM = "Freqmap@Fade rate,Starting color;,!;!;m12=0,si=0,1d,fr"; // Pixels, Beatsin /////////////////////// @@ -6802,7 +6802,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch return FRAMETIME; } // mode_freqmatrix() -static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Time delay,Sound effect,Low bin,High bin,Sensivity;;;mp12=3,ssim=0,1d,fr"; // Corner, Beatsin +static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Time delay,Sound effect,Low bin,High bin,Sensivity;;;m12=3,si=0,1d,fr"; // Corner, Beatsin ////////////////////// @@ -6837,7 +6837,7 @@ uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline. return FRAMETIME; } // mode_freqpixels() -static const char _data_FX_MODE_FREQPIXELS[] PROGMEM = "Freqpixels@Fade rate,Starting colour and # of pixels;;;mp12=0,ssim=0,1d,fr"; // Pixels, Beatsin +static const char _data_FX_MODE_FREQPIXELS[] PROGMEM = "Freqpixels@Fade rate,Starting colour and # of pixels;;;m12=0,si=0,1d,fr"; // Pixels, Beatsin ////////////////////// @@ -6906,7 +6906,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun return FRAMETIME; } // mode_freqwave() -static const char _data_FX_MODE_FREQWAVE[] PROGMEM = "Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=2,ssim=0,1d,fr"; // Circle, Beatsin +static const char _data_FX_MODE_FREQWAVE[] PROGMEM = "Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;m12=2,si=0,1d,fr"; // Circle, Beatsin /////////////////////// @@ -6958,7 +6958,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline. return FRAMETIME; } // mode_gravfreq() -static const char _data_FX_MODE_GRAVFREQ[] PROGMEM = "Gravfreq@Rate of fall,Sensivity;,!;!;ix=128,mp12=0,ssim=0,1d,fr"; // Pixels, Beatsin +static const char _data_FX_MODE_GRAVFREQ[] PROGMEM = "Gravfreq@Rate of fall,Sensivity;,!;!;ix=128,m12=0,si=0,1d,fr"; // Pixels, Beatsin ////////////////////// @@ -6986,7 +6986,7 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli return FRAMETIME; } // mode_noisemove() -static const char _data_FX_MODE_NOISEMOVE[] PROGMEM = "Noisemove@Speed of perlin movement,Fade rate;,!;!;mp12=0,ssim=0,1d,fr"; // Pixels, Beatsin +static const char _data_FX_MODE_NOISEMOVE[] PROGMEM = "Noisemove@Speed of perlin movement,Fade rate;,!;!;m12=0,si=0,1d,fr"; // Pixels, Beatsin ////////////////////// @@ -7026,7 +7026,7 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac return FRAMETIME; } // mode_rocktaves() -static const char _data_FX_MODE_ROCKTAVES[] PROGMEM = "Rocktaves@;,!;!;mp12=1,ssim=0,1d,fr"; // Bar, Beatsin +static const char _data_FX_MODE_ROCKTAVES[] PROGMEM = "Rocktaves@;,!;!;m12=1,si=0,1d,fr"; // Bar, Beatsin /////////////////////// @@ -7078,7 +7078,7 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin return FRAMETIME; } // mode_waterfall() -static const char _data_FX_MODE_WATERFALL[] PROGMEM = "Waterfall@!,Adjust color,Select bin,Volume (min);!,!;!;c2=0,mp12=2,ssim=0,1d,fr"; // Circles, Beatsin +static const char _data_FX_MODE_WATERFALL[] PROGMEM = "Waterfall@!,Adjust color,Select bin,Volume (min);!,!;!;c2=0,m12=2,si=0,1d,fr"; // Circles, Beatsin #ifndef WLED_DISABLE_2D @@ -7138,7 +7138,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma. return FRAMETIME; } // mode_2DGEQ() -static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ@Fade speed,Ripple decay,# of bands,,,Color bars;!,,Peak Color;!;c1=255,c2=64,pal=11,ssim=0,2d,fr"; // Beatsin +static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ@Fade speed,Ripple decay,# of bands,,,Color bars;!,,Peak Color;!;c1=255,c2=64,pal=11,si=0,2d,fr"; // Beatsin ///////////////////////// @@ -7196,7 +7196,7 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil return FRAMETIME; } // mode_2DFunkyPlank -static const char _data_FX_MODE_2DFUNKYPLANK[] PROGMEM = "Funky Plank@Scroll speed,,# of bands;;;ssim=0,2d,fr"; // Beatsin +static const char _data_FX_MODE_2DFUNKYPLANK[] PROGMEM = "Funky Plank@Scroll speed,,# of bands;;;si=0,2d,fr"; // Beatsin ///////////////////////// @@ -7299,7 +7299,7 @@ uint16_t mode_2DAkemi(void) { return FRAMETIME; } // mode_2DAkemi -static const char _data_FX_MODE_2DAKEMI[] PROGMEM = "Akemi@Color speed,Dance;Head palette,Arms & Legs,Eyes & Mouth;Face palette;ssim=0,2d,fr"; //beatsin +static const char _data_FX_MODE_2DAKEMI[] PROGMEM = "Akemi@Color speed,Dance;Head palette,Arms & Legs,Eyes & Mouth;Face palette;si=0,2d,fr"; //beatsin #endif // WLED_DISABLE_2D diff --git a/wled00/FX.h b/wled00/FX.h index 3c2d7e10..2241bf74 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -767,7 +767,7 @@ class WS2812FX { // 96 bytes inline uint8_t getSegmentsNum(void) { return _segments.size(); } // returns currently present segments inline uint8_t getCurrSegmentId(void) { return _segment_index; } inline uint8_t getMainSegmentId(void) { return _mainSegment; } - inline uint8_t getPaletteCount() { return 13 + GRADIENT_PALETTE_COUNT; } + inline uint8_t getPaletteCount() { return 13 + GRADIENT_PALETTE_COUNT; } // will only return built-in palette count inline uint8_t getTargetFps() { return _targetFps; } inline uint8_t getModeCount() { return _modeCount; } diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index 7159bcb0..c0c46888 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -114,10 +114,11 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col) #ifndef WLED_DISABLE_2D if (!isMatrix) return; // not a matrix set-up uint16_t index = y * matrixWidth + x; + if (index >= customMappingSize) return; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; -#endif if (index >= _length) return; +#endif if (index < customMappingSize) index = customMappingTable[index]; busses.setPixelColor(index, col); } @@ -126,10 +127,11 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col) uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) { #ifndef WLED_DISABLE_2D uint16_t index = (y * matrixWidth + x); + if (index >= customMappingSize) return 0; // customMappingSize is always W * H of matrix in 2D setup #else uint16_t index = x; -#endif if (index >= _length) return 0; +#endif if (index < customMappingSize) index = customMappingTable[index]; return busses.getPixelColor(index); } diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 1a82b1e0..d33e6349 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -412,18 +412,13 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) { sOpt = extractModeDefaults(fx, "c1"); if (sOpt >= 0) custom1 = sOpt; sOpt = extractModeDefaults(fx, "c2"); if (sOpt >= 0) custom2 = sOpt; sOpt = extractModeDefaults(fx, "c3"); if (sOpt >= 0) custom3 = sOpt; - sOpt = extractModeDefaults(fx, "mp12"); if (sOpt >= 0) map1D2D = constrain(sOpt, 0, 7); - sOpt = extractModeDefaults(fx, "ssim"); if (sOpt >= 0) soundSim = constrain(sOpt, 0, 7); + sOpt = extractModeDefaults(fx, "m12"); if (sOpt >= 0) map1D2D = constrain(sOpt, 0, 7); + sOpt = extractModeDefaults(fx, "si"); if (sOpt >= 0) soundSim = constrain(sOpt, 0, 7); sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) reverse = (bool)sOpt; sOpt = extractModeDefaults(fx, "mi"); if (sOpt >= 0) mirror = (bool)sOpt; // NOTE: setting this option is a risky business sOpt = extractModeDefaults(fx, "rY"); if (sOpt >= 0) reverse_y = (bool)sOpt; sOpt = extractModeDefaults(fx, "mY"); if (sOpt >= 0) mirror_y = (bool)sOpt; // NOTE: setting this option is a risky business - sOpt = extractModeDefaults(fx, "pal"); - if (sOpt >= 0 && (size_t)sOpt < strip.getPaletteCount() + strip.customPalettes.size()) { - if (sOpt != palette) { - palette = sOpt; - } - } + sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) setPalette(sOpt); } stateChanged = true; // send UDP/WS broadcast } @@ -431,13 +426,13 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) { } void Segment::setPalette(uint8_t pal) { - if (pal < strip.getPaletteCount()) { - if (pal != palette) { - if (strip.paletteFade) startTransition(strip.getTransition()); - palette = pal; - } + if (pal < 245 && pal > GRADIENT_PALETTE_COUNT+13) pal = 0; // built in palettes + if (pal > 245 && (strip.customPalettes.size() == 0 || 255U-pal > strip.customPalettes.size()-1)) pal = 0; // custom palettes + if (pal != palette) { + if (strip.paletteFade) startTransition(strip.getTransition()); + palette = pal; + stateChanged = true; // send UDP/WS broadcast } - stateChanged = true; // send UDP/WS broadcast } // 2D matrix diff --git a/wled00/data/index.js b/wled00/data/index.js index 3f624d83..6e2a3877 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -718,19 +718,19 @@ function populateSegments(s) miYck = ``; } let map2D = `