fastled 1.1.20__tar.gz → 1.1.21__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastled-1.1.20 → fastled-1.1.21}/PKG-INFO +2 -1
- {fastled-1.1.20 → fastled-1.1.21}/README.md +1 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/__init__.py +1 -1
- fastled-1.1.21/src/fastled/app.py +197 -0
- fastled-1.1.20/src/fastled/app.py → fastled-1.1.21/src/fastled/client_server.py +51 -233
- fastled-1.1.21/src/fastled/env.py +8 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/keyboard.py +25 -5
- fastled-1.1.21/src/fastled/types.py +10 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/PKG-INFO +2 -1
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/SOURCES.txt +3 -0
- {fastled-1.1.20 → fastled-1.1.21}/.aiderignore +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.github/workflows/lint.yml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.github/workflows/test_win.yml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.gitignore +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.pylintrc +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.vscode/launch.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.vscode/settings.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/.vscode/tasks.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/LICENSE +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/MANIFEST.in +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/clean +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/docs/fastled.js +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/docs/fastled.wasm +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/docs/index.css +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/docs/index.html +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/docs/index.js +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Blink/Blink.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/Chromancer.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/detail.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/gary_woos_wled_port/presets.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/gary_woos_wled_port/presets.min.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/gen.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/mapping.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/net.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/output.json +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/ripple.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/screenmap.json.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/ColorPalette/ColorPalette.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/ColorTemperature/ColorTemperature.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Cylon/Cylon.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/DemoReel100/DemoReel100.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Esp32Rmt51/Esp32Rmt51.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/EspI2SDemo/EspI2SDemo.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Fire2012/Fire2012.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Fire2012WithPalette/Fire2012WithPalette.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/FirstLight/FirstLight.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/FxEngine/FxEngine.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Noise/Noise.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/NoisePlayground/NoisePlayground.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/NoisePlusPalette/NoisePlusPalette.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/OctoWS2811/OctoWS2811.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Pacifica/Pacifica.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Pride2015/Pride2015.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/SdCard/SdCard.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/SdCard/screenmap.json.h +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/TwinkleFox/TwinkleFox.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Video/Gfx2Video/Gfx2Video.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/WasmScreenCoords/WasmScreenCoords.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/Water/Water.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/XYMatrix/XYMatrix.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/examples/wasm/wasm.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/install +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/lint +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/pyproject.toml +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/requirements.testing.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/setup.cfg +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/setup.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/assets/example.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/build_mode.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/cli.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/compile_server.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/docker_manager.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/filewatcher.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/open_browser.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/paths.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/sketch.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/util.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled/web_compile.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/test +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_bad_ino.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_cli.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_compile_server.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_embedded_data.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_filechanger.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_ino/bad/bad.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_server_and_client_seperatly.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/tests/test_webcompile.py +0 -0
- {fastled-1.1.20 → fastled-1.1.21}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.21
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -161,6 +161,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
161
161
|
|
162
162
|
# Revisions
|
163
163
|
|
164
|
+
* 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
|
164
165
|
* 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
|
165
166
|
* 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
|
166
167
|
* 1.1.18 - Fixes for when the image has never been downloaded.
|
@@ -140,6 +140,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
140
140
|
|
141
141
|
# Revisions
|
142
142
|
|
143
|
+
* 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
|
143
144
|
* 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
|
144
145
|
* 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
|
145
146
|
* 1.1.18 - Fixes for when the image has never been downloaded.
|
@@ -0,0 +1,197 @@
|
|
1
|
+
"""
|
2
|
+
Uses the latest wasm compiler image to compile the FastLED sketch.
|
3
|
+
"""
|
4
|
+
|
5
|
+
import argparse
|
6
|
+
import os
|
7
|
+
import sys
|
8
|
+
import time
|
9
|
+
from pathlib import Path
|
10
|
+
|
11
|
+
from fastled import __version__
|
12
|
+
from fastled.client_server import run_client_server
|
13
|
+
from fastled.compile_server import CompileServer
|
14
|
+
from fastled.env import DEFAULT_URL
|
15
|
+
from fastled.sketch import (
|
16
|
+
find_sketch_directories,
|
17
|
+
looks_like_fastled_repo,
|
18
|
+
looks_like_sketch_directory,
|
19
|
+
)
|
20
|
+
|
21
|
+
|
22
|
+
def parse_args() -> argparse.Namespace:
|
23
|
+
"""Parse command-line arguments."""
|
24
|
+
parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
|
25
|
+
parser.add_argument(
|
26
|
+
"--version", action="version", version=f"%(prog)s {__version__}"
|
27
|
+
)
|
28
|
+
parser.add_argument(
|
29
|
+
"directory",
|
30
|
+
type=str,
|
31
|
+
nargs="?",
|
32
|
+
default=None,
|
33
|
+
help="Directory containing the FastLED sketch to compile",
|
34
|
+
)
|
35
|
+
parser.add_argument(
|
36
|
+
"--just-compile",
|
37
|
+
action="store_true",
|
38
|
+
help="Just compile, skip opening the browser and watching for changes.",
|
39
|
+
)
|
40
|
+
parser.add_argument(
|
41
|
+
"--web",
|
42
|
+
"-w",
|
43
|
+
type=str,
|
44
|
+
nargs="?",
|
45
|
+
# const does not seem to be working as expected
|
46
|
+
const=DEFAULT_URL, # Default value when --web is specified without value
|
47
|
+
help="Use web compiler. Optional URL can be provided (default: https://fastled.onrender.com)",
|
48
|
+
)
|
49
|
+
parser.add_argument(
|
50
|
+
"-i",
|
51
|
+
"--interactive",
|
52
|
+
action="store_true",
|
53
|
+
help="Run in interactive mode (Not available with --web)",
|
54
|
+
)
|
55
|
+
parser.add_argument(
|
56
|
+
"--profile",
|
57
|
+
action="store_true",
|
58
|
+
help="Enable profiling for web compilation",
|
59
|
+
)
|
60
|
+
parser.add_argument(
|
61
|
+
"--force-compile",
|
62
|
+
action="store_true",
|
63
|
+
help="Skips the test to see if the current directory is a valid FastLED sketch directory",
|
64
|
+
)
|
65
|
+
parser.add_argument(
|
66
|
+
"--no-auto-updates",
|
67
|
+
action="store_true",
|
68
|
+
help="Disable automatic updates of the wasm compiler image when using docker.",
|
69
|
+
)
|
70
|
+
parser.add_argument(
|
71
|
+
"--update",
|
72
|
+
action="store_true",
|
73
|
+
help="Update the wasm compiler (if necessary) before running",
|
74
|
+
)
|
75
|
+
parser.add_argument(
|
76
|
+
"--localhost",
|
77
|
+
"--local",
|
78
|
+
"-l",
|
79
|
+
action="store_true",
|
80
|
+
help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
|
81
|
+
)
|
82
|
+
parser.add_argument(
|
83
|
+
"--server",
|
84
|
+
"-s",
|
85
|
+
action="store_true",
|
86
|
+
help="Run the server in the current directory, volume mapping fastled if we are in the repo",
|
87
|
+
)
|
88
|
+
build_mode = parser.add_mutually_exclusive_group()
|
89
|
+
build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
|
90
|
+
build_mode.add_argument(
|
91
|
+
"--quick",
|
92
|
+
action="store_true",
|
93
|
+
default=True,
|
94
|
+
help="Build in quick mode (default)",
|
95
|
+
)
|
96
|
+
build_mode.add_argument(
|
97
|
+
"--release", action="store_true", help="Build in release mode"
|
98
|
+
)
|
99
|
+
|
100
|
+
cwd_is_fastled = looks_like_fastled_repo(Path(os.getcwd()))
|
101
|
+
|
102
|
+
args = parser.parse_args()
|
103
|
+
if args.update:
|
104
|
+
args.auto_update = True
|
105
|
+
elif args.no_auto_updates:
|
106
|
+
args.auto_update = False
|
107
|
+
else:
|
108
|
+
args.auto_update = None
|
109
|
+
|
110
|
+
if not cwd_is_fastled and not args.localhost and not args.web and not args.server:
|
111
|
+
print(f"Using web compiler at {DEFAULT_URL}")
|
112
|
+
args.web = DEFAULT_URL
|
113
|
+
if cwd_is_fastled and not args.web and not args.server:
|
114
|
+
print("Forcing --local mode because we are in the FastLED repo")
|
115
|
+
args.localhost = True
|
116
|
+
if args.localhost:
|
117
|
+
args.web = "localhost"
|
118
|
+
if args.interactive and not args.server:
|
119
|
+
print("--interactive forces --server mode")
|
120
|
+
args.server = True
|
121
|
+
if args.directory is None and not args.server:
|
122
|
+
# does current directory look like a sketch?
|
123
|
+
maybe_sketch_dir = Path(os.getcwd())
|
124
|
+
if looks_like_sketch_directory(maybe_sketch_dir):
|
125
|
+
args.directory = str(maybe_sketch_dir)
|
126
|
+
else:
|
127
|
+
sketch_directories = find_sketch_directories(maybe_sketch_dir)
|
128
|
+
if len(sketch_directories) == 1:
|
129
|
+
print(f"\nUsing sketch directory: {sketch_directories[0]}")
|
130
|
+
args.directory = str(sketch_directories[0])
|
131
|
+
elif len(sketch_directories) > 1:
|
132
|
+
print("\nMultiple Directories found, choose one:")
|
133
|
+
for i, sketch_dir in enumerate(sketch_directories):
|
134
|
+
print(f" [{i+1}]: {sketch_dir}")
|
135
|
+
which = input("\nPlease specify a sketch directory: ")
|
136
|
+
try:
|
137
|
+
index = int(which) - 1
|
138
|
+
args.directory = str(sketch_directories[index])
|
139
|
+
except (ValueError, IndexError):
|
140
|
+
print("Invalid selection.")
|
141
|
+
sys.exit(1)
|
142
|
+
else:
|
143
|
+
print(
|
144
|
+
"\nYou either need to specify a sketch directory or run in --server mode."
|
145
|
+
)
|
146
|
+
sys.exit(1)
|
147
|
+
elif args.directory is not None and os.path.isfile(args.directory):
|
148
|
+
dir_path = Path(args.directory).parent
|
149
|
+
if looks_like_sketch_directory(dir_path):
|
150
|
+
print(f"Using sketch directory: {dir_path}")
|
151
|
+
args.directory = str(dir_path)
|
152
|
+
|
153
|
+
return args
|
154
|
+
|
155
|
+
|
156
|
+
def run_server(args: argparse.Namespace) -> int:
|
157
|
+
interactive = args.interactive
|
158
|
+
auto_update = args.auto_update
|
159
|
+
compile_server = CompileServer(interactive=interactive, auto_updates=auto_update)
|
160
|
+
if not interactive:
|
161
|
+
print(f"Server started at {compile_server.url()}")
|
162
|
+
compile_server.wait_for_startup()
|
163
|
+
try:
|
164
|
+
while True:
|
165
|
+
if not compile_server.proceess_running():
|
166
|
+
print("Server process is not running. Exiting...")
|
167
|
+
return 1
|
168
|
+
time.sleep(1)
|
169
|
+
except KeyboardInterrupt:
|
170
|
+
print("\nExiting from server...")
|
171
|
+
return 1
|
172
|
+
finally:
|
173
|
+
compile_server.stop()
|
174
|
+
return 0
|
175
|
+
|
176
|
+
|
177
|
+
def main() -> int:
|
178
|
+
args = parse_args()
|
179
|
+
if args.server:
|
180
|
+
print("Running in server only mode.")
|
181
|
+
return run_server(args)
|
182
|
+
else:
|
183
|
+
print("Running in client/server mode.")
|
184
|
+
return run_client_server(args)
|
185
|
+
|
186
|
+
|
187
|
+
if __name__ == "__main__":
|
188
|
+
try:
|
189
|
+
os.chdir("../fastled")
|
190
|
+
sys.argv.append("--server")
|
191
|
+
sys.exit(main())
|
192
|
+
except KeyboardInterrupt:
|
193
|
+
print("\nExiting from main...")
|
194
|
+
sys.exit(1)
|
195
|
+
except Exception as e:
|
196
|
+
print(f"Error: {e}")
|
197
|
+
sys.exit(1)
|
@@ -1,30 +1,21 @@
|
|
1
|
-
"""
|
2
|
-
Uses the latest wasm compiler image to compile the FastLED sketch.
|
3
|
-
"""
|
4
|
-
|
5
1
|
import argparse
|
6
|
-
import os
|
7
|
-
import platform
|
8
2
|
import shutil
|
9
3
|
import subprocess
|
10
|
-
import sys
|
11
4
|
import tempfile
|
12
5
|
import time
|
13
|
-
from dataclasses import dataclass
|
14
6
|
from pathlib import Path
|
15
7
|
|
16
|
-
from fastled import __version__
|
17
8
|
from fastled.build_mode import BuildMode, get_build_mode
|
18
9
|
from fastled.compile_server import CompileServer
|
19
10
|
from fastled.docker_manager import DockerManager
|
11
|
+
from fastled.env import DEFAULT_URL
|
20
12
|
from fastled.filewatcher import FileWatcherProcess
|
21
13
|
from fastled.keyboard import SpaceBarWatcher
|
22
14
|
from fastled.open_browser import open_browser_thread
|
23
|
-
from fastled.sketch import
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
15
|
+
from fastled.sketch import looks_like_sketch_directory
|
16
|
+
|
17
|
+
# CompiledResult
|
18
|
+
from fastled.types import CompiledResult
|
28
19
|
from fastled.web_compile import (
|
29
20
|
SERVER_PORT,
|
30
21
|
ConnectionResult,
|
@@ -32,157 +23,8 @@ from fastled.web_compile import (
|
|
32
23
|
web_compile,
|
33
24
|
)
|
34
25
|
|
35
|
-
machine = platform.machine().lower()
|
36
|
-
IS_ARM: bool = "arm" in machine or "aarch64" in machine
|
37
|
-
PLATFORM_TAG: str = "-arm64" if IS_ARM else ""
|
38
|
-
CONTAINER_NAME = f"fastled-wasm-compiler{PLATFORM_TAG}"
|
39
|
-
DEFAULT_URL = "https://fastled.onrender.com"
|
40
|
-
|
41
|
-
|
42
|
-
@dataclass
|
43
|
-
class CompiledResult:
|
44
|
-
"""Dataclass to hold the result of the compilation."""
|
45
|
-
|
46
|
-
success: bool
|
47
|
-
fastled_js: str
|
48
|
-
hash_value: str | None
|
49
|
-
|
50
|
-
|
51
|
-
def parse_args() -> argparse.Namespace:
|
52
|
-
"""Parse command-line arguments."""
|
53
|
-
parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
|
54
|
-
parser.add_argument(
|
55
|
-
"--version", action="version", version=f"%(prog)s {__version__}"
|
56
|
-
)
|
57
|
-
parser.add_argument(
|
58
|
-
"directory",
|
59
|
-
type=str,
|
60
|
-
nargs="?",
|
61
|
-
default=None,
|
62
|
-
help="Directory containing the FastLED sketch to compile",
|
63
|
-
)
|
64
|
-
parser.add_argument(
|
65
|
-
"--just-compile",
|
66
|
-
action="store_true",
|
67
|
-
help="Just compile, skip opening the browser and watching for changes.",
|
68
|
-
)
|
69
|
-
parser.add_argument(
|
70
|
-
"--web",
|
71
|
-
"-w",
|
72
|
-
type=str,
|
73
|
-
nargs="?",
|
74
|
-
# const does not seem to be working as expected
|
75
|
-
const=DEFAULT_URL, # Default value when --web is specified without value
|
76
|
-
help="Use web compiler. Optional URL can be provided (default: https://fastled.onrender.com)",
|
77
|
-
)
|
78
|
-
parser.add_argument(
|
79
|
-
"-i",
|
80
|
-
"--interactive",
|
81
|
-
action="store_true",
|
82
|
-
help="Run in interactive mode (Not available with --web)",
|
83
|
-
)
|
84
|
-
parser.add_argument(
|
85
|
-
"--profile",
|
86
|
-
action="store_true",
|
87
|
-
help="Enable profiling for web compilation",
|
88
|
-
)
|
89
|
-
parser.add_argument(
|
90
|
-
"--force-compile",
|
91
|
-
action="store_true",
|
92
|
-
help="Skips the test to see if the current directory is a valid FastLED sketch directory",
|
93
|
-
)
|
94
|
-
parser.add_argument(
|
95
|
-
"--no-auto-updates",
|
96
|
-
action="store_true",
|
97
|
-
help="Disable automatic updates of the wasm compiler image when using docker.",
|
98
|
-
)
|
99
|
-
parser.add_argument(
|
100
|
-
"--update",
|
101
|
-
action="store_true",
|
102
|
-
help="Update the wasm compiler (if necessary) before running",
|
103
|
-
)
|
104
|
-
parser.add_argument(
|
105
|
-
"--localhost",
|
106
|
-
"--local",
|
107
|
-
"-l",
|
108
|
-
action="store_true",
|
109
|
-
help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
|
110
|
-
)
|
111
|
-
parser.add_argument(
|
112
|
-
"--server",
|
113
|
-
"-s",
|
114
|
-
action="store_true",
|
115
|
-
help="Run the server in the current directory, volume mapping fastled if we are in the repo",
|
116
|
-
)
|
117
|
-
build_mode = parser.add_mutually_exclusive_group()
|
118
|
-
build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
|
119
|
-
build_mode.add_argument(
|
120
|
-
"--quick",
|
121
|
-
action="store_true",
|
122
|
-
default=True,
|
123
|
-
help="Build in quick mode (default)",
|
124
|
-
)
|
125
|
-
build_mode.add_argument(
|
126
|
-
"--release", action="store_true", help="Build in release mode"
|
127
|
-
)
|
128
|
-
|
129
|
-
cwd_is_fastled = looks_like_fastled_repo(Path(os.getcwd()))
|
130
|
-
|
131
|
-
args = parser.parse_args()
|
132
|
-
if args.update:
|
133
|
-
args.auto_update = True
|
134
|
-
elif args.no_auto_updates:
|
135
|
-
args.auto_update = False
|
136
|
-
else:
|
137
|
-
args.auto_update = None
|
138
26
|
|
139
|
-
|
140
|
-
print(f"Using web compiler at {DEFAULT_URL}")
|
141
|
-
args.web = DEFAULT_URL
|
142
|
-
if cwd_is_fastled and not args.web and not args.server:
|
143
|
-
print("Forcing --local mode because we are in the FastLED repo")
|
144
|
-
args.localhost = True
|
145
|
-
if args.localhost:
|
146
|
-
args.web = "localhost"
|
147
|
-
if args.interactive and not args.server:
|
148
|
-
print("--interactive forces --server mode")
|
149
|
-
args.server = True
|
150
|
-
if args.directory is None and not args.server:
|
151
|
-
# does current directory look like a sketch?
|
152
|
-
maybe_sketch_dir = Path(os.getcwd())
|
153
|
-
if looks_like_sketch_directory(maybe_sketch_dir):
|
154
|
-
args.directory = str(maybe_sketch_dir)
|
155
|
-
else:
|
156
|
-
sketch_directories = find_sketch_directories(maybe_sketch_dir)
|
157
|
-
if len(sketch_directories) == 1:
|
158
|
-
print(f"\nUsing sketch directory: {sketch_directories[0]}")
|
159
|
-
args.directory = str(sketch_directories[0])
|
160
|
-
elif len(sketch_directories) > 1:
|
161
|
-
print("\nMultiple Directories found, choose one:")
|
162
|
-
for i, sketch_dir in enumerate(sketch_directories):
|
163
|
-
print(f" [{i+1}]: {sketch_dir}")
|
164
|
-
which = input("\nPlease specify a sketch directory: ")
|
165
|
-
try:
|
166
|
-
index = int(which) - 1
|
167
|
-
args.directory = str(sketch_directories[index])
|
168
|
-
except (ValueError, IndexError):
|
169
|
-
print("Invalid selection.")
|
170
|
-
sys.exit(1)
|
171
|
-
else:
|
172
|
-
print(
|
173
|
-
"\nYou either need to specify a sketch directory or run in --server mode."
|
174
|
-
)
|
175
|
-
sys.exit(1)
|
176
|
-
elif args.directory is not None and os.path.isfile(args.directory):
|
177
|
-
dir_path = Path(args.directory).parent
|
178
|
-
if looks_like_sketch_directory(dir_path):
|
179
|
-
print(f"Using sketch directory: {dir_path}")
|
180
|
-
args.directory = str(dir_path)
|
181
|
-
|
182
|
-
return args
|
183
|
-
|
184
|
-
|
185
|
-
def run_web_compiler(
|
27
|
+
def _run_web_compiler(
|
186
28
|
directory: Path,
|
187
29
|
host: str,
|
188
30
|
build_mode: BuildMode,
|
@@ -281,7 +123,7 @@ def _try_start_server_or_get_url(args: argparse.Namespace) -> str | CompileServe
|
|
281
123
|
return DEFAULT_URL
|
282
124
|
|
283
125
|
|
284
|
-
def
|
126
|
+
def run_client_server(args: argparse.Namespace) -> int:
|
285
127
|
compile_server: CompileServer | None = None
|
286
128
|
open_web_browser = not args.just_compile and not args.interactive
|
287
129
|
profile = args.profile
|
@@ -325,7 +167,7 @@ def run_client(args: argparse.Namespace) -> int:
|
|
325
167
|
profile: bool = profile,
|
326
168
|
last_hash_value: str | None = None,
|
327
169
|
) -> CompiledResult:
|
328
|
-
return
|
170
|
+
return _run_web_compiler(
|
329
171
|
args.directory,
|
330
172
|
host=url,
|
331
173
|
build_mode=build_mode,
|
@@ -361,7 +203,6 @@ def run_client(args: argparse.Namespace) -> int:
|
|
361
203
|
compile_server.stop()
|
362
204
|
return 1
|
363
205
|
|
364
|
-
print("\nWatching for changes. Press Ctrl+C to stop...")
|
365
206
|
sketch_filewatcher = FileWatcherProcess(
|
366
207
|
args.directory, excluded_patterns=["fastled_js"]
|
367
208
|
)
|
@@ -375,7 +216,7 @@ def run_client(args: argparse.Namespace) -> int:
|
|
375
216
|
|
376
217
|
def trigger_rebuild_if_sketch_changed(
|
377
218
|
last_compiled_result: CompiledResult,
|
378
|
-
) -> CompiledResult:
|
219
|
+
) -> tuple[bool, CompiledResult]:
|
379
220
|
changed_files = sketch_filewatcher.get_all_changes()
|
380
221
|
if changed_files:
|
381
222
|
print(f"\nChanges detected in {changed_files}")
|
@@ -385,14 +226,34 @@ def run_client(args: argparse.Namespace) -> int:
|
|
385
226
|
print("\nRecompilation failed.")
|
386
227
|
else:
|
387
228
|
print("\nRecompilation successful.")
|
388
|
-
return out
|
389
|
-
return last_compiled_result
|
229
|
+
return True, out
|
230
|
+
return False, last_compiled_result
|
231
|
+
|
232
|
+
def print_status() -> None:
|
233
|
+
print("Will compile on sketch changes or if you hit the space bar.")
|
234
|
+
|
235
|
+
print_status()
|
236
|
+
print("Press Ctrl+C to stop...")
|
390
237
|
|
391
238
|
try:
|
392
239
|
while True:
|
393
|
-
|
240
|
+
if SpaceBarWatcher.watch_space_bar_pressed(timeout=1.0):
|
241
|
+
print("Compiling...")
|
242
|
+
last_compiled_result = compile_function(last_hash_value=None)
|
243
|
+
if not last_compiled_result.success:
|
244
|
+
print("\nRecompilation failed.")
|
245
|
+
else:
|
246
|
+
print("\nRecompilation successful.")
|
247
|
+
# drain the space bar queue
|
248
|
+
SpaceBarWatcher.watch_space_bar_pressed()
|
249
|
+
print_status()
|
250
|
+
continue
|
251
|
+
changed, last_compiled_result = trigger_rebuild_if_sketch_changed(
|
394
252
|
last_compiled_result
|
395
253
|
)
|
254
|
+
if changed:
|
255
|
+
print_status()
|
256
|
+
continue
|
396
257
|
if compile_server and not compile_server.proceess_running():
|
397
258
|
print("Server process is not running. Exiting...")
|
398
259
|
return 1
|
@@ -403,25 +264,26 @@ def run_client(args: argparse.Namespace) -> int:
|
|
403
264
|
if changed_files:
|
404
265
|
print(f"\nChanges detected in FastLED source code: {changed_files}")
|
405
266
|
print("Press space bar to trigger compile.")
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
267
|
+
while True:
|
268
|
+
space_bar_pressed = SpaceBarWatcher.watch_space_bar_pressed(
|
269
|
+
timeout=1.0
|
270
|
+
)
|
271
|
+
file_had_changes = (
|
272
|
+
len(source_code_watcher.get_all_changes()) > 0
|
273
|
+
)
|
274
|
+
if space_bar_pressed or file_had_changes:
|
275
|
+
if space_bar_pressed:
|
411
276
|
print("Space bar pressed, triggering recompile...")
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
time.sleep(0.1)
|
423
|
-
finally:
|
424
|
-
space_key_watcher.stop()
|
277
|
+
elif file_had_changes:
|
278
|
+
print("Changes detected, triggering recompile...")
|
279
|
+
last_compiled_result = compile_function(
|
280
|
+
last_hash_value=None
|
281
|
+
)
|
282
|
+
print("Finished recompile.")
|
283
|
+
# Drain the space bar queue
|
284
|
+
SpaceBarWatcher.watch_space_bar_pressed()
|
285
|
+
print_status()
|
286
|
+
continue
|
425
287
|
|
426
288
|
except KeyboardInterrupt:
|
427
289
|
print("\nStopping watch mode...")
|
@@ -435,47 +297,3 @@ def run_client(args: argparse.Namespace) -> int:
|
|
435
297
|
compile_server.stop()
|
436
298
|
if browser_proc:
|
437
299
|
browser_proc.kill()
|
438
|
-
|
439
|
-
|
440
|
-
def run_server(args: argparse.Namespace) -> int:
|
441
|
-
interactive = args.interactive
|
442
|
-
auto_update = args.auto_update
|
443
|
-
compile_server = CompileServer(interactive=interactive, auto_updates=auto_update)
|
444
|
-
if not interactive:
|
445
|
-
print(f"Server started at {compile_server.url()}")
|
446
|
-
compile_server.wait_for_startup()
|
447
|
-
try:
|
448
|
-
while True:
|
449
|
-
if not compile_server.proceess_running():
|
450
|
-
print("Server process is not running. Exiting...")
|
451
|
-
return 1
|
452
|
-
time.sleep(1)
|
453
|
-
except KeyboardInterrupt:
|
454
|
-
print("\nExiting from server...")
|
455
|
-
return 1
|
456
|
-
finally:
|
457
|
-
compile_server.stop()
|
458
|
-
return 0
|
459
|
-
|
460
|
-
|
461
|
-
def main() -> int:
|
462
|
-
args = parse_args()
|
463
|
-
if args.server:
|
464
|
-
print("Running in server only mode.")
|
465
|
-
return run_server(args)
|
466
|
-
else:
|
467
|
-
print("Running in client/server mode.")
|
468
|
-
return run_client(args)
|
469
|
-
|
470
|
-
|
471
|
-
if __name__ == "__main__":
|
472
|
-
try:
|
473
|
-
os.chdir("../fastled")
|
474
|
-
sys.argv.append("--server")
|
475
|
-
sys.exit(main())
|
476
|
-
except KeyboardInterrupt:
|
477
|
-
print("\nExiting from main...")
|
478
|
-
sys.exit(1)
|
479
|
-
except Exception as e:
|
480
|
-
print(f"Error: {e}")
|
481
|
-
sys.exit(1)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import os
|
2
|
+
import platform
|
3
|
+
|
4
|
+
MACHINE = platform.machine().lower()
|
5
|
+
IS_ARM: bool = "arm" in MACHINE or "aarch64" in MACHINE
|
6
|
+
PLATFORM_TAG: str = "-arm64" if IS_ARM else ""
|
7
|
+
CONTAINER_NAME = f"fastled-wasm-compiler{PLATFORM_TAG}"
|
8
|
+
DEFAULT_URL = str(os.environ.get("FASTLED_URL", "https://fastled.onrender.com"))
|
@@ -5,8 +5,25 @@ import time
|
|
5
5
|
from multiprocessing import Process, Queue
|
6
6
|
from queue import Empty
|
7
7
|
|
8
|
+
_WHITE_SPACE = [" ", "\r", "\n"]
|
8
9
|
|
10
|
+
|
11
|
+
# Original space bar, but now also enter key.
|
9
12
|
class SpaceBarWatcher:
|
13
|
+
|
14
|
+
@classmethod
|
15
|
+
def watch_space_bar_pressed(cls, timeout: float = 0) -> bool:
|
16
|
+
watcher = cls()
|
17
|
+
try:
|
18
|
+
start_time = time.time()
|
19
|
+
while True:
|
20
|
+
if watcher.space_bar_pressed():
|
21
|
+
return True
|
22
|
+
if time.time() - start_time > timeout:
|
23
|
+
return False
|
24
|
+
finally:
|
25
|
+
watcher.stop()
|
26
|
+
|
10
27
|
def __init__(self) -> None:
|
11
28
|
self.queue: Queue = Queue()
|
12
29
|
self.queue_cancel: Queue = Queue()
|
@@ -31,7 +48,7 @@ class SpaceBarWatcher:
|
|
31
48
|
# Check if there's input ready
|
32
49
|
if msvcrt.kbhit(): # type: ignore
|
33
50
|
char = msvcrt.getch().decode() # type: ignore
|
34
|
-
if char
|
51
|
+
if char in _WHITE_SPACE:
|
35
52
|
self.queue.put(ord(" "))
|
36
53
|
|
37
54
|
else: # Unix-like systems
|
@@ -52,7 +69,7 @@ class SpaceBarWatcher:
|
|
52
69
|
# Check if there's input ready
|
53
70
|
if select.select([sys.stdin], [], [], 0.1)[0]:
|
54
71
|
char = sys.stdin.read(1)
|
55
|
-
if char
|
72
|
+
if char in _WHITE_SPACE:
|
56
73
|
self.queue.put(ord(" "))
|
57
74
|
finally:
|
58
75
|
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) # type: ignore
|
@@ -60,9 +77,12 @@ class SpaceBarWatcher:
|
|
60
77
|
def space_bar_pressed(self) -> bool:
|
61
78
|
found = False
|
62
79
|
while not self.queue.empty():
|
63
|
-
|
64
|
-
|
65
|
-
|
80
|
+
try:
|
81
|
+
key = self.queue.get(block=False, timeout=0.1)
|
82
|
+
if key == ord(" "):
|
83
|
+
found = True
|
84
|
+
except Empty:
|
85
|
+
break
|
66
86
|
return found
|
67
87
|
|
68
88
|
def stop(self) -> None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.21
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -161,6 +161,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
161
161
|
|
162
162
|
# Revisions
|
163
163
|
|
164
|
+
* 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
|
164
165
|
* 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
|
165
166
|
* 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
|
166
167
|
* 1.1.18 - Fixes for when the image has never been downloaded.
|
@@ -65,13 +65,16 @@ src/fastled/__init__.py
|
|
65
65
|
src/fastled/app.py
|
66
66
|
src/fastled/build_mode.py
|
67
67
|
src/fastled/cli.py
|
68
|
+
src/fastled/client_server.py
|
68
69
|
src/fastled/compile_server.py
|
69
70
|
src/fastled/docker_manager.py
|
71
|
+
src/fastled/env.py
|
70
72
|
src/fastled/filewatcher.py
|
71
73
|
src/fastled/keyboard.py
|
72
74
|
src/fastled/open_browser.py
|
73
75
|
src/fastled/paths.py
|
74
76
|
src/fastled/sketch.py
|
77
|
+
src/fastled/types.py
|
75
78
|
src/fastled/util.py
|
76
79
|
src/fastled/web_compile.py
|
77
80
|
src/fastled.egg-info/PKG-INFO
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fastled-1.1.20 → fastled-1.1.21}/examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|