Include pcb version information

This commit is contained in:
2026-03-02 08:37:44 +01:00
parent 294f1731c9
commit 56b9d04cf8
6 changed files with 28 additions and 9 deletions

View File

@@ -170,12 +170,22 @@ def prebuild(env):
print("Production version style")
version = env.GetProjectOption('custom_version')
# get hardware compiler option
pcbvers = "unknown"
for x in env["BUILD_FLAGS"]:
if not x.startswith('-D'):
continue
opt = x[2:].strip()
if opt.startswith("HARDWARE_"):
pcbvers = x.split('_')[1].lower()
now = datetime.utcnow()
env.Append(
CPPDEFINES=[
('FWVERSION', version),
("FWBUILDDATE", f"{now:%Y-%m-%d}"),
("FWBUILDTIME", f"{now:%H:%M:%S}"),
("HWVERSION", pcbvers)
]
)