Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
86f67e1
make it compileable, fix some python path error
softwarecrash May 10, 2025
7b9819a
fixing door bug
softwarecrash May 11, 2025
0e2bda6
activate the ota page
softwarecrash May 11, 2025
9537756
fix html compressor again
softwarecrash May 11, 2025
e33319a
push
softwarecrash May 12, 2025
a2edf1b
make it offline usable
softwarecrash May 12, 2025
f7c35e0
change html compressor to merge one file
softwarecrash May 12, 2025
18db160
add favicon
softwarecrash May 12, 2025
a939780
remove unnescary comments
softwarecrash May 12, 2025
209dd08
fix ota
softwarecrash May 12, 2025
612a8fa
update
softwarecrash May 12, 2025
949c19e
Delete src/www/www.h
softwarecrash May 13, 2025
a91a649
Delete .vscode directory
softwarecrash May 13, 2025
1cb9551
Delete .firmware directory
softwarecrash May 13, 2025
58dafeb
Delete src/.DS_Store
softwarecrash May 13, 2025
52b03a3
Rename updatepage.html to updatePage.html
softwarecrash May 13, 2025
16fb66e
update
softwarecrash May 13, 2025
7f91b1b
Rename setuppage.html to setupPage.html
softwarecrash May 13, 2025
01d2632
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 13, 2025
50ec23d
Delete src/www/www.h
softwarecrash May 13, 2025
793ccb6
update
softwarecrash May 13, 2025
541b16d
update
softwarecrash May 13, 2025
ec9512d
Delete src/www/www.h
softwarecrash May 13, 2025
3bb6123
optimizing the hell out of the webserver
softwarecrash May 13, 2025
d7b67fc
add http basic auth
softwarecrash May 13, 2025
0f07cf6
add ws
softwarecrash May 13, 2025
e93eeab
add test vars to ws
softwarecrash May 13, 2025
82da40d
fix handler
softwarecrash May 13, 2025
9f2c3a6
update
softwarecrash May 14, 2025
fa439a1
updates
softwarecrash May 15, 2025
0a3944b
updates
softwarecrash May 15, 2025
bc6ae66
cleanup and add fwupdate button
softwarecrash May 15, 2025
bf09338
correct name for PR
softwarecrash May 15, 2025
93de638
Merge branch 'main' into main
softwarecrash May 15, 2025
979478e
remove gz
softwarecrash May 15, 2025
fe15ba2
remove obfocusate, they dint work with webUI
softwarecrash May 16, 2025
a861ee1
remove some delay
softwarecrash May 16, 2025
9b81828
add origin pr #24
softwarecrash May 16, 2025
cba29ac
add origin pr #30
softwarecrash May 16, 2025
c60dac3
partial adapt origin pr #53
softwarecrash May 16, 2025
3d3e453
add description
softwarecrash May 16, 2025
bb7ddca
correct comment
softwarecrash May 16, 2025
276b315
Finish OTA update style
softwarecrash May 17, 2025
09f28d1
fix wifi setup page again
softwarecrash May 17, 2025
ed8fba6
fix user auth
softwarecrash May 17, 2025
cd8762d
some changes on filesystem and webUI
softwarecrash May 17, 2025
6ecf69d
add project codename
softwarecrash May 17, 2025
8206ea8
finish OTA and WiFi pages
softwarecrash May 17, 2025
baa2b70
add buttons
softwarecrash May 17, 2025
c2dc437
Update README.md
softwarecrash May 17, 2025
4d79135
Update README.md
softwarecrash May 17, 2025
dcac0ad
correcting version
softwarecrash May 17, 2025
61a1014
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 17, 2025
5e4682e
cleanup
softwarecrash May 17, 2025
7031958
add webflash
softwarecrash May 18, 2025
f59c96c
move
softwarecrash May 18, 2025
799acd7
move
softwarecrash May 18, 2025
d40e0be
update
softwarecrash May 18, 2025
2146241
Update README.md
softwarecrash May 18, 2025
3a63ef1
change ico
softwarecrash May 18, 2025
8ac4535
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
785cfbf
update runner
softwarecrash May 18, 2025
cd87498
update flasher
softwarecrash May 18, 2025
a6f2279
Update firmware files (latest 3 releases + 3 pre-releases)
actions-user May 18, 2025
a042611
style updatepage
softwarecrash May 18, 2025
cb9eeba
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
18a402e
modify flasher
softwarecrash May 18, 2025
ae4bc5d
remove tests
softwarecrash May 18, 2025
8f2be29
fix runner
softwarecrash May 18, 2025
eea96aa
add placeholder
softwarecrash May 18, 2025
895859d
edit runner
softwarecrash May 18, 2025
429df6c
Update firmware and manifests
actions-user May 18, 2025
ebe7fe8
correct runner
softwarecrash May 18, 2025
98dbe66
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
cbcb4e8
Update firmware and manifests
actions-user May 18, 2025
f00011f
fix logo path
softwarecrash May 18, 2025
85d126c
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
23d0539
modify runner
softwarecrash May 18, 2025
44501c3
Update firmware and manifests
actions-user May 18, 2025
1e6601b
Trigger GitHub Pages rebuild
actions-user May 18, 2025
0219544
fix runner, prevent PR
softwarecrash May 18, 2025
1664510
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
53aeec9
fix workflow
softwarecrash May 18, 2025
55393b5
correct path
softwarecrash May 18, 2025
fd77c13
correct path again
softwarecrash May 18, 2025
20c126e
path correct the x
softwarecrash May 18, 2025
9c2e97d
cleanup
softwarecrash May 18, 2025
25487f8
update
softwarecrash May 18, 2025
03b9ea1
Update firmware and manifests
actions-user May 18, 2025
f1f6e2b
correct manifest
softwarecrash May 18, 2025
b9ab097
Update firmware and manifests
actions-user May 18, 2025
dcbe668
add instructions
softwarecrash May 18, 2025
0015444
change version
softwarecrash May 18, 2025
bf5c01a
Update firmware and manifests
actions-user May 18, 2025
cc8f60d
Merge branch 'main' of https://github.com/softwarecrash/BLLEDControll…
softwarecrash May 18, 2025
b6f5970
add ignores
softwarecrash May 18, 2025
a8aeda4
fix typo
softwarecrash May 18, 2025
bf9dcba
move orgin setup page to old alternative place
softwarecrash May 18, 2025
ab0fe6a
fix old setuppage
softwarecrash May 18, 2025
8383d23
force add
softwarecrash May 18, 2025
8a22c4c
Update firmware and manifests
actions-user May 18, 2025
dd55e9b
correct some style
softwarecrash May 18, 2025
03323cf
add backup&restore
softwarecrash May 18, 2025
c9627e7
remove style
softwarecrash May 18, 2025
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
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ['https://donate.softwarecrash.de']
22 changes: 22 additions & 0 deletions .github/workflows/ISSUE_WORKFLOW.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
106 changes: 106 additions & 0 deletions .github/workflows/update_wewbflash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Update Firmware Files and Manifests

on:
release:
types: [published, edited]
workflow_dispatch:

jobs:
update-firmware:
if: github.repository == 'softwarecrash/BLLEDController-NG'
runs-on: ubuntu-latest

steps:
- name: Abort if running in upstream repo
if: github.repository != 'softwarecrash/BLLEDController-NG'
run: |
echo "❌ Running in upstream repo: ${{ github.repository }}"
exit 1

- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Git
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'

- name: Download Last 3 Releases + 3 Pre-Releases
id: fetch-all
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const owner = context.repo.owner;
const repo = context.repo.repo;

const releases = await github.rest.repos.listReleases({ owner, repo });
const stable = [];
const pre = [];

for (const rel of releases.data) {
if (rel.draft) continue;
(rel.prerelease ? pre : stable).push(rel);
if (stable.length >= 3 && pre.length >= 3) break;
}

const selected = [...stable.slice(0, 3), ...pre.slice(0, 3)];
const firmwareList = [];

for (const release of selected) {
const tag = release.tag_name;
const version = tag.replace(/^v/gi, '');
const isPre = release.prerelease;
const assets = release.assets.filter(a => a.name.endsWith('.bin'));

for (const asset of assets) {
const dl = await github.rest.repos.getReleaseAsset({
owner,
repo,
asset_id: asset.id,
headers: { Accept: 'application/octet-stream' }
});
fs.writeFileSync(asset.name, Buffer.from(dl.data));
firmwareList.push({
version: version,
prerelease: isPre,
file: asset.name
});
console.log(`Downloaded: ${asset.name}`);
}
}

fs.writeFileSync('firmware_meta.json', JSON.stringify(firmwareList, null, 2));

- name: Clear and Prepare /docs/firmware
run: |
mkdir -p docs/firmware
rm -f docs/firmware/*.bin
rm -f docs/firmware/*.json
cp *.bin docs/firmware/
echo "Updated at $(date -u)" > docs/firmware/last_update.txt
cp firmware_meta.json docs/firmware/firmware.json

- name: Generate Manifest Files for ESP Web Tools
run: node generateRelease.js
working-directory: ./docs

- name: Commit and Push Changes (only if needed)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/softwarecrash/BLLEDController-NG.git
git fetch origin main
git checkout main
git add -f docs/firmware

if git diff --cached --quiet; then
echo "✅ Keine Änderungen – kein Push."
else
git commit -m "Update firmware and manifests"
git pull --rebase origin main
git push origin main
fi
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.vscode
.firmware
build/
BLLEDController.code-workspace
.python-version

# generated .h files from html
# src/www/setuppage.h Still needs this for compilation.
src/www/www.h
.DS_Store
**/.DS_Store
docs/firmware
8 changes: 0 additions & 8 deletions .theia/launch.json

This file was deleted.

Binary file removed .vs/BLLEDController/v16/.suo
Binary file not shown.
Binary file removed .vs/slnx.sqlite
Binary file not shown.
4 changes: 0 additions & 4 deletions .vscode/arduino.json

This file was deleted.

10 changes: 0 additions & 10 deletions .vscode/extensions.json

This file was deleted.

38 changes: 0 additions & 38 deletions .vscode/settings.json

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

The BL Led Controller is an ESP8266 / ESP32 based device that connects to your Bambulab X1,X1C,P1P Or P1S and controls the LED strip based on the state of the printer.

### Flashing and Setup
1. go to https://softwarecrash.github.io/BLLEDController-NG/
2. connect your ESP32
3. Select the Firmware build you want
4. Click on Flash
5. Search and connect to a WiFi Hotspot called "BLLED-AP"
6. Surf to http://192.168.4.1
7. Select your WiFi and Enter passwort, Optional enter all the Printer informations
8. enjoy :)

### Features
WiFi Setup:
![1000063279](https://github.com/user-attachments/assets/1cbe01fd-ce1f-4664-909e-7f6f50f6d80a)

OTA Firmware Update:
![1000063277](https://github.com/user-attachments/assets/853fa8cd-def6-47e9-8b23-4a4289651510)

- Connects to Bambulab X1,X1C,P1P Or P1S
- Controls LED strip based on printer state
Expand Down
135 changes: 75 additions & 60 deletions compress_html.py
Original file line number Diff line number Diff line change
@@ -1,66 +1,81 @@
import sys
import gzip
import subprocess
import os
import glob

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
HTML_DIR = os.path.join(SCRIPT_DIR, "src", "www")

OUTPUT_HEADER_NAME = "www.h"
OUTPUT_HEADER = os.path.join(HTML_DIR, OUTPUT_HEADER_NAME)

SUPPORTED_EXTENSIONS = ["*.html", "*.js", "*.css","*.svg","*.png"]

MIME_TYPES = {
".html": "text/html",
".htm": "text/html",
".js": "application/javascript",
".css": "text/css",
".json": "application/json",
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".svg": "image/svg+xml",
".ico": "image/x-icon",
}

def generate_header_start(f):
f.write("#ifndef WWW_H\n#define WWW_H\n\n")
f.write("#include <pgmspace.h>\n\n")

def generate_header_end(f):
f.write("\n#endif // WWW_H\n")

def guess_mime_type(filename):
_, ext = os.path.splitext(filename.lower())
return MIME_TYPES.get(ext, "application/octet-stream")

def compress_and_append_file(input_file, f):
compressed_file = input_file + ".gz"

with open(input_file, "rb") as infile:
with gzip.open(compressed_file, "wb", compresslevel=6) as outfile:
outfile.write(infile.read())

with open(compressed_file, "rb") as cf:
data = cf.read()

array_name = os.path.basename(input_file).replace(".", "_")

f.write(f"const uint8_t {array_name}_gz[] PROGMEM = {{\n")
for i in range(0, len(data), 16):
line = ', '.join(f'0x{b:02x}' for b in data[i:i+16])
f.write(f" {line},\n")
f.write("};\n\n")
f.write(f"const unsigned int {array_name}_gz_len = {len(data)};\n")
f.write(f"const char * {array_name}_gz_mime = \"{guess_mime_type(input_file)}\";\n\n")

def should_compress(html_file, header_file):
if not os.path.exists(header_file):
return True

html_modified_time = os.path.getmtime(html_file)
header_modified_time = os.path.getmtime(header_file)

return html_modified_time > header_modified_time

def compress_html(html_file):
# Check if compression is necessary
header_file = os.path.splitext(html_file)[0] + ".h"
if not should_compress(html_file, header_file):
print("No need to compress:", html_file)
return

# Compress HTML file
compressed_file = html_file + ".gz"
with open(html_file, "rb") as input_file:
with gzip.open(compressed_file, "wb", compresslevel=6) as output_file:
output_file.write(input_file.read())

# Check if .h file exists and if HTML file is newer
if os.path.exists(header_file):
header_modified_time = os.path.getmtime(header_file)
html_modified_time = os.path.getmtime(html_file)
if html_modified_time < header_modified_time:
print("No need to generate header file. HTML file is not modified.")
os.remove(compressed_file)
return

# Generate header file
print("Header file path:", header_file) # Debug print
result = subprocess.run(["xxd", "-i", compressed_file], stdout=open(header_file, "w"))
if result.returncode != 0:
print("Error: xxd failed to generate the header file")
return

# Modify the generated header file to include PROGMEM attribute
with open(header_file, "r") as file:
content = file.read()

with open(header_file, "w") as file:
# Add PROGMEM attribute after the array declaration
content = content.replace("unsigned char ", "const uint8_t ")
# Remove "__" prefix from the length variable
content = content.replace("unsigned int ", "unsigned int ")
# Add PROGMEM attribute after the variable name
content = content.replace("const uint8_t ", "const uint8_t ", 1).replace("{", "PROGMEM {")
file.write(content)

# Clean up
os.remove(compressed_file)
print(f"Appended: {array_name}_gz to {OUTPUT_HEADER_NAME} with MIME {guess_mime_type(input_file)}")

if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python compress_html.py <html_file>")
sys.exit(1)

html_file = sys.argv[1]
compress_html(html_file)
if not os.path.isdir(HTML_DIR):
print(f"Error: {HTML_DIR} is not a valid directory")
exit(1)

files_to_process = []
for pattern in SUPPORTED_EXTENSIONS:
files_to_process.extend(glob.glob(os.path.join(HTML_DIR, pattern)))

if not files_to_process:
print(f"No matching files found in {HTML_DIR}")
exit(0)

with open(OUTPUT_HEADER, "w") as f:
generate_header_start(f)

for file in files_to_process:
compress_and_append_file(file, f)

generate_header_end(f)

print(f"\n✅ All files combined into: {OUTPUT_HEADER}")
1 change: 1 addition & 0 deletions docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sun May 18 11:18:13 UTC 2025
Loading