mapcan 0.25.0__tar.gz → 0.26.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. {mapcan-0.25.0 → mapcan-0.26.0}/PKG-INFO +1 -1
  2. {mapcan-0.25.0 → mapcan-0.26.0}/docs/format-changelog.md +18 -0
  3. {mapcan-0.25.0 → mapcan-0.26.0}/docs/format.md +135 -9
  4. mapcan-0.26.0/examples/structures.yaml +65 -0
  5. {mapcan-0.25.0 → mapcan-0.26.0}/pyproject.toml +1 -1
  6. mapcan-0.25.0/schema/mapcan.schema.json → mapcan-0.26.0/schema/mapcan-part.schema.json +450 -374
  7. mapcan-0.25.0/schema/mapcan-part.schema.json → mapcan-0.26.0/schema/mapcan.schema.json +1022 -147
  8. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/__init__.py +1 -1
  9. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/eds.py +55 -10
  10. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fmt.py +8 -2
  11. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/loader.py +4 -0
  12. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/locale/ru.py +117 -6
  13. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/model.py +110 -1
  14. mapcan-0.26.0/src/mapcan/od.py +79 -0
  15. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/resolve.py +59 -34
  16. mapcan-0.26.0/src/mapcan/structures.py +69 -0
  17. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/upgrade.py +8 -1
  18. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/validate.py +128 -7
  19. mapcan-0.26.0/src/mapcan/web/static/assets/index-DFi-dbfG.css +1 -0
  20. mapcan-0.26.0/src/mapcan/web/static/assets/index-DV8miVDx.js +37 -0
  21. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/static/index.html +2 -2
  22. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/yamlops.py +4 -1
  23. mapcan-0.26.0/tests/data/canopen-od.yaml +51 -0
  24. {mapcan-0.25.0 → mapcan-0.26.0}/tests/golden/reference.md +10 -12
  25. {mapcan-0.25.0 → mapcan-0.26.0}/tests/golden/reference_bus1.h +14 -26
  26. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_model.py +8 -6
  27. mapcan-0.26.0/tests/test_od.py +123 -0
  28. mapcan-0.26.0/tests/test_structures.py +64 -0
  29. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_yamlops.py +4 -3
  30. mapcan-0.25.0/src/mapcan/web/static/assets/index-Dj2CYSmo.js +0 -39
  31. mapcan-0.25.0/src/mapcan/web/static/assets/index-Yq5HaFOv.css +0 -1
  32. {mapcan-0.25.0 → mapcan-0.26.0}/.gitignore +0 -0
  33. {mapcan-0.25.0 → mapcan-0.26.0}/LICENSE +0 -0
  34. {mapcan-0.25.0 → mapcan-0.26.0}/NOTICE +0 -0
  35. {mapcan-0.25.0 → mapcan-0.26.0}/README.md +0 -0
  36. {mapcan-0.25.0 → mapcan-0.26.0}/THIRD_PARTY_NOTICES.md +0 -0
  37. {mapcan-0.25.0 → mapcan-0.26.0}/docs/ci-example.md +0 -0
  38. {mapcan-0.25.0 → mapcan-0.26.0}/docs/cli.md +0 -0
  39. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/demo-dark.gif +0 -0
  40. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/demo-light.gif +0 -0
  41. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/document-pages-dark.png +0 -0
  42. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/document-pages-light.png +0 -0
  43. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-demo-dark.gif +0 -0
  44. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-demo-light.gif +0 -0
  45. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-hover-dark.png +0 -0
  46. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-hover-light.png +0 -0
  47. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-map-dark.png +0 -0
  48. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-map-light.png +0 -0
  49. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-problems-dark.png +0 -0
  50. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-problems-light.png +0 -0
  51. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-quickfix-dark.gif +0 -0
  52. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/vscode-quickfix-light.gif +0 -0
  53. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/web-frame-dark.png +0 -0
  54. {mapcan-0.25.0 → mapcan-0.26.0}/docs/images/web-frame-light.png +0 -0
  55. {mapcan-0.25.0 → mapcan-0.26.0}/docs/logo-dark.svg +0 -0
  56. {mapcan-0.25.0 → mapcan-0.26.0}/docs/logo-light.svg +0 -0
  57. {mapcan-0.25.0 → mapcan-0.26.0}/docs/templates.md +0 -0
  58. {mapcan-0.25.0 → mapcan-0.26.0}/docs/web.md +0 -0
  59. {mapcan-0.25.0 → mapcan-0.26.0}/docs/zephyr.md +0 -0
  60. {mapcan-0.25.0 → mapcan-0.26.0}/examples/canopen-node.yaml +0 -0
  61. {mapcan-0.25.0 → mapcan-0.26.0}/examples/j1939.yaml +0 -0
  62. {mapcan-0.25.0 → mapcan-0.26.0}/examples/minimal.yaml +0 -0
  63. {mapcan-0.25.0 → mapcan-0.26.0}/examples/tractor/powertrain.yaml +0 -0
  64. {mapcan-0.25.0 → mapcan-0.26.0}/examples/tractor/tractor.yaml +0 -0
  65. {mapcan-0.25.0 → mapcan-0.26.0}/examples/vehicle-can.yaml +0 -0
  66. {mapcan-0.25.0 → mapcan-0.26.0}/examples/zephyr/CMakeLists.txt +0 -0
  67. {mapcan-0.25.0 → mapcan-0.26.0}/examples/zephyr/prj.conf +0 -0
  68. {mapcan-0.25.0 → mapcan-0.26.0}/examples/zephyr/src/main.c +0 -0
  69. {mapcan-0.25.0 → mapcan-0.26.0}/schema/mapcan-part-v1.schema.json +0 -0
  70. {mapcan-0.25.0 → mapcan-0.26.0}/schema/mapcan-v1.schema.json +0 -0
  71. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/bits.py +0 -0
  72. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/canopen.py +0 -0
  73. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/cli.py +0 -0
  74. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/codegen/__init__.py +0 -0
  75. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/codegen/c.py +0 -0
  76. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/codegen/common.py +0 -0
  77. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/codegen/py.py +0 -0
  78. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/codegen/zephyr.py +0 -0
  79. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/diagnostics.py +0 -0
  80. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/diff.py +0 -0
  81. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/docmodel.py +0 -0
  82. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/__init__.py +0 -0
  83. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/dbc.py +0 -0
  84. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/pdf.py +0 -0
  85. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/text.py +0 -0
  86. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/export/xlsx.py +0 -0
  87. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/extras.py +0 -0
  88. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/OFL-PTSerif.txt +0 -0
  89. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/OFL.txt +0 -0
  90. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Sans-Web-Bold.ttf +0 -0
  91. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Sans-Web-BoldItalic.ttf +0 -0
  92. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Sans-Web-Italic.ttf +0 -0
  93. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Sans-Web-Regular.ttf +0 -0
  94. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Serif-Web-Bold.ttf +0 -0
  95. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Serif-Web-BoldItalic.ttf +0 -0
  96. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Serif-Web-Italic.ttf +0 -0
  97. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/fonts/PT_Serif-Web-Regular.ttf +0 -0
  98. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/i18n.py +0 -0
  99. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/importers/__init__.py +0 -0
  100. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/importers/dbc.py +0 -0
  101. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/importers/eds.py +0 -0
  102. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/launcher.py +0 -0
  103. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/layout.py +0 -0
  104. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/locale/__init__.py +0 -0
  105. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/lsp/__init__.py +0 -0
  106. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/lsp/analysis.py +0 -0
  107. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/lsp/edits.py +0 -0
  108. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/lsp/exports.py +0 -0
  109. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/lsp/server.py +0 -0
  110. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/protocols.py +0 -0
  111. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/schema.py +0 -0
  112. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/document.html.j2 +0 -0
  113. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/document.md.j2 +0 -0
  114. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/pdf/gost-19.typ +0 -0
  115. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/pdf/gost-2.105.typ +0 -0
  116. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/pdf/gost-7.32.typ +0 -0
  117. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/pdf/lib.typ +0 -0
  118. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/pdf/mapcan.typ +0 -0
  119. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/templates/xlsx_style.yaml +0 -0
  120. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/units.py +0 -0
  121. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/updates.py +0 -0
  122. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/userconfig.py +0 -0
  123. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/__init__.py +0 -0
  124. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/app.py +0 -0
  125. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/devicefile.py +0 -0
  126. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/examples.py +0 -0
  127. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/newmap.py +0 -0
  128. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/session.py +0 -0
  129. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/static/OFL-Sora.txt +0 -0
  130. {mapcan-0.25.0 → mapcan-0.26.0}/src/mapcan/web/static/favicon.svg +0 -0
  131. {mapcan-0.25.0 → mapcan-0.26.0}/tests/__init__.py +0 -0
  132. {mapcan-0.25.0 → mapcan-0.26.0}/tests/conftest.py +0 -0
  133. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/bit_layouts.json +0 -0
  134. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/invalid_map.yaml +0 -0
  135. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/legacy.yaml +0 -0
  136. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/logo.png +0 -0
  137. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/logo.svg +0 -0
  138. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/reference.yaml +0 -0
  139. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/v1/canopen-node.yaml +0 -0
  140. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/v1/j1939.yaml +0 -0
  141. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/v1/reference.yaml +0 -0
  142. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/v1/vehicle-can.yaml +0 -0
  143. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/vendor-io.eds +0 -0
  144. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/zephyr_stub/zephyr/drivers/can.h +0 -0
  145. {mapcan-0.25.0 → mapcan-0.26.0}/tests/data/zephyr_stub/zephyr/kernel.h +0 -0
  146. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_auth.py +0 -0
  147. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_cli.py +0 -0
  148. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_codegen.py +0 -0
  149. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_device_file.py +0 -0
  150. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_diff.py +0 -0
  151. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_direction.py +0 -0
  152. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_eds.py +0 -0
  153. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_eds_import.py +0 -0
  154. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_exchange.py +0 -0
  155. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_export.py +0 -0
  156. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_extras.py +0 -0
  157. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_fmt.py +0 -0
  158. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_format_v1.py +0 -0
  159. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_i18n.py +0 -0
  160. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_import.py +0 -0
  161. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_include.py +0 -0
  162. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_j1939.py +0 -0
  163. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_launcher.py +0 -0
  164. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_loader_fast.py +0 -0
  165. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_lsp.py +0 -0
  166. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_lsp_edits.py +0 -0
  167. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_lsp_server.py +0 -0
  168. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_new_signal.py +0 -0
  169. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_source.py +0 -0
  170. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_templates.py +0 -0
  171. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_titles.py +0 -0
  172. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_units.py +0 -0
  173. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_updates.py +0 -0
  174. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_upgrade.py +0 -0
  175. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_validate.py +0 -0
  176. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_web.py +0 -0
  177. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_web_errors.py +0 -0
  178. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_web_session.py +0 -0
  179. {mapcan-0.25.0 → mapcan-0.26.0}/tests/test_workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mapcan
3
- Version: 0.25.0
3
+ Version: 0.26.0
4
4
  Summary: A YAML map of CAN signals as the single source of truth: validation, Excel/PDF/Markdown/HTML, DBC, C/Python code
5
5
  Project-URL: Homepage, https://github.com/ordu1453/mapcan
6
6
  Project-URL: Documentation, https://github.com/ordu1453/mapcan/blob/main/docs/format.md
@@ -5,6 +5,24 @@ Changes of the map format by mapcan version. Up to 0.23 they keep `mapcan: 1`; 0
5
5
  [Versioning and compatibility](format.md#versioning-and-compatibility). A map that uses a field
6
6
  needs at least the version of mapcan that introduced it; former names stay readable.
7
7
 
8
+ ## 0.26
9
+
10
+ - The object dictionary of CANopen (#151): `objects` of a bus (objects every device of the bus has) and of a
11
+ device (its own, in the manufacturer area; one with an index of the bus's takes its place), read and written by SDO
12
+ ([Object dictionary](format.md#object-dictionary)). An object is a variable (`data_type`) or a record or an
13
+ array of `entries`, with `access`, `default`, `unit`, and `source` for a value from the map: a master reads the
14
+ map version (`map_version.*`, `layout_crc32`) a device was built from. New rules `od-protocol`,
15
+ `od-object-area`, `od-object-duplicate`, `od-object-shape`, `od-default` and `od-unknown`. `mapcan export eds`
16
+ writes the objects as described. Maps without `objects` are unchanged.
17
+ - The layout of an SDO frame: bytes 1–3 are one field `sdo_object` (index and subindex), an enum of the
18
+ objects of the device's dictionary and of those the exchanges address, and the multiplexer selector of the
19
+ values of the exchanges, whatever their indices (was `sdo_index` and `sdo_subindex`, the selector only when
20
+ all exchanges had one index, otherwise one `sdo_data`). An `sdo_rx`/`sdo_tx` frame without exchanges is laid
21
+ out too. The generated code, DBC and documents of SDO frames change, and so does the `layout_crc32` of a map
22
+ with SDO frames.
23
+ - The `index` of a PDO signal may be in the standardized interface profiles too: `canopen-od` reports one
24
+ outside 0x2000..0xBFFF (was 0x2000..0x9FFF).
25
+
8
26
  ## 0.25
9
27
 
10
28
  - A field of a bit field can be the multiplexer selector (#149): `multiplexer: true` on a flag, as on a signal.
@@ -115,6 +115,7 @@ lint:
115
115
  | `data_sample_point` | CAN FD: sample point of the data phase, percent (`75`) |
116
116
  | `brs` | CAN FD: bit rate switch (BRS) of the frames by default, `true` if omitted. Set `false` when the nodes or the wiring cannot handle the data phase bit rate |
117
117
  | `frames` | Frames whose sender is outside the map, with the receiving devices in `receivers`; also the CANopen broadcast frames (`nmt`, `sync`, `time`) |
118
+ | `objects` | CANopen: dictionary objects every device of the bus has (see [Object dictionary](#object-dictionary)) |
118
119
  | `devices` | Devices |
119
120
 
120
121
  ### Device (`devices[]`)
@@ -127,6 +128,7 @@ lint:
127
128
  | `node_id` | CANopen node address (1..127) |
128
129
  | `address` | J1939 source address (0..253) |
129
130
  | `description` | What the device is |
131
+ | `objects` | CANopen: the device's own dictionary objects, in any object area (see [Object dictionary](#object-dictionary)) |
130
132
  | `frames` | The device's frames: those it transmits, plus the CANopen RX frames whose ID depends on its address (see [Sender and receivers](#sender-and-receivers)) |
131
133
 
132
134
  ### Frame (`frames[]`)
@@ -191,7 +193,7 @@ CANopen ID computation:
191
193
  | `initial` | Default value in physical units (`…_INITIAL_RAW` in C, `GenSigStartValue` in DBC) |
192
194
  | `source` | An integer `number`: the signal always carries a value from the map: `map_version.major`, `map_version.minor`, `map_version.patch` or `layout_crc32` (see [Map version in a frame](#map-version-in-a-frame)). Replaces `initial` |
193
195
  | `invalid_raw` | An integer `number`: raw values that carry no value (see [Values without a value](#values-without-a-value)): `0xFF`, a list, ranges `0xFF00..0xFFFF`, or `{not_available: …, error: …}`. Formerly `invalid` |
194
- | `index`, `subindex` | CANopen dictionary object mapped into the PDO (see [Object dictionary and EDS](#object-dictionary-and-eds)) |
196
+ | `index`, `subindex` | CANopen dictionary object mapped into the PDO (see [EDS](#eds)) |
195
197
  | `spn` | J1939 suspect parameter number (SAE J1939-71), 0..524287. Shown in documents, written to DBC as the `SPN` signal attribute and to code as `<FRAME>_<SIGNAL>_SPN` |
196
198
  | `comment` | A note or caveat (see [Text fields](#text-fields)) |
197
199
 
@@ -410,7 +412,116 @@ and unpacks the whole payload; splitting it into packets is the job of the J1939
410
412
  A signal longer than 64 bits can only be bytes (`encoding: bytes`, a byte array or text,
411
413
  little-endian, starting at a byte boundary).
412
414
 
413
- ### Object dictionary and EDS
415
+ ### Object dictionary
416
+
417
+ The dictionary of a CANopen device (CiA 301) is written in `objects`: of the bus, the objects every
418
+ device of the bus has (the identity 0x1018, the software version 0x100A, a version of the map at
419
+ one index for all), of any area; and of the device, its own, in any object area
420
+ (0x1000..0xBFFF). A device's object with the index of one of the bus takes its place for that
421
+ device. A master reads and writes the objects by SDO; an SDO exchange
422
+ (`sdo[]`) and a PDO signal (`index`, `subindex`) address an object of the dictionary but do not
423
+ make one.
424
+
425
+ | Field | Description |
426
+ |---|---|
427
+ | `index` | Required. 0x1000..0x1FFF communication profile, 0x2000..0x5FFF manufacturer area, 0x6000..0x9FFF standardized device profiles, 0xA000..0xBFFF standardized interface profiles. The data type area (0x0000..0x0FFF) and the reserved one (0xC000..0xFFFF) hold no objects of a device |
428
+ | `name` | Required. Identifier (`software_version`) |
429
+ | `title`, `description` | Name and description for people |
430
+ | `data_type` | A variable (VAR): its CiA 301 type, `unsigned8`..`unsigned64`, `integer8`..`integer64`, `real32`, `real64`, `boolean`, `visible_string`, `octet_string`, `unicode_string`, `time_of_day`, `time_difference`, `domain` |
431
+ | `access` | `ro` (the default), `wo`, `rw`, `const` |
432
+ | `default` | Value after power-up: a number, text for a string |
433
+ | `source` | The value is taken from the map, as a signal's [`source`](#map-version-in-a-frame): `map_version.major`, `.minor`, `.patch` or `layout_crc32`. An unsigned type of at least 8 bits (32 for the CRC) |
434
+ | `unit` | Unit of the value |
435
+ | `entries` | Instead of `data_type`: the entries of a RECORD by `subindex` from 0x01, each with `subindex`, `name`, `title`, `description`, `data_type`, `access`, `default`, `source`, `unit`. Subindex 0x00 holds the number of entries and is not written |
436
+ | `array` | `true`: the entries make an ARRAY, all of one data type |
437
+
438
+ ```yaml
439
+ buses:
440
+ - name: drive_bus
441
+ protocol: canopen
442
+ objects: # every device of the bus has them
443
+ - index: 0x100A
444
+ name: software_version
445
+ title: Manufacturer software version
446
+ data_type: visible_string
447
+ access: const
448
+ - index: 0x2000
449
+ name: map_version
450
+ title: Map version
451
+ entries:
452
+ - {subindex: 1, name: major, data_type: unsigned8, source: map_version.major}
453
+ - {subindex: 2, name: minor, data_type: unsigned8, source: map_version.minor}
454
+ - {subindex: 3, name: patch, data_type: unsigned8, source: map_version.patch}
455
+ - {subindex: 4, name: layout_crc32, data_type: unsigned32, source: layout_crc32}
456
+ devices:
457
+ - name: drive
458
+ node_id: 0x05
459
+ frames:
460
+ - name: drive_sdo_rx
461
+ canopen: sdo_rx
462
+ sdo:
463
+ - {name: read_sw, command: 0x40, index: 0x100A}
464
+ - {name: read_map_crc, command: 0x40, index: 0x2000, subindex: 4}
465
+ ```
466
+
467
+ The web editor has an **Objects** tab in the bus and device settings, next to **Properties**.
468
+ Objects are listed by index under a heading per index area. A + on the right of each heading adds
469
+ an object; the standard objects of CiA 301 have a checkbox for including them in the dictionary.
470
+ On a device's page the bus's objects are locked: they are changed on the bus's page. A click
471
+ on an identifier opens the object's form (data type, access, value), a double click renames it. Once a device has a dictionary (its own or
472
+ the bus's), an SDO exchange or a PDO signal that addresses an object not in it is noted
473
+ (`od-unknown`). See [tests/data/canopen-od.yaml](../tests/data/canopen-od.yaml).
474
+
475
+ ### Reusable structures
476
+
477
+ Bus and device settings have **Properties** and **Structures** tabs. The left tree lists buses,
478
+ devices and frames; signals and flags are opened from the frame layout or its object list.
479
+ Use **+** beside Structures (also available in Properties) to add a named enumeration or bit mask.
480
+ Use **×** to disable a structure without losing its definitions; adding the same identifier restores it.
481
+ Remove all bus locks before disabling a structure containing mandatory entries.
482
+
483
+ CANopen offers **Objects**, **States** (NMT heartbeat states: boot-up 0, stopped 4, operational 5,
484
+ pre-operational 127), and **EEC** (16-bit EMCY emergency error codes). These are selectable templates,
485
+ not automatically selected values. User structures such as `warnings`, `fault` and `mode` start empty.
486
+ Other bus protocols support user-defined structures without the CANopen templates.
487
+ The state and emergency templates follow [CiA error control](https://www.can-cia.org/can-knowledge/error-control-protocols)
488
+ and [EMCY](https://www.can-cia.org/can-knowledge/special-function-protocols); generic emergency codes
489
+ are also listed in [CANopenNode](https://canopennode.github.io/CANopenNode/group__CO__EM__errorCode__t.html).
490
+
491
+ Each bus/device has `structures: {name: definition}`. A definition contains:
492
+
493
+ | Field | Meaning |
494
+ |---|---|
495
+ | `title` | Optional display title |
496
+ | `kind` | `enum` (default) or `bitmask`; mask keys are positive powers of two |
497
+ | `enabled` | Defaults to true; false disables the structure locally |
498
+ | `values` | Numeric keys mapped to names or `{name, description}`, like `value_tables` |
499
+ | `locked` | Bus value keys that devices cannot exclude or override |
500
+ | `excluded` | Device exclusions from the bus values; bus locks take precedence |
501
+
502
+ Bus values are inherited. Devices can add values, override unlocked values, or exclude them.
503
+ The bus tab displays a device column for each device and includes device-specific values,
504
+ so the same screen shows which device uses each value. Excluded values can be selected again.
505
+ Disabling a device structure retains any locked bus values.
506
+
507
+ Select **Values from structure** in a frame signal/object or flag, or write
508
+ `values: 'structure:states'`. Resolution uses the structure of the device that owns the frame,
509
+ or the bus for a bus frame. Enumerations become the resolved value table; bit masks become
510
+ single-bit flags of the signal, with positions given by the mask keys. The reference remains in
511
+ the YAML, so later structure edits propagate to the frame, exports and generated code. A disabled
512
+ or missing structure reports an error. Ordinary `values: table_name` references still address
513
+ the global `value_tables` dictionary.
514
+
515
+ Object dictionaries follow the same inclusion policy: a bus object with `locked: true` cannot be
516
+ excluded or overridden by a device. A device's `excluded_objects: [0x2000, ...]` removes unlocked
517
+ indices. `objects_enabled: false` disables a bus/device dictionary; at the device level locked bus
518
+ objects remain. Both bus and device Objects tabs offer every legal object area, not just the
519
+ manufacturer area. The bus tab controls locks; device tabs show selection checkboxes and locks.
520
+
521
+ See [examples/structures.yaml](../examples/structures.yaml) for two devices using common states,
522
+ warnings and emergency codes with different selections.
523
+
524
+ ### EDS
414
525
 
415
526
  A signal of a device's PDO can name the dictionary object it carries: `index` and, for an entry of
416
527
  a record, `subindex` (0 by default). Signals sharing an `index` with different subindices form a
@@ -420,7 +531,9 @@ heartbeat time (1017, from a heartbeat frame's `cycle_ms`), the communication an
420
531
  parameters of each PDO with mapped signals (1400/1600 for RPDOs, 1800/1A00 for TPDOs; COB-ID
421
532
  `$NODEID+base`, event timer from `cycle_ms`) and the objects themselves. Gaps between mapped
422
533
  signals are filled with dummy objects. `mapcan import eds` reads such a file, or a vendor's EDS or
423
- DCF, back into a map ([cli.md](cli.md#importing-an-eds-or-dcf)).
534
+ DCF, back into a map ([cli.md](cli.md#importing-an-eds-or-dcf)). Objects of the device's
535
+ [dictionary](#object-dictionary) are written as described there, with their data type, access and
536
+ value, in place of those the file would have otherwise; an object a PDO maps is marked mappable.
424
537
 
425
538
  ```yaml
426
539
  - name: drive_status
@@ -454,9 +567,14 @@ For `sdo_rx`/`sdo_tx` frames you can describe expedited SDO exchanges instead of
454
567
 
455
568
  The value's `encoding` (`number` or `enum`) and `bit_length` (8, 16, 24 or 32) are required.
456
569
 
457
- mapcan builds the frame layout itself: byte 0 is the command, bytes 1–2 the index
458
- (little-endian), byte 3 the subindex (the multiplexer selector when all exchanges share one
459
- index), and bytes 4–7 the value.
570
+ mapcan builds the frame layout itself: byte 0 is the command, bytes 1–3 the object
571
+ (`sdo_object`: the index little-endian in bytes 1–2, the subindex in byte 3, so the raw value is
572
+ `index | subindex << 16`), and bytes 4–7 the value, selected by the object (the multiplexer). The
573
+ object is an enum of the objects of the device's [dictionary](#object-dictionary) — the bus's and
574
+ the device's own, a variable by its name, an entry of an array or a record as `OBJECT_ENTRY` — and
575
+ of the objects the exchanges address; an object added to a dictionary appears in the SDO frames of
576
+ every device that has it. An `sdo_rx`/`sdo_tx` frame without exchanges and signals is laid out the
577
+ same way.
460
578
 
461
579
  ## Sender and receivers
462
580
 
@@ -700,8 +818,10 @@ keep their order.
700
818
  |---|---|
701
819
  | Map | `mapcan`, `part_of`, `document`, `include`, `lint`, `value_tables`, `buses` |
702
820
  | `document` | `title`, `subtitle`, `version`, `date`, `author`, `organization`, `language`, `bit_numbering`, `print`, `history` |
703
- | Bus | `name`, `title`, `description`, `protocol`, `connector`, `bitrate`, `sample_point`, `fd`, `data_bitrate`, `data_sample_point`, `brs`, `frames`, `devices` |
704
- | Device | `name`, `short`, `title`, `description`, `node_id`, `address`, `frames` |
821
+ | Bus | `name`, `title`, `description`, `protocol`, `connector`, `bitrate`, `sample_point`, `fd`, `data_bitrate`, `data_sample_point`, `brs`, `frames`, `objects_enabled`, `objects`, `structures`, `devices` |
822
+ | Device | `name`, `short`, `title`, `description`, `node_id`, `address`, `objects_enabled`, `objects`, `excluded_objects`, `structures`, `frames` |
823
+ | Dictionary object | `index`, `name`, `title`, `description`, `data_type`, `access`, `default`, `source`, `unit`, `array`, `entries` |
824
+ | Entry of an object | `subindex`, `name`, `title`, `description`, `data_type`, `access`, `default`, `source`, `unit` |
705
825
  | Frame | `name`, `title`, `description`, `comment`, `canopen`, `id`, `extended`, `pgn`, `priority`, `destination`, `length`, `brs`, `direction`, `cycle_ms`, `trigger`, `inhibit_ms`, `timeout_ms`, `sender`, `receivers`, `signals`, `sdo` |
706
826
  | Signal | `name`, `title`, `description`, `comment`, `encoding`, `start_bit`, `byte`, `bit`, `bit_length`, `byte_length`, `byte_order`, `representation`, `charset`, `terminator`, `factor`, `offset`, `unit`, `min`, `max`, `values`, `value_format`, `flags`, `multiplexer`, `mux`, `initial`, `source`, `invalid_raw`, `spn`, `index`, `subindex` |
707
827
  | Flag | `name`, `bit`, `bit_length`, `description`, `values`, `multiplexer` |
@@ -778,9 +898,15 @@ turned off with `--disable CODE` or `lint.disable`.
778
898
  | `j1939-field-protocol` | warning | pgn/priority/destination/address/spn on a non-J1939 bus |
779
899
  | `j1939-spn-duplicate` | warning | The same SPN on several signals of the bus |
780
900
  | `j1939-tp` | info | A PGN longer than 8 bytes is sent with the J1939-21 transport protocol |
781
- | `canopen-od` | warning | Dictionary object on a signal outside a device's PDO, or outside 0x2000..0x9FFF |
901
+ | `canopen-od` | warning | Dictionary object on a signal outside a device's PDO, or outside 0x2000..0xBFFF |
782
902
  | `od-duplicate` | warning | The same dictionary object on several signals of a device |
783
903
  | `od-subindex-zero` | error | A signal at subindex 0 of an array or a record: subindex 0 holds the number of its entries |
904
+ | `od-protocol` | warning | `objects` on a bus that is not CANopen |
905
+ | `od-object-area` | error | A dictionary object in the data type area (0x0000..0x0FFF) or the reserved one (0xC000..0xFFFF) |
906
+ | `od-object-duplicate` | error | The same index or name twice in a dictionary, or the same subindex or name twice in an object |
907
+ | `od-object-shape` | error | An object with both `data_type` and `entries` or with neither, `default`/`source`/`unit` of an array or a record on the object instead of its entries, an array of several data types |
908
+ | `od-default` | error | `default` that does not fit the data type, `default` with `source`, `source` of a type too short for it |
909
+ | `od-unknown` | info | An SDO exchange or a PDO signal addresses an object that is not in the device's dictionary |
784
910
 
785
911
  ### Sender and receivers
786
912
 
@@ -0,0 +1,65 @@
1
+ # Reusable CANopen structures, with inherited values, exclusions and mandatory entries.
2
+ mapcan: 2
3
+ document:
4
+ title: CANopen structures
5
+ version: 1.0.0
6
+ language: en
7
+ buses:
8
+ - name: machine
9
+ title: Machine
10
+ protocol: canopen
11
+ bitrate: 500000
12
+ objects:
13
+ - {index: 0x1000, name: device_type, locked: true, data_type: unsigned32}
14
+ - {index: 0x2000, name: application_state, data_type: unsigned8}
15
+ structures:
16
+ states:
17
+ title: States
18
+ kind: enum
19
+ values: {0: BOOT_UP, 4: STOPPED, 5: OPERATIONAL, 127: PRE_OPERATIONAL}
20
+ locked: [5]
21
+ warnings:
22
+ title: Warnings
23
+ kind: bitmask
24
+ values: {0x01: HIGH_TEMPERATURE, 0x02: LOW_SUPPLY}
25
+ locked: [0x02]
26
+ eec:
27
+ title: EEC
28
+ kind: enum
29
+ values: {0x0000: ERROR_RESET, 0x1000: GENERIC_ERROR, 0x4000: TEMPERATURE}
30
+ locked: [0x0000]
31
+ devices:
32
+ - name: drive
33
+ title: Drive
34
+ node_id: 5
35
+ structures:
36
+ states: {excluded: [4]}
37
+ warnings:
38
+ kind: bitmask
39
+ values: {0x04: SERVICE_REQUIRED}
40
+ frames:
41
+ - name: drive_status
42
+ canopen: pdo_tx1
43
+ length: 2
44
+ signals:
45
+ - {name: state, encoding: enum, byte: 0, bit_length: 8, values: 'structure:states', index: 0x2000}
46
+ - {name: warnings, encoding: bitfield, byte: 1, bit_length: 8, values: 'structure:warnings'}
47
+ - name: drive_emergency
48
+ canopen: emcy
49
+ length: 8
50
+ signals:
51
+ - {name: error_code, encoding: enum, byte: 0, bit_length: 16, values: 'structure:eec'}
52
+ - {name: error_register, encoding: number, byte: 2, bit_length: 8}
53
+ - name: controller
54
+ title: Controller
55
+ node_id: 1
56
+ excluded_objects: [0x2000]
57
+ structures:
58
+ warnings: {excluded: [0x01]}
59
+ frames:
60
+ - name: controller_status
61
+ canopen: pdo_tx1
62
+ length: 2
63
+ signals:
64
+ - {name: state, encoding: enum, byte: 0, bit_length: 8, values: 'structure:states'}
65
+ - {name: warnings, encoding: bitfield, byte: 1, bit_length: 8, values: 'structure:warnings'}
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapcan"
3
- version = "0.25.0"
3
+ version = "0.26.0"
4
4
  description = "A YAML map of CAN signals as the single source of truth: validation, Excel/PDF/Markdown/HTML, DBC, C/Python code"
5
5
  # readme: built from README.md with absolute links for PyPI (see fancy-pypi-readme below)
6
6
  dynamic = ["readme"]