Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
bbe55592ec | |||
fe6c68d97b |
@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v0.3.2]
|
||||
|
||||
- Added handling for duplicate event names when writing the event translation
|
||||
file.
|
||||
|
||||
# [v0.3.1]
|
||||
|
||||
- Sorted returnvalue export by raw returnvalue.
|
||||
|
@ -1,5 +1,5 @@
|
||||
__version__ = "0.3.1"
|
||||
__version__ = "0.3.2"
|
||||
|
||||
VERSION_MAJOR = 0
|
||||
VERSION_MINOR = 3
|
||||
VERSION_REVISION = 1
|
||||
VERSION_REVISION = 2
|
||||
|
@ -274,10 +274,16 @@ def write_translation_source_file(
|
||||
event_id = entry[0]
|
||||
event_value = entry[1]
|
||||
name = event_value.name
|
||||
if name not in lut:
|
||||
definitions += f"const char *{name}_STRING " f'= "{name}";\n'
|
||||
function += f" case ({event_id}):\n " f"return {name}_STRING;\n"
|
||||
lut.update({name: event_value})
|
||||
if name in lut:
|
||||
_LOGGER.warning(
|
||||
"Duplicate name detected when generating event translation source file"
|
||||
)
|
||||
_LOGGER.warning(f"Name: {name}, Event Entry: {event_value}")
|
||||
name = f"{name}_{event_id}"
|
||||
_LOGGER.info(f"Created unique name {name}")
|
||||
definitions += f"const char *{name}_STRING " f'= "{name}";\n'
|
||||
function += f" case ({event_id}):\n " f"return {name}_STRING;\n"
|
||||
lut.update({name: event_value})
|
||||
function += ' default:\n return "UNKNOWN_EVENT";\n'
|
||||
out.write(
|
||||
f"/**\n * @brief Auto-generated event translation file. "
|
||||
|
Loading…
Reference in New Issue
Block a user