Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
run: |
jq -n \
--arg content "Pull Request #${PR_NUMBER} \"${PR_TITLE}\" merged by ${ACTOR}
${PR_URL}. It will be included in the next nightly builds, please test" \
${PR_URL} . It will be included in the next nightly builds, please test" \
'{content: $content}' \
| curl -H "Content-Type: application/json" -d @- ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}
22 changes: 17 additions & 5 deletions platformio_override.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -549,25 +549,30 @@ platform_packages =
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags}
-D WLED_RELEASE_NAME=\"ESP32_hub75\"
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
; -D ESP32_FORUM_PINOUT ;; enable for SmartMatrix default pins
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
-D LED_TYPES=65 -D DATA_PINS=64,64,1
-D WLED_DEBUG_BUS
; -D WLED_DEBUG
lib_deps = ${esp32_idf_V4.lib_deps}
https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git#3.0.11

monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio
custom_usermods = audioreactive

[env:esp32dev_hub75_forum_pinout]
extends = env:esp32dev_hub75
build_flags = ${common.build_flags}
-D WLED_RELEASE_NAME=\"ESP32_hub75_forum_pinout\"
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
-D ESP32_FORUM_PINOUT ;; enable for SmartMatrix default pins
-D LED_TYPES=65 -D DATA_PINS=64,64,1
-D WLED_DEBUG_BUS
; -D WLED_DEBUG



[env:adafruit_matrixportal_esp32s3]
; ESP32-S3 processor, 8 MB flash, 2 MB of PSRAM, dedicated driver pins for HUB75
board = adafruit_matrixportal_esp32s3
Expand All @@ -581,9 +586,12 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0
${esp32.AR_build_flags}
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
-D ARDUINO_ADAFRUIT_MATRIXPORTAL_ESP32S3
-D LED_TYPES=65 -D DATA_PINS=64,64,1
-D WLED_DEBUG_BUS


lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
Expand All @@ -593,6 +601,7 @@ board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
custom_usermods = audioreactive

[env:esp32S3_PSRAM_HUB75]
;; MOONHUB HUB75 adapter board
Expand All @@ -607,9 +616,11 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0
${esp32.AR_build_flags}
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX -D NO_CIE1931
-D WLED_ENABLE_HUB75MATRIX -D NO_GFX
-D S3_LCD_DIV_NUM=20 ;; Attempt to fix wifi performance issue when panel active with S3 chips
-D MOONHUB_S3_PINOUT ;; HUB75 pinout
-D LED_TYPES=65 -D DATA_PINS=64,64,1
-D WLED_DEBUG_BUS

lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
Expand All @@ -619,3 +630,4 @@ board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
custom_usermods = audioreactive
17 changes: 15 additions & 2 deletions tools/cdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async function writeHtmlGzipped(sourceFile, resultFile, page) {
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
const array = hexdump(result);
let src = singleHeader;
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
src += `const uint16_t PAGE_${page}_length = ${result.length};\n`;
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
console.info("Writing " + resultFile);
fs.writeFileSync(resultFile, src);
Expand Down Expand Up @@ -244,9 +244,22 @@ if (isAlreadyBuilt("wled00/data") && process.argv[2] !== '--force' && process.ar

writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h", 'index');
writeHtmlGzipped("wled00/data/pixart/pixart.htm", "wled00/html_pixart.h", 'pixart');
writeHtmlGzipped("wled00/data/cpal/cpal.htm", "wled00/html_cpal.h", 'cpal');
//writeHtmlGzipped("wled00/data/cpal/cpal.htm", "wled00/html_cpal.h", 'cpal');
writeHtmlGzipped("wled00/data/pxmagic/pxmagic.htm", "wled00/html_pxmagic.h", 'pxmagic');

writeChunks(
"wled00/data/cpal",
[
{
file: "cpal.htm",
name: "PAGE_cpal",
method: "gzip",
filter: "html-minify"
}
],
"wled00/html_cpal.h"
);

writeChunks(
"wled00/data",
[
Expand Down
115 changes: 79 additions & 36 deletions tools/wled-tools
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,78 @@ log() {
fi
}

# Generic curl handler function
curl_handler() {
local command="$1"
local hostname="$2"

response=$($command -w "%{http_code}" -o /dev/null)
curl_exit_code=$?

if [ "$response" -ge 200 ] && [ "$response" -lt 300 ]; then
return 0
elif [ $curl_exit_code -ne 0 ]; then
log "ERROR" "$RED" "Connection error during request to $hostname (curl exit code: $curl_exit_code)."
return 1
elif [ "$response" -ge 400 ]; then
log "ERROR" "$RED" "Server error during request to $hostname (HTTP status code: $response)."
return 2
# Fetch a URL to a destination file, validating status codes.
# Usage: fetch "<url>" "<dest or empty>" "200 404"
fetch() {
local url="$1"
local dest="$2"
local accepted="${3:-200}"

# If no dest given, just discard body
local out
if [ -n "$dest" ]; then
# Write to ".tmp" files first, then move when success, to ensure we don't write partial files
out="${dest}.tmp"
else
log "ERROR" "$RED" "Unexpected response from $hostname (HTTP status code: $response)."
return 3
out="/dev/null"
fi

response=$(curl --connect-timeout 5 --max-time 30 -s -w "%{http_code}" -o "$out" "$url")
local curl_exit_code=$?

if [ $curl_exit_code -ne 0 ]; then
[ -n "$dest" ] && rm -f "$out"
log "ERROR" "$RED" "Connection error during request to $url (curl exit code: $curl_exit_code)."
return 1
fi

for code in $accepted; do
if [ "$response" = "$code" ]; then
# Accepted; only persist body for 2xx responses
if [ -n "$dest" ]; then
if [[ "$response" =~ ^2 ]]; then
mv "$out" "$dest"
else
rm -f "$out"
fi
fi
return 0
fi
done

# not accepted
[ -n "$dest" ] && rm -f "$out"
log "ERROR" "$RED" "Unexpected response from $url (HTTP $response)."
return 2
}


# POST a file to a URL, validating status codes.
# Usage: post_file "<url>" "<file>" "200"
post_file() {
local url="$1"
local file="$2"
local accepted="${3:-200}"

response=$(curl --connect-timeout 5 --max-time 300 -s -w "%{http_code}" -o /dev/null -X POST -F "file=@$file" "$url")
local curl_exit_code=$?

if [ $curl_exit_code -ne 0 ]; then
log "ERROR" "$RED" "Connection error during POST to $url (curl exit code: $curl_exit_code)."
return 1
fi

for code in $accepted; do
if [ "$response" -eq "$code" ]; then
return 0
fi
done

log "ERROR" "$RED" "Unexpected response from $url (HTTP $response)."
return 2
}


# Print help message
show_help() {
cat << EOF
Expand Down Expand Up @@ -109,33 +159,27 @@ backup_one() {
local address="$2"
local port="$3"

log "INFO" "$YELLOW" "Backing up device config/presets: $hostname ($address:$port)"
log "INFO" "$YELLOW" "Backing up device config/presets/ir: $hostname ($address:$port)"

mkdir -p "$backup_dir"

local cfg_url="http://$address:$port/cfg.json"
local presets_url="http://$address:$port/presets.json"
local cfg_dest="${backup_dir}/${hostname}.cfg.json"
local presets_dest="${backup_dir}/${hostname}.presets.json"

# Write to ".tmp" files first, then move when success, to ensure we don't write partial files
local curl_command_cfg="curl -s "$cfg_url" -o "$cfg_dest.tmp""
local curl_command_presets="curl -s "$presets_url" -o "$presets_dest.tmp""
local file_prefix="${backup_dir}/${hostname}"

if ! curl_handler "$curl_command_cfg" "$hostname"; then
if ! fetch "http://$address:$port/cfg.json" "${file_prefix}.cfg.json"; then
log "ERROR" "$RED" "Failed to backup configuration for $hostname"
rm -f "$cfg_dest.tmp"
return 1
fi

if ! curl_handler "$curl_command_presets" "$hostname"; then
if ! fetch "http://$address:$port/presets.json" "${file_prefix}.presets.json"; then
log "ERROR" "$RED" "Failed to backup presets for $hostname"
rm -f "$presets_dest.tmp"
return 1
fi
fi

# ir.json is optional
if ! fetch "http://$address:$port/ir.json" "${file_prefix}.ir.json" "200 404"; then
log "ERROR" "$RED" "Failed to backup ir configs for $hostname"
fi

mv "$cfg_dest.tmp" "$cfg_dest"
mv "$presets_dest.tmp" "$presets_dest"
log "INFO" "$GREEN" "Successfully backed up config and presets for $hostname"
return 0
}
Expand All @@ -150,9 +194,8 @@ update_one() {
log "INFO" "$YELLOW" "Starting firmware update for device: $hostname ($address:$port)"

local url="http://$address:$port/update"
local curl_command="curl -s -X POST -F "file=@$firmware" "$url""

if ! curl_handler "$curl_command" "$hostname"; then
if ! post_file "$url" "$firmware" "200"; then
log "ERROR" "$RED" "Failed to update firmware for $hostname"
return 1
fi
Expand Down
2 changes: 1 addition & 1 deletion usermods/audioreactive/audio_reactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ void AudioReactive::createAudioPalettes(void) {
if (palettes) return;
DEBUG_PRINTLN(F("Adding audio palettes."));
for (int i=0; i<MAX_PALETTES; i++)
if (customPalettes.size() < 10) {
if (customPalettes.size() < WLED_MAX_CUSTOM_PALETTES) {
customPalettes.push_back(CRGBPalette16(CRGB(BLACK)));
palettes++;
DEBUG_PRINTLN(palettes);
Expand Down
13 changes: 10 additions & 3 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7275,6 +7275,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
if (!strip.isMatrix || !SEGMENT.is2D()) return mode_static(); // not a 2D set-up

const int NUM_BANDS = map(SEGMENT.custom1, 0, 255, 1, 16);
const int CENTER_BIN = map(SEGMENT.custom3, 0, 31, 0, 15);
const int cols = SEG_W;
const int rows = SEG_H;

Expand All @@ -7296,8 +7297,14 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
if ((fadeoutDelay <= 1 ) || ((SEGENV.call % fadeoutDelay) == 0)) SEGMENT.fadeToBlackBy(SEGMENT.speed);

for (int x=0; x < cols; x++) {
uint8_t band = map(x, 0, cols, 0, NUM_BANDS);
if (NUM_BANDS < 16) band = map(band, 0, NUM_BANDS - 1, 0, 15); // always use full range. comment out this line to get the previous behaviour.
int band = map(x, 0, cols, 0, NUM_BANDS);
if (NUM_BANDS < 16) {
int startBin = constrain(CENTER_BIN - NUM_BANDS/2, 0, 15 - NUM_BANDS + 1);
if(NUM_BANDS <= 1)
band = CENTER_BIN; // map() does not work for single band
else
band = map(band, 0, NUM_BANDS - 1, startBin, startBin + NUM_BANDS - 1);
}
band = constrain(band, 0, 15);
unsigned colorIndex = band * 17;
int barHeight = map(fftResult[band], 0, 255, 0, rows); // do not subtract -1 from rows here
Expand All @@ -7319,7 +7326,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;!,,Peaks;!;2f;c1=255,c2=64,pal=11,si=0"; // Beatsin
static const char _data_FX_MODE_2DGEQ[] PROGMEM = "GEQ@Fade speed,Ripple decay,# of bands,,Bin,Color bars;!,,Peaks;!;2f;c1=255,c2=64,pal=11,si=0,c3=0";


/////////////////////////
Expand Down
Loading