Include pcb version information
This commit is contained in:
10
extra_pre.py
10
extra_pre.py
@@ -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)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user