Merge branch 'MoonModules:mdev' into AC101-Support

This commit is contained in:
Troy
2024-07-10 15:32:43 -04:00
committed by GitHub
14 changed files with 505 additions and 320 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "wled",
"version": "0.14.1-b32.40",
"version": "0.14.1-b32.41",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "wled",
"version": "0.14.1-b32.40",
"version": "0.14.1-b32.41",
"license": "GPL-3.0-or-later",
"dependencies": {
"clean-css": "^4.2.3",

View File

@@ -1,6 +1,6 @@
{
"name": "wled",
"version": "0.14.1-b32.40",
"version": "0.14.1-b32.41",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {

View File

@@ -80,10 +80,11 @@ default_envs =
;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!!
esp32s2_PSRAM_M ;; experimental
esp32c3dev_4MB_M ;; experimental
esp32c3dev_2MB_M ;; experimental - 2MB Flash, no OTA
esp32c3mini_dio_4MB_M ;; for boards that need "dio" flash mode (instead of qio)
seeed_esp32c3_4MB_S ;; experimental
esp32_4MB_V4_S ;; experimental
esp32_16MB_V4_S ;; experimental, optimized for speed
esp32_16MB_V4_S ;; experimental - optimized for speed
esp32_16MB_V4_M ;; experimental
esp32_16MB_V4_M_debug ;; experimental
esp32_pico_4MB_V4_S ;; experimental - may work better in case you experience wifi connectivity problems
@@ -2180,6 +2181,33 @@ build_flags = ${env:esp32c3dev_4MB_M.build_flags}
; RAM: [=== ] 25.8% (used 84700 bytes from 327680 bytes)
; Flash: [==========] 98.7% (used 1552582 bytes from 1572864 bytes)
[env:esp32c3dev_2MB_M]
extends = env:esp32c3dev_4MB_M
board = lolin_c3_mini
;;; replace WLED_RELEASE_NAME, disable CDC_ON_BOOT
build_unflags = ${env:esp32c3dev_4MB_M.build_unflags}
-DARDUINO_USB_CDC_ON_BOOT=1
-D WLED_RELEASE_NAME=esp32c3dev_4MB_M
;;; 2MB Flash, no OTA
board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv
board_build.flash_mode = dio
board_upload.flash_size = 2MB
board_upload.maximum_size = 2097152
build_flags = ${env:esp32c3dev_4MB_M.build_flags}
-D WLED_WATCHDOG_TIMEOUT=0
-D WLED_DISABLE_OTA
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
-D WLED_RELEASE_NAME=esp32c3dev_2MB_M
-D WLED_DISABLE_BROWNOUT_DET ;; the board only has a 500mA LDO, better to disable brownout detection
-D WLED_DISABLE_ADALIGHT ;; to disable serial protocols for boards with CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
-D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; avoid pin conflicts
; RAM: [=== ] 25.3% (used 82828 bytes from 327680 bytes)
; Flash: [==========] 97.9% (used 1540138 bytes from 1572864 bytes)
;; MM environment for "seeed xiao -C3" boards
[env:seeed_esp32c3_4MB_S]
extends = env:esp32c3dev_4MB_M

File diff suppressed because it is too large Load Diff

View File

@@ -27,17 +27,9 @@ Currently ESP8266 is not supported, due to low speed and small RAM of this chip.
There are however plans to create a lightweight audioreactive for the 8266, with reduced features.
## Installation
### using customised _arduinoFFT_ library for use with this usermod
Add `-D USERMOD_AUDIOREACTIVE` to your PlatformIO environment `build_flags`, as well as `https://github.com/blazoncek/arduinoFFT.git` to your `lib_deps`.
If you are not using PlatformIO (which you should) try adding `#define USERMOD_AUDIOREACTIVE` to *my_config.h* and make sure you have _arduinoFFT_ library downloaded and installed.
### using latest _arduinoFFT_ library
Customised _arduinoFFT_ library for use with this usermod can be found at https://github.com/blazoncek/arduinoFFT.git
### using latest (develop) _arduinoFFT_ library
Alternatively, you can use the latest arduinoFFT development version.
ArduinoFFT `develop` library is slightly more accurate, and slightly faster than our customised library, however also needs additional 2kB RAM.
* `build_flags` = `-D USERMOD_AUDIOREACTIVE` `-D UM_AUDIOREACTIVE_USE_NEW_FFT`
* `build_flags` = `-D USERMOD_AUDIOREACTIVE`
* `lib_deps`= `https://github.com/kosme/arduinoFFT#develop @ 1.9.2`
## Configuration

View File

@@ -7794,13 +7794,14 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
uint8_t pixCol = (log10f(FFT_MajorPeak) - 2.26f) * 150; // 22Khz sampling - log10 frequency range is from 2.26 (182hz) to 3.967 (9260hz). Let's scale accordingly.
if (FFT_MajorPeak < 182.0f) pixCol = 0; // handle underflow
// loop will not execute if SEGLEN equals 1
for (int i = 0; i < SEGLEN-1; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // shift left
if (samplePeak) {
SEGMENT.setPixelColor(SEGLEN-1, CHSV(92,92,92));
} else {
SEGMENT.setPixelColor(SEGLEN-1, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(pixCol+SEGMENT.intensity, false, PALETTE_SOLID_WRAP, 0), (int)my_magnitude));
}
// loop will not execute if SEGLEN equals 1
for (int i = 0; i < SEGLEN-1; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // shift left
}
return FRAMETIME;

View File

@@ -518,9 +518,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
break;
}
mxconfig.chain_length = max((u_int8_t) 1, min(bc.pins[0], (u_int8_t) 4)); // prevent bad data preventing boot due to low memory
if(mxconfig.mx_width >= 64 && (bc.pins[0] > 1)) {
if(mxconfig.mx_height >= 64 && (bc.pins[0] > 1)) {
USER_PRINT("WARNING, only single panel can be used of 64 pixel boards due to memory")
mxconfig.chain_length = 1;
}
@@ -609,6 +607,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
#endif
mxconfig.chain_length = max((u_int8_t) 1, min(bc.pins[0], (u_int8_t) 4)); // prevent bad data preventing boot due to low memory
USER_PRINTF("MatrixPanel_I2S_DMA config - %ux%u length: %u\n", mxconfig.mx_width, mxconfig.mx_height, mxconfig.chain_length);
@@ -651,12 +650,18 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
switch(bc.type) {
case 105:
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_32PX_HIGH");
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_32PX_HIGH - 32x32");
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 32, 32);
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH);
fourScanPanel->setRotation(0);
break;
case 106:
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_32PX_HIGH - 64x32");
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 64, 32);
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_32PX_HIGH);
fourScanPanel->setRotation(0);
break;
case 107:
USER_PRINTLN("MatrixPanel_I2S_DMA FOUR_SCAN_64PX_HIGH");
fourScanPanel = new VirtualMatrixPanel((*display), 1, 1, 64, 64);
fourScanPanel->setPhysicalPanelScanRate(FOUR_SCAN_64PX_HIGH);

View File

@@ -384,7 +384,8 @@ ${i+1}:
<option value="102">Hub75Matrix 64x32</option>
<option value="103">Hub75Matrix 64x64</option>
<option value="105">Hub75Matrix 32x32 (Outdoor 8S)</option>
<option value="106">Hub75Matrix 64x64 (Outdoor 16S)</option>
<option value="106">Hub75Matrix 64x32 (Outdoor 8S)</option>
<option value="107">Hub75Matrix 64x64 (Outdoor 16S)</option>
</select><br>
<div id="co${i}" style="display:inline">Color Order:
<select name="CO${i}">

View File

@@ -146,6 +146,9 @@
urows += `<br>`;
}
}
function adF(k,f,o,a=false) { //shortcut for addField(key, field, (sub)object, isArray)
return addField(k,f,o,a);
}
// https://stackoverflow.com/questions/39729741/javascript-change-input-text-to-select-option
function addDropdown(um,fld) {
let sel = d.createElement('select');
@@ -170,6 +173,9 @@
}
return null;
}
function adD(um,fld) { // shortcut for addDropdown(um,fld)
return addDropdown(um,fld);
}
function addOption(sel,txt,val) {
if (sel===null) return; // select object missing
let opt = d.createElement("option");
@@ -181,6 +187,9 @@
if (c.value == sel.dataset.val) sel.selectedIndex = i;
}
}
function adO(sel,txt,val) { // shortcut for addOption(sel,txt,val)
return addOption(sel,txt,val);
}
//WLEDMM: replace Option to set globals
function rOpt(name,el,txt,val) {
let obj = d.getElementsByName(name);
@@ -285,6 +294,9 @@
if (txt2!="") obj[el].insertAdjacentHTML('beforebegin', txt2 + '&nbsp;'); //add pre texts
}
}
function adI(name,el,txt, txt2="") { // shortcut for addInfo(name,el,txt, txt2="")
return addInfo(name,el,txt, txt2);
}
// add Help Button
function addHB(um)
{

View File

@@ -362,6 +362,7 @@ int getNumVal(const String* req, uint16_t pos);
void parseNumber(const char* str, byte* val, byte minv=0, byte maxv=255);
bool getVal(JsonVariant elem, byte* val, byte minv=0, byte maxv=255);
bool updateVal(const char* req, const char* key, byte* val, byte minv=0, byte maxv=255);
void oappendUseDeflate(bool OnOff); // enable / disable string squeezing
bool oappend(const char* txt); // append new c string to temp buffer efficiently
bool oappendi(int i); // append new number to temp buffer efficiently
void sappend(char stype, const char* key, int val);

View File

@@ -144,22 +144,34 @@ bool oappendi(int i)
return oappend(s);
}
static bool squeezeStrings = false;
void oappendUseDeflate(bool OnOff) { squeezeStrings = OnOff; }
bool oappend(const char* txt)
{
uint16_t len = strlen(txt);
String str = squeezeStrings ? String(txt) : String("");
if (squeezeStrings) {
// simple fixed-dictionary deflate
str.replace(F("addField("), F("adF("));
str.replace(F("addDropdown("), F("adD("));
str.replace(F("addOption("), F("adO("));
str.replace(F("addInfo("), F("adI("));
}
const char* finalTxt = squeezeStrings ? str.c_str() : txt;
size_t len = strlen(finalTxt);
if ((obuf == nullptr) || (olen + len >= SETTINGS_STACK_BUF_SIZE)) { // sanity checks
if (obuf == nullptr) { USER_PRINTLN(F("oappend() error: obuf == nullptr."));
} else {
USER_PRINT(F("oappend() error: buffer full. Increase SETTINGS_STACK_BUF_SIZE for "));
USER_PRINTF("%2u bytes \t\"", len /*1 + olen + len - SETTINGS_STACK_BUF_SIZE*/);
USER_PRINT(txt);
USER_PRINT(finalTxt);
USER_PRINTLN(F("\""));
errorFlag = ERR_LOW_AJAX_MEM;
}
return false; // buffer full
}
strcpy(obuf + olen, txt);
strcpy(obuf + olen, finalTxt);
olen += len;
return true;
}

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2406230
#define VERSION 2407050
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
#define _MoonModules_WLED_

View File

@@ -277,9 +277,10 @@ static bool sendLiveLedsWs(uint32_t wsClient) // WLEDMM added "static"
// WLEDMM begin: preview with color gamma correction
if (gammaCorrectPreview) {
uint8_t w = W(c); // not sure why, but it looks better if using "white" without corrections
buffer[pos++] = qadd8(w, unGamma8(R(c))); //R, add white channel to RGB channels as a simple RGBW -> RGB map
buffer[pos++] = qadd8(w, unGamma8(G(c))); //G
buffer[pos++] = qadd8(w, unGamma8(B(c))); //B
if (w>0) c = color_add(c, RGBW32(w, w, w, 0), false); // add white channel to RGB channels - color_add() will prevent over-saturation
buffer[pos++] = unGamma8(R(c)); //R
buffer[pos++] = unGamma8(G(c)); //G
buffer[pos++] = unGamma8(B(c)); //B
} else {
// WLEDMM end
uint8_t w = W(c); // WLEDMM small optimization

View File

@@ -792,6 +792,7 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
if (subPage == 8) //usermods
{
appendGPIOinfo();
oappendUseDeflate(true); // allow replacing long functions with shorter equivalents - only works for usermods
if (!request->hasParam("um") ) {
// oappend(SET_F("numM="));
// oappendi(usermods.getModCount());
@@ -834,6 +835,7 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
Usermod *usermod = usermods.lookupName(request->getParam("um")->value().c_str());
if (usermod) usermod->appendConfigData();
}
oappendUseDeflate(false);
// oappend(SET_F("console.log('getSettingsJS fix ro pins', d.max_gpio, d.ro_gpio);"));
oappend(SET_F("pinPost();"));