Commit 0cc170a1 authored by Amy Blank's avatar Amy Blank 🌈
Browse files

Merge branch 'feature/default-value-bug' into 'devel'

default value bug

See merge request !2
parents 53c6199a 8dbe875e
Pipeline #12263 passed with stage
in 57 seconds
......@@ -108,3 +108,7 @@ ENV/
*.csv
*.eds
bin/
# vim swap files
*.swp
*.swo
......@@ -5,6 +5,7 @@ image: "python:3.4"
build:
script:
- pip3 install python-dateutil==2.7.3 && pip3 install MarkupSafe
- ./setup.py install
#test:
......
......@@ -11,7 +11,7 @@ put content here
- [ ] @tn
- [ ] @amyblank
- [ ] @bz
- [ ] @wd
- [ ] @cm
### Resources
......
......@@ -14,7 +14,7 @@
- [ ] @tn
- [ ] @amyblank
- [ ] @bz
- [ ] @wd
- [ ] @cm
### Resources and Documentation
> Links for resources and documentation go here.
## [dev-1.0.5]
### Changed
- Made "default" argument optional for entries with subindex 1
## [dev-1.0.4]
### Changed
......
......@@ -28,6 +28,8 @@ def generate_eds_section(objdict):
eds_config = configparser.ConfigParser()
eds_config.optionxform = str
for entry in objdict['indexes']:
# Note that an index with multiple subindices *must* have its
# first subindex be 0 for this code to work properly.
if entry['subindex'] == 0:
section_name = "{:04x}".format(entry['index'])
eds_config[section_name] = OrderedDict([
......@@ -47,8 +49,7 @@ def generate_eds_section(objdict):
base_entry = "{:04x}".format(entry['index'])
eds_config[base_entry]["ObjectType"] = "0x08"
eds_config[base_entry].pop("PDOMapping", None)
default_value = eds_config[
base_entry].pop("DefaultValue", None)
section_name = "{:04x}sub0".format(entry['index'])
eds_config[section_name] = OrderedDict([
......@@ -56,8 +57,11 @@ def generate_eds_section(objdict):
("DataType", eds_config[base_entry]['DataType']),
("ParameterName", "NumberOfEntries"),
("AccessType", eds_config[base_entry]['AccessType'].lower()),
("PDOMapping", 0),
("DefaultValue", default_value)])
("PDOMapping", 0)])
if "default" in entry:
default_value = eds_config[base_entry].pop("DefaultValue", None)
eds_config[section_name]["DefaultValue"] = default_value
# generate the subN index
section_name = "{0:04x}sub{1:X}".format(
......
#!/usr/bin/env python3
__version__ = "1.0.4"
__version__ = "1.0.5"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment