forked from wled-dev/WLED
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge wled/master into sr-wled/master
Initially had merge issues, working on a fix
- Loading branch information
Showing
73 changed files
with
3,964 additions
and
3,549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
layout python-venv python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ node_modules | |
.cproject | ||
.project | ||
.idea | ||
.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Import('env') | ||
import os | ||
import shutil | ||
import gzip | ||
|
||
OUTPUT_DIR = "build_output{}".format(os.path.sep) | ||
|
||
def _get_cpp_define_value(env, define): | ||
define_list = [item[-1] for item in env["CPPDEFINES"] if item[0] == define] | ||
|
||
if define_list: | ||
return define_list[0] | ||
|
||
return None | ||
|
||
def _create_dirs(dirs=["firmware", "map"]): | ||
# check if output directories exist and create if necessary | ||
if not os.path.isdir(OUTPUT_DIR): | ||
os.mkdir(OUTPUT_DIR) | ||
|
||
for d in dirs: | ||
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)): | ||
os.mkdir("{}{}".format(OUTPUT_DIR, d)) | ||
|
||
def bin_rename_copy(source, target, env): | ||
_create_dirs() | ||
variant = env["PIOENV"] | ||
|
||
# create string with location and file names based on variant | ||
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) | ||
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) | ||
|
||
release_name = _get_cpp_define_value(env, "WLED_RELEASE_NAME") | ||
|
||
if release_name and os.getenv("WLED_RELEASE"): | ||
_create_dirs(["release"]) | ||
version = _get_cpp_define_value(env, "WLED_VERSION") | ||
release_file = "{}release{}soundReactive_WLED_{}_{}.bin".format(OUTPUT_DIR, os.path.sep, version, release_name) | ||
shutil.copy(str(target[0]), release_file) | ||
|
||
# check if new target files exist and remove if necessary | ||
for f in [map_file, bin_file]: | ||
if os.path.isfile(f): | ||
os.remove(f) | ||
|
||
# copy firmware.bin to firmware/<variant>.bin | ||
shutil.copy(str(target[0]), bin_file) | ||
|
||
# copy firmware.map to map/<variant>.map | ||
if os.path.isfile("firmware.map"): | ||
shutil.move("firmware.map", map_file) | ||
|
||
def bin_gzip(source, target, env): | ||
_create_dirs() | ||
variant = env["PIOENV"] | ||
|
||
# create string with location and file names based on variant | ||
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant) | ||
gzip_file = "{}firmware{}{}.bin.gz".format(OUTPUT_DIR, os.path.sep, variant) | ||
|
||
# check if new target files exist and remove if necessary | ||
if os.path.isfile(gzip_file): os.remove(gzip_file) | ||
|
||
# write gzip firmware file | ||
with open(bin_file,"rb") as fp: | ||
with gzip.open(gzip_file, "wb", compresslevel = 9) as f: | ||
shutil.copyfileobj(fp, f) | ||
|
||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy, bin_gzip]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Import('env') | ||
import json | ||
|
||
PACKAGE_FILE = "package.json" | ||
|
||
with open(PACKAGE_FILE, "r") as package: | ||
version = json.load(package)["version"] | ||
env.Append(BUILD_FLAGS=[f"-DWLED_VERSION={version}"]) |
Oops, something went wrong.