-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show current firmware version in the /update web page.
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 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,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
|
||
def get_git_version(): | ||
"""Retrieve the current version from `git describe --tags`.""" | ||
try: | ||
# Run the git command to get the version string | ||
version = subprocess.check_output( | ||
["git", "describe", "--tags", "--dirty", "--always"], | ||
stderr=subprocess.STDOUT, | ||
text=True | ||
).strip() | ||
return version | ||
except subprocess.CalledProcessError: | ||
# Return a default value if the command fails | ||
return "unknown" | ||
|
||
def generate_version_header(output_file): | ||
"""Generate the version.h file with the Git version.""" | ||
git_version = get_git_version() | ||
with open(output_file, "w") as header: | ||
header.write('// automatically generated using create_fwversion.py\n') | ||
header.write(f'const char* FW_VERSION = "{git_version}";\n\n') | ||
print(f"Generated C file with with GIT_VERSION={git_version}: {output_file}") | ||
|
||
# Create the version file | ||
output_file = "fwversion.h" | ||
generate_version_header(output_file) |
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
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 |
---|---|---|
|
@@ -19,7 +19,9 @@ framework = arduino | |
monitor_speed = 115200 | ||
upload_speed = 1000000 | ||
board_build.filesystem = littlefs | ||
extra_scripts = pre:create_fsimage.py | ||
extra_scripts = | ||
pre:create_fwversion.py | ||
pre:create_fsimage.py | ||
lib_deps = fastled/[email protected] | ||
alanswx/ESPAsyncWiFiManager@^0.31.0 | ||
bblanchon/ArduinoJson@^6.21.5 | ||
|