mapcan 0.23.3__tar.gz → 0.24.2__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 (171) hide show
  1. {mapcan-0.23.3 → mapcan-0.24.2}/PKG-INFO +5 -5
  2. {mapcan-0.23.3 → mapcan-0.24.2}/README.md +4 -4
  3. {mapcan-0.23.3 → mapcan-0.24.2}/docs/cli.md +2 -2
  4. {mapcan-0.23.3 → mapcan-0.24.2}/docs/format-changelog.md +35 -1
  5. {mapcan-0.23.3 → mapcan-0.24.2}/docs/format.md +71 -55
  6. {mapcan-0.23.3 → mapcan-0.24.2}/docs/web.md +1 -1
  7. mapcan-0.24.2/examples/canopen-node.yaml +113 -0
  8. mapcan-0.24.2/examples/j1939.yaml +194 -0
  9. {mapcan-0.23.3 → mapcan-0.24.2}/examples/minimal.yaml +5 -5
  10. {mapcan-0.23.3 → mapcan-0.24.2}/examples/tractor/powertrain.yaml +3 -3
  11. {mapcan-0.23.3 → mapcan-0.24.2}/examples/tractor/tractor.yaml +2 -2
  12. mapcan-0.24.2/examples/vehicle-can.yaml +167 -0
  13. {mapcan-0.23.3 → mapcan-0.24.2}/pyproject.toml +1 -1
  14. mapcan-0.24.2/schema/mapcan-part.schema.json +1494 -0
  15. mapcan-0.24.2/schema/mapcan.schema.json +1905 -0
  16. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/__init__.py +1 -1
  17. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/cli.py +3 -2
  18. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/codegen/c.py +13 -13
  19. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/codegen/common.py +4 -4
  20. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/codegen/py.py +8 -8
  21. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/docmodel.py +12 -12
  22. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/dbc.py +2 -2
  23. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/eds.py +3 -5
  24. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/importers/dbc.py +17 -18
  25. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/layout.py +3 -2
  26. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/loader.py +20 -4
  27. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/locale/ru.py +57 -45
  28. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/lsp/edits.py +17 -4
  29. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/model.py +37 -23
  30. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/schema.py +6 -5
  31. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/upgrade.py +65 -0
  32. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/validate.py +41 -31
  33. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/app.py +2 -0
  34. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/devicefile.py +1 -1
  35. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/newmap.py +1 -1
  36. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/session.py +9 -4
  37. mapcan-0.24.2/src/mapcan/web/static/assets/index-CrDV-cv2.css +1 -0
  38. mapcan-0.24.2/src/mapcan/web/static/assets/index-DbzxbTZB.js +36 -0
  39. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/static/index.html +2 -2
  40. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/yamlops.py +61 -14
  41. {mapcan-0.23.3 → mapcan-0.24.2}/tests/conftest.py +1 -1
  42. mapcan-0.24.2/tests/data/bit_layouts.json +15 -0
  43. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/invalid_map.yaml +4 -4
  44. mapcan-0.24.2/tests/data/reference.yaml +591 -0
  45. {mapcan-0.23.3/examples → mapcan-0.24.2/tests/data/v1}/canopen-node.yaml +2 -1
  46. {mapcan-0.23.3/examples → mapcan-0.24.2/tests/data/v1}/j1939.yaml +2 -1
  47. {mapcan-0.23.3/tests/data → mapcan-0.24.2/tests/data/v1}/reference.yaml +2 -1
  48. {mapcan-0.23.3/examples → mapcan-0.24.2/tests/data/v1}/vehicle-can.yaml +2 -1
  49. {mapcan-0.23.3 → mapcan-0.24.2}/tests/golden/reference.md +6 -6
  50. {mapcan-0.23.3 → mapcan-0.24.2}/tests/golden/reference_bus1.h +2 -92
  51. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_cli.py +123 -1
  52. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_codegen.py +59 -58
  53. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_device_file.py +8 -8
  54. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_diff.py +147 -3
  55. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_direction.py +3 -3
  56. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_eds.py +4 -4
  57. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_exchange.py +3 -3
  58. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_fmt.py +34 -6
  59. mapcan-0.24.2/tests/test_format_v1.py +140 -0
  60. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_i18n.py +3 -3
  61. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_import.py +16 -4
  62. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_include.py +73 -7
  63. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_j1939.py +10 -10
  64. mapcan-0.24.2/tests/test_launcher.py +459 -0
  65. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_loader_fast.py +3 -3
  66. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_lsp.py +132 -11
  67. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_lsp_edits.py +215 -10
  68. mapcan-0.24.2/tests/test_lsp_server.py +498 -0
  69. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_model.py +14 -4
  70. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_new_signal.py +2 -2
  71. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_source.py +7 -6
  72. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_titles.py +1 -1
  73. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_units.py +3 -3
  74. mapcan-0.24.2/tests/test_updates.py +110 -0
  75. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_upgrade.py +7 -7
  76. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_validate.py +72 -70
  77. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_web.py +6 -6
  78. mapcan-0.24.2/tests/test_web_errors.py +261 -0
  79. mapcan-0.24.2/tests/test_web_session.py +108 -0
  80. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_yamlops.py +72 -14
  81. mapcan-0.23.3/src/mapcan/web/static/assets/index-B4RJ5ml1.js +0 -36
  82. mapcan-0.23.3/src/mapcan/web/static/assets/index-BXiCvm0s.css +0 -1
  83. mapcan-0.23.3/tests/test_launcher.py +0 -157
  84. {mapcan-0.23.3 → mapcan-0.24.2}/.gitignore +0 -0
  85. {mapcan-0.23.3 → mapcan-0.24.2}/LICENSE +0 -0
  86. {mapcan-0.23.3 → mapcan-0.24.2}/NOTICE +0 -0
  87. {mapcan-0.23.3 → mapcan-0.24.2}/THIRD_PARTY_NOTICES.md +0 -0
  88. {mapcan-0.23.3 → mapcan-0.24.2}/docs/ci-example.md +0 -0
  89. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/demo-dark.gif +0 -0
  90. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/demo-light.gif +0 -0
  91. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/document-pages-dark.png +0 -0
  92. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/document-pages-light.png +0 -0
  93. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-demo-dark.gif +0 -0
  94. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-demo-light.gif +0 -0
  95. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-hover-dark.png +0 -0
  96. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-hover-light.png +0 -0
  97. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-map-dark.png +0 -0
  98. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-map-light.png +0 -0
  99. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-problems-dark.png +0 -0
  100. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-problems-light.png +0 -0
  101. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-quickfix-dark.gif +0 -0
  102. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/vscode-quickfix-light.gif +0 -0
  103. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/web-frame-dark.png +0 -0
  104. {mapcan-0.23.3 → mapcan-0.24.2}/docs/images/web-frame-light.png +0 -0
  105. {mapcan-0.23.3 → mapcan-0.24.2}/docs/logo-dark.svg +0 -0
  106. {mapcan-0.23.3 → mapcan-0.24.2}/docs/logo-light.svg +0 -0
  107. {mapcan-0.23.3 → mapcan-0.24.2}/docs/templates.md +0 -0
  108. {mapcan-0.23.3 → mapcan-0.24.2}/docs/zephyr.md +0 -0
  109. {mapcan-0.23.3 → mapcan-0.24.2}/examples/zephyr/CMakeLists.txt +0 -0
  110. {mapcan-0.23.3 → mapcan-0.24.2}/examples/zephyr/prj.conf +0 -0
  111. {mapcan-0.23.3 → mapcan-0.24.2}/examples/zephyr/src/main.c +0 -0
  112. /mapcan-0.23.3/schema/mapcan-part.schema.json → /mapcan-0.24.2/schema/mapcan-part-v1.schema.json +0 -0
  113. /mapcan-0.23.3/schema/mapcan.schema.json → /mapcan-0.24.2/schema/mapcan-v1.schema.json +0 -0
  114. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/bits.py +0 -0
  115. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/canopen.py +0 -0
  116. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/codegen/__init__.py +0 -0
  117. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/codegen/zephyr.py +0 -0
  118. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/diagnostics.py +0 -0
  119. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/diff.py +0 -0
  120. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/__init__.py +0 -0
  121. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/pdf.py +0 -0
  122. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/text.py +0 -0
  123. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/export/xlsx.py +0 -0
  124. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/extras.py +0 -0
  125. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fmt.py +0 -0
  126. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/OFL-PTSerif.txt +0 -0
  127. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/OFL.txt +0 -0
  128. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Sans-Web-Bold.ttf +0 -0
  129. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Sans-Web-BoldItalic.ttf +0 -0
  130. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Sans-Web-Italic.ttf +0 -0
  131. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Sans-Web-Regular.ttf +0 -0
  132. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Serif-Web-Bold.ttf +0 -0
  133. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Serif-Web-BoldItalic.ttf +0 -0
  134. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Serif-Web-Italic.ttf +0 -0
  135. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/fonts/PT_Serif-Web-Regular.ttf +0 -0
  136. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/i18n.py +0 -0
  137. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/importers/__init__.py +0 -0
  138. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/launcher.py +0 -0
  139. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/locale/__init__.py +0 -0
  140. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/lsp/__init__.py +0 -0
  141. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/lsp/analysis.py +0 -0
  142. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/lsp/exports.py +0 -0
  143. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/lsp/server.py +0 -0
  144. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/protocols.py +0 -0
  145. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/resolve.py +0 -0
  146. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/document.html.j2 +0 -0
  147. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/document.md.j2 +0 -0
  148. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/pdf/gost-19.typ +0 -0
  149. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/pdf/gost-2.105.typ +0 -0
  150. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/pdf/gost-7.32.typ +0 -0
  151. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/pdf/lib.typ +0 -0
  152. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/pdf/mapcan.typ +0 -0
  153. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/templates/xlsx_style.yaml +0 -0
  154. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/units.py +0 -0
  155. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/updates.py +0 -0
  156. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/userconfig.py +0 -0
  157. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/__init__.py +0 -0
  158. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/examples.py +0 -0
  159. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/static/OFL-Sora.txt +0 -0
  160. {mapcan-0.23.3 → mapcan-0.24.2}/src/mapcan/web/static/favicon.svg +0 -0
  161. {mapcan-0.23.3 → mapcan-0.24.2}/tests/__init__.py +0 -0
  162. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/legacy.yaml +0 -0
  163. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/logo.png +0 -0
  164. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/logo.svg +0 -0
  165. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/zephyr_stub/zephyr/drivers/can.h +0 -0
  166. {mapcan-0.23.3 → mapcan-0.24.2}/tests/data/zephyr_stub/zephyr/kernel.h +0 -0
  167. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_auth.py +0 -0
  168. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_export.py +0 -0
  169. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_extras.py +0 -0
  170. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_templates.py +0 -0
  171. {mapcan-0.23.3 → mapcan-0.24.2}/tests/test_workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mapcan
3
- Version: 0.23.3
3
+ Version: 0.24.2
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
@@ -177,7 +177,7 @@ installer is not code-signed, so SmartScreen may warn: **More info → Run anywa
177
177
 
178
178
  **From canmap.** The tool used to be called canmap. The Windows installer upgrades it by itself; with
179
179
  uv or pipx, `uv tool uninstall canmap` and install again. Settings move from `~/.canmap` to `~/.mapcan`;
180
- maps need the key `mapcan: 1`.
180
+ maps need the key `mapcan: 1` in place of `canmap: 1` (`mapcan migrate` then rewrites them in version 2).
181
181
  </details>
182
182
 
183
183
  ## Quick start
@@ -248,7 +248,7 @@ language server completes keys from the [JSON Schema](https://github.com/ordu145
248
248
  ## A map
249
249
 
250
250
  ```yaml
251
- mapcan: 1
251
+ mapcan: 2
252
252
 
253
253
  document:
254
254
  title: Electric vehicle example map
@@ -268,8 +268,8 @@ buses:
268
268
  cycle_ms: 100
269
269
  receivers: [vcu]
270
270
  signals:
271
- - {name: pack_voltage, byte: 0, encoding: float, unit: V, min: 0, max: 1000}
272
- - {name: pack_current, byte: 4, encoding: float, unit: A, initial: 0}
271
+ - {name: pack_voltage, byte: 0, encoding: number, representation: float, unit: V, min: 0, max: 1000}
272
+ - {name: pack_current, byte: 4, encoding: number, representation: float, unit: A, initial: 0}
273
273
  - name: vcu
274
274
  ```
275
275
 
@@ -105,7 +105,7 @@ installer is not code-signed, so SmartScreen may warn: **More info → Run anywa
105
105
 
106
106
  **From canmap.** The tool used to be called canmap. The Windows installer upgrades it by itself; with
107
107
  uv or pipx, `uv tool uninstall canmap` and install again. Settings move from `~/.canmap` to `~/.mapcan`;
108
- maps need the key `mapcan: 1`.
108
+ maps need the key `mapcan: 1` in place of `canmap: 1` (`mapcan migrate` then rewrites them in version 2).
109
109
  </details>
110
110
 
111
111
  ## Quick start
@@ -176,7 +176,7 @@ language server completes keys from the [JSON Schema](docs/format.md).
176
176
  ## A map
177
177
 
178
178
  ```yaml
179
- mapcan: 1
179
+ mapcan: 2
180
180
 
181
181
  document:
182
182
  title: Electric vehicle example map
@@ -196,8 +196,8 @@ buses:
196
196
  cycle_ms: 100
197
197
  receivers: [vcu]
198
198
  signals:
199
- - {name: pack_voltage, byte: 0, encoding: float, unit: V, min: 0, max: 1000}
200
- - {name: pack_current, byte: 4, encoding: float, unit: A, initial: 0}
199
+ - {name: pack_voltage, byte: 0, encoding: number, representation: float, unit: V, min: 0, max: 1000}
200
+ - {name: pack_current, byte: 4, encoding: number, representation: float, unit: A, initial: 0}
201
201
  - name: vcu
202
202
  ```
203
203
 
@@ -18,7 +18,7 @@ mapcan gen py FILE [-o DIR] [--bus NAME]
18
18
  mapcan build FILE [-o DIR] [--formats xlsx,pdf,md,html,dbc,eds,c,py] [--pdf-template NAME]
19
19
  mapcan diff OLD NEW [--format text|md|json] [--fail-on breaking|any]
20
20
  mapcan import dbc FILE.dbc [-o FILE.yaml] [--title TEXT] [--lang en] [--force]
21
- mapcan migrate FILE… [--check] # former field names → current ones
21
+ mapcan migrate FILE… [--check] # former field names → current ones, format v1 → v2
22
22
  mapcan fmt FILE… [--check] # keys in one order, comments and layout kept
23
23
  mapcan schema [-o schema.json] [--part] # --part: schema of an included file
24
24
  mapcan template --list | pdf [--name gost-2.105] -o FILE | md|html|xlsx-style -o FILE
@@ -97,7 +97,7 @@ is defined. `--prefix` puts one more prefix in front of every name and file.
97
97
 
98
98
  Each signal is read and written with the shifts and masks of the bytes it touches, worked out from the
99
99
  map, in an unsigned type of its width: no loop over bits and no 64-bit arithmetic for a short field, which
100
- matters on Cortex-M0 and 8/16-bit MCUs. Physical values of scaled signals are `float` (`double` only where
100
+ matters on Cortex-M0 and 8/16-bit MCUs. Physical values of signals with `factor` or `offset` are `float` (`double` only where
101
101
  `float` cannot hold the raw values exactly, fields longer than 24 bits); `--phys-type double` makes them all
102
102
  `double`. On an MCU without an FPU, `--phys-type int` computes them in integers: the physical value is an
103
103
  integer in units of the decimals of the factor and offset (`0.125` and `-40` give thousandths:
@@ -1,9 +1,43 @@
1
1
  # Format changelog
2
2
 
3
- Changes of the map format by mapcan version. All of them keep `mapcan: 1`: see
3
+ Changes of the map format by mapcan version. Up to 0.23 they keep `mapcan: 1`; 0.24 introduces
4
+ `mapcan: 2`, and version 1 stays readable: see
4
5
  [Versioning and compatibility](format.md#versioning-and-compatibility). A map that uses a field
5
6
  needs at least the version of mapcan that introduced it; former names stay readable.
6
7
 
8
+ ## 0.24
9
+
10
+ - **Format version 2** (`mapcan: 2`): a signal has four encodings instead of eight (#140), `number`, `enum`,
11
+ `bitfield` and `bytes`. Version 2 does not read the former values. A map of version 1 (`mapcan: 1`) is still
12
+ read, converted as below, with the note `format-v1`; `mapcan migrate` (or the quick fix in VS Code) rewrites
13
+ it and its included files in version 2, keeping comments and layout. New maps, device files and DBC imports
14
+ are written in version 2. The schemas move to `…/schema/v2.json` and `…/schema/part-v2.json`; those of
15
+ version 1 stay published at `…/v1.json` and `…/part-v1.json`.
16
+
17
+ | Version 1 | Version 2 |
18
+ |---|---|
19
+ | `raw`, `scaled` | `number`; `factor` and `offset` make it a physical value |
20
+ | `float` | `number` with `representation: float` (32 bits unless `bit_length: 64`) |
21
+ | `flag` | `enum` with `bit_length: 1` (the length is no longer implied) |
22
+ | `string` | `bytes` with `charset` (`ascii` was the default; now a byte array has no `charset`) |
23
+ | SDO value `raw`, `scaled` | `number` |
24
+
25
+ - `representation` has the value `float` (IEEE 754), and applies to `number` only. `invalid_raw` and `source` do
26
+ not apply to a float, nor `terminator` to bytes without `charset` (`encoding-field`). The rule `flag-length` is
27
+ gone.
28
+ - An `enum` has unsigned values only and no `invalid_raw`: a value that means "no data" is an entry of its table.
29
+ A version 1 enum with `representation` or `invalid_raw` is reported (`encoding-field`) and rewritten by hand.
30
+ DBC import writes a signed signal with a value table as a `number`, with a warning that the table is not
31
+ imported.
32
+ - Generated C and Python have the physical-value helpers (`_to_phys`, `_from_phys`, `_phys`) of a signal only when
33
+ its `factor` or `offset` differs from 1 and 0: a former `scaled` signal without them has none, and documents
34
+ show its unit without "1 … /bit". The `min`/`max` range checks (`range-overflow`, `min-max`) cover every integer
35
+ `number`, not only scaled ones.
36
+ - The layout fingerprint (`layout_crc32`, `<BUS>_MAP_LAYOUT_CRC32`) is computed from text `v2`, which names the new
37
+ encodings: it changes for every map, so firmware that sends it has to be rebuilt.
38
+ - DBC import writes `number` (with `representation: float` for a float signal) and `enum`; a 1-bit signal without
39
+ a value table is a `number`.
40
+
7
41
  ## 0.23
8
42
 
9
43
  - With a `history`, the document's version and date are those of its latest entry:
@@ -1,11 +1,11 @@
1
- # Signal map format (mapcan, v1)
1
+ # Signal map format (mapcan, v2)
2
2
 
3
3
  A signal map is a single YAML file, and every document and code artifact is generated from it.
4
4
  The format is defined by the JSON Schema in
5
5
  [`schema/mapcan.schema.json`](../schema/mapcan.schema.json), published with each release at
6
- `https://ordu1453.github.io/mapcan/schema/v1.json` (a file included by a map:
7
- `https://ordu1453.github.io/mapcan/schema/part-v1.json`). An editor with a YAML language server
8
- (VS Code with the Red Hat *YAML* extension, JetBrains IDEs, Neovim, Zed, Helix) completes field
6
+ `https://ordu1453.github.io/mapcan/schema/v2.json` (a file included by a map:
7
+ `https://ordu1453.github.io/mapcan/schema/part-v2.json`; format version 1: `…/v1.json`,
8
+ `…/part-v1.json`). An editor with a YAML language server (VS Code with the Red Hat *YAML* extension, JetBrains IDEs, Neovim, Zed, Helix) completes field
9
9
  names and underlines errors as you type when it knows the schema of a file:
10
10
 
11
11
  - **The mapcan extension for VS Code** gives it to every map and included file by itself.
@@ -14,7 +14,7 @@ names and underlines errors as you type when it knows the schema of a file:
14
14
  - **Any file** gets it from this line at its top, which new maps and copies of the examples have:
15
15
 
16
16
  ```yaml
17
- # yaml-language-server: $schema=https://ordu1453.github.io/mapcan/schema/v1.json
17
+ # yaml-language-server: $schema=https://ordu1453.github.io/mapcan/schema/v2.json
18
18
  ```
19
19
 
20
20
  `mapcan schema -o schema.json` writes the schema anywhere you need it, for an editor with no network.
@@ -38,7 +38,7 @@ document.
38
38
  ## File structure
39
39
 
40
40
  ```yaml
41
- mapcan: 1 # format version (required)
41
+ mapcan: 2 # format version (required; see Versioning and compatibility)
42
42
  document: {...} # metadata and revision history
43
43
  include: [common.yaml] # included files (optional, see below)
44
44
  lint: {...} # style rules (optional)
@@ -175,13 +175,13 @@ CANopen ID computation:
175
175
  | `name` | Identifier (unique within the frame, together with flag names) |
176
176
  | `title` | Name for people ("Battery voltage") |
177
177
  | `description` | What the signal means |
178
- | `encoding` | Required: `enum`, `flag`, `bitfield`, `scaled`, `raw`, `float`, `bytes`, `string` |
179
- | `charset` | `string`: character encoding, `ascii` (default), `utf-8` or `latin-1` |
180
- | `terminator` | `string`: the byte that ends a shorter text and fills the rest of the field: a number (`0x00`) or one character (`"*"`, as in J1939 text parameters). Without it the text fills the field and unused bytes are 0x00 |
178
+ | `encoding` | Required: `number`, `enum`, `bitfield` or `bytes` (see [Encodings](#encodings)) |
179
+ | `charset` | `bytes`: the field is text in this character encoding, `ascii`, `utf-8` or `latin-1`. Without it the field is a byte array |
180
+ | `terminator` | Text (`bytes` with `charset`): the byte that ends a shorter text and fills the rest of the field: a number (`0x00`) or one character (`"*"`, as in J1939 text parameters). Without it the text fills the field and unused bytes are 0x00 |
181
181
  | `start_bit` + `bit_length` | Canonical position |
182
182
  | `byte` [+ `bit`] + `byte_length` \| `bit_length` | Shorthand position (see below) |
183
183
  | `byte_order` | `little_endian` (default) or `big_endian`. CANopen and J1939 carry little-endian data, so the editors offer the field only on other buses (or when it is set), and validation warns about a big-endian signal there (`byte-order-protocol`) |
184
- | `representation` | How the raw value is read as a number: `unsigned` (default), `twos_complement` (the usual signed integer), `ones_complement` or `sign_magnitude`. Generated C and Python code packs and unpacks the value in this representation; the last two have a symmetric range (−127…127 for 8 bits). DBC stores two's complement only, so the export warns about the other two. Formerly `signed` + `signed_code` |
184
+ | `representation` | `number`: how the raw value is read as a number: `unsigned` (default), `twos_complement` (the usual signed integer), `ones_complement`, `sign_magnitude`, or `float` (IEEE 754, see [Floating point](#floating-point)). Generated C and Python code packs and unpacks the value in this representation; ones' complement and sign-magnitude have a symmetric range (−127…127 for 8 bits). DBC stores two's complement only, so the export warns about those two. Formerly `signed` + `signed_code` |
185
185
  | `values` | Value table: `{0: NO_DATA, 1: {name: OK, description: "normal"}}` |
186
186
  | `value_format` | `dec` \| `hex`: how values are shown in documents |
187
187
  | `flags` | Bit field flags: `{bit, bit_length: 1, name, description, values}`; `bit` is the offset from the least significant bit of the field |
@@ -189,8 +189,8 @@ CANopen ID computation:
189
189
  | `multiplexer` | `true` for the multiplexer selector signal |
190
190
  | `mux` | Selector value (or list of values) for which the signal is present |
191
191
  | `initial` | Default value in physical units (`…_INITIAL_RAW` in C, `GenSigStartValue` in DBC) |
192
- | `source` | `raw`: 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
- | `invalid_raw` | 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` |
192
+ | `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
+ | `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
194
  | `index`, `subindex` | CANopen dictionary object mapped into the PDO (see [Object dictionary and EDS](#object-dictionary-and-eds)) |
195
195
  | `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
196
  | `comment` | A note or caveat (see [Text fields](#text-fields)) |
@@ -201,19 +201,16 @@ CANopen ID computation:
201
201
 
202
202
  | `encoding` | Meaning | Value fields |
203
203
  |---|---|---|
204
- | `raw` | Integer as is | `representation`, `unit`, `min`, `max`, `invalid_raw`, `initial`, `source` |
205
- | `scaled` | Scaled physical value: `raw * factor + offset` | `representation`, `factor`, `offset`, `unit`, `min`, `max`, `invalid_raw`, `initial` |
206
- | `enum` | Value from the `values` table | `values`, `value_format`, `representation`, `invalid_raw`, `initial` |
207
- | `flag` | One yes/no bit | `values`, `initial` |
204
+ | `number` | A number. Without `factor` and `offset` it is the integer as is; with them a physical value `raw * factor + offset`, with `_phys` helpers in generated code. `representation: float` makes it IEEE 754 (see [Floating point](#floating-point)) | `representation`, `factor`, `offset`, `unit`, `min`, `max`, `invalid_raw`, `initial`, `source` |
205
+ | `enum` | Value from the `values` table: unsigned values; a value that means "no data" is an entry of the table | `values`, `value_format`, `initial` |
208
206
  | `bitfield` | Set of flags | `flags` |
209
- | `float` | IEEE 754 | `factor`, `offset`, `unit`, `min`, `max`, `initial` |
210
- | `bytes` | Byte array | — |
211
- | `string` | Text (VIN, software identification): whole bytes from a byte boundary, like `bytes`. `str` in Python, a `char` array in C (not NUL-terminated when the text fills it); DBC has no text type and gets a byte array | `charset`, `terminator` |
207
+ | `bytes` | Byte array; with `charset`, text (VIN, software identification): whole bytes from a byte boundary, `str` in Python, a `char` array in C (not NUL-terminated when the text fills it); DBC has no text type and gets a byte array | `charset`, `terminator` |
212
208
 
213
- A field that does not apply is an error (`encoding-field`).
209
+ A field that does not apply is an error (`encoding-field`). So is `invalid_raw` or `source` on a floating-point
210
+ number, and `terminator` on bytes without `charset`.
214
211
 
215
- The length (`bit_length` or `byte_length`) is required. Only two encodings set it
216
- themselves: a `flag` is 1 bit, and a `float` is 32 bits unless `bit_length: 64` is given.
212
+ The length (`bit_length` or `byte_length`) is required, except for a floating-point number: 32 bits unless
213
+ `bit_length: 64` is given.
217
214
 
218
215
  #### Values without a value
219
216
 
@@ -223,7 +220,7 @@ SAE J1939-71:
223
220
 
224
221
  ```yaml
225
222
  - name: engine_speed
226
- encoding: scaled
223
+ encoding: number
227
224
  byte: 3
228
225
  byte_length: 2
229
226
  factor: 0.125
@@ -252,10 +249,10 @@ Give the signals of such a frame a `source` instead of a value:
252
249
  length: 7
253
250
  trigger: on_request
254
251
  signals:
255
- - {name: map_major, encoding: raw, byte: 0, byte_length: 1, source: map_version.major}
256
- - {name: map_minor, encoding: raw, byte: 1, byte_length: 1, source: map_version.minor}
257
- - {name: map_patch, encoding: raw, byte: 2, byte_length: 1, source: map_version.patch}
258
- - {name: map_layout_crc, encoding: raw, byte: 3, byte_length: 4, source: layout_crc32}
252
+ - {name: map_major, encoding: number, byte: 0, byte_length: 1, source: map_version.major}
253
+ - {name: map_minor, encoding: number, byte: 1, byte_length: 1, source: map_version.minor}
254
+ - {name: map_patch, encoding: number, byte: 2, byte_length: 1, source: map_version.patch}
255
+ - {name: map_layout_crc, encoding: number, byte: 3, byte_length: 4, source: layout_crc32}
259
256
  ```
260
257
 
261
258
  | `source` | Value |
@@ -280,13 +277,13 @@ A value that does not fit in the signal, a version that is not numeric, or `init
280
277
 
281
278
  #### Floating point
282
279
 
283
- `encoding: float` is IEEE 754, 32 bits (default) or 64 bits (`bit_length: 64`), in either byte order.
284
- `factor` and `offset` are allowed. In C the field is a `float` or `double`; in DBC the signal is
280
+ `encoding: number` with `representation: float` is IEEE 754, 32 bits (default) or 64 bits
281
+ (`bit_length: 64`), in either byte order. `factor` and `offset` are allowed. In C the field is a `float` or `double`; in DBC the signal is
285
282
  marked as float.
286
283
 
287
284
  ```yaml
288
- - {name: pack_voltage, byte: 0, encoding: float, unit: V}
289
- - {name: timestamp, byte: 0, encoding: float, bit_length: 64, unit: s}
285
+ - {name: pack_voltage, byte: 0, encoding: number, representation: float, unit: V}
286
+ - {name: timestamp, byte: 0, encoding: number, representation: float, bit_length: 64, unit: s}
290
287
  ```
291
288
 
292
289
  #### Shorthand position
@@ -306,7 +303,7 @@ Both notations are valid. The editors (the forms and bit layouts of the web edit
306
303
  `mapcan import dbc`) write one of them, whichever field or drag changed the position: the shorthand
307
304
  when the signal takes whole bytes from a byte boundary (`byte` + `byte_length`) or fits in one byte
308
305
  (`byte` + `bit` + `bit_length`), and `start_bit` + `bit_length` otherwise. A length the encoding
309
- implies (32 bits of a `float`, 1 bit of a `flag`) and `bit: 0` stay omitted where they were.
306
+ implies (32 bits of a float) and `bit: 0` stay omitted where they were.
310
307
  `mapcan fmt --check` notes the positions written otherwise, without failing.
311
308
 
312
309
  #### Big-endian
@@ -360,7 +357,7 @@ buses:
360
357
  cycle_ms: 20
361
358
  receivers: [cluster]
362
359
  signals:
363
- - {name: engine_speed, encoding: scaled, byte: 3, byte_length: 2, factor: 0.125, unit: rpm, invalid_raw: 0xFFFF}
360
+ - {name: engine_speed, encoding: number, byte: 3, byte_length: 2, factor: 0.125, unit: rpm, invalid_raw: 0xFFFF}
364
361
  - name: cluster
365
362
  address: 0x17
366
363
  - name: diag
@@ -386,11 +383,11 @@ and unpacks the whole payload; splitting it into packets is the job of the J1939
386
383
  length: 20 # 3 TP.DT packets + BAM
387
384
  trigger: on_request
388
385
  signals:
389
- - {name: software_id, encoding: bytes, spn: 234, byte: 0, byte_length: 20}
386
+ - {name: software_id, encoding: bytes, charset: ascii, terminator: "*", spn: 234, byte: 0, byte_length: 20}
390
387
  ```
391
388
 
392
- A signal longer than 64 bits can only be a byte array (`encoding: bytes`, little-endian, starting
393
- at a byte boundary).
389
+ A signal longer than 64 bits can only be bytes (`encoding: bytes`, a byte array or text,
390
+ little-endian, starting at a byte boundary).
394
391
 
395
392
  ### Object dictionary and EDS
396
393
 
@@ -409,8 +406,8 @@ signals are filled with dummy objects.
409
406
  length: 6
410
407
  cycle_ms: 10
411
408
  signals:
412
- - {name: statusword, encoding: raw, index: 0x6041, byte: 0, byte_length: 2}
413
- - {name: actual_velocity, encoding: scaled, index: 0x606C, byte: 2, byte_length: 4, representation: twos_complement, unit: rpm}
409
+ - {name: statusword, encoding: number, index: 0x6041, byte: 0, byte_length: 2}
410
+ - {name: actual_velocity, encoding: number, index: 0x606C, byte: 2, byte_length: 4, representation: twos_complement, unit: rpm}
414
411
  ```
415
412
 
416
413
  The object's data type is the smallest standard type that holds the signal (`UNSIGNED16`,
@@ -430,10 +427,10 @@ For `sdo_rx`/`sdo_tx` frames you can describe expedited SDO exchanges instead of
430
427
  command: 0x2B # CCS: write 2 bytes
431
428
  index: 0x4010
432
429
  subindex: 0x01
433
- value: {name: alarm_resistance, encoding: scaled, bit_length: 16, unit: kOhm}
430
+ value: {name: alarm_resistance, encoding: number, bit_length: 16, unit: kOhm}
434
431
  ```
435
432
 
436
- The value's `encoding` (`enum`, `scaled` or `raw`) and `bit_length` (8, 16, 24 or 32) are required.
433
+ The value's `encoding` (`number` or `enum`) and `bit_length` (8, 16, 24 or 32) are required.
437
434
 
438
435
  mapcan builds the frame layout itself: byte 0 is the command, bytes 1–2 the index
439
436
  (little-endian), byte 3 the subindex (the multiplexer selector when all exchanges share one
@@ -533,7 +530,7 @@ for example the buses and devices shared by several machines:
533
530
 
534
531
  ```yaml
535
532
  # vehicle.yaml
536
- mapcan: 1
533
+ mapcan: 2
537
534
  include: [powertrain.yaml]
538
535
  document: {title: Vehicle, language: en}
539
536
  buses:
@@ -544,8 +541,8 @@ buses:
544
541
 
545
542
  ```yaml
546
543
  # powertrain.yaml
547
- # yaml-language-server: $schema=https://ordu1453.github.io/mapcan/schema/part-v1.json
548
- mapcan: 1
544
+ # yaml-language-server: $schema=https://ordu1453.github.io/mapcan/schema/part-v2.json
545
+ mapcan: 2
549
546
  part_of: vehicle.yaml # the map that includes this file
550
547
  value_tables: {...}
551
548
  buses:
@@ -558,7 +555,7 @@ buses:
558
555
 
559
556
  See [examples/tractor/](../examples/tractor/tractor.yaml) for a complete map in two files.
560
557
 
561
- An included file starts with `mapcan: 1` (the same format version as the map) and `part_of`:
558
+ An included file starts with `mapcan: 2` (the same format version as the map) and `part_of`:
562
559
  the path of the map that includes it, relative to the included file. A file that names another
563
560
  map, or another format version, is an error (`include`); a file without these two keys still
564
561
  loads, with the warning `include-part-of`. On the command line such a file is reported as a part
@@ -567,7 +564,7 @@ of its map: validate the map instead. In VS Code it is checked as a part of the
567
564
  whole map, and Go to Definition leads to devices of the main file. Its nodes are edited as text for
568
565
  now; the forms show them read-only. Its schema is
569
566
  [`schema/mapcan-part.schema.json`](../schema/mapcan-part.schema.json)
570
- (`mapcan schema --part`), published at `https://ordu1453.github.io/mapcan/schema/part-v1.json`.
567
+ (`mapcan schema --part`), published at `https://ordu1453.github.io/mapcan/schema/part-v2.json`.
571
568
 
572
569
  Besides them an included file may contain only `buses` and `value_tables`. A bus that the main
573
570
  file (or an earlier included file) already describes can only get more `devices` and `frames`;
@@ -590,22 +587,28 @@ Included devices can be chosen as senders and receivers of the main file's frame
590
587
 
591
588
  ## Versioning and compatibility
592
589
 
593
- `mapcan: 1` is the version of the format, not of the program. What it promises:
590
+ `mapcan: 2` is the version of the format, not of the program. What it promises:
594
591
 
595
592
  - **Additions keep the version.** New optional fields, new values of an enumeration and new rules
596
- keep `mapcan: 1`. Every map that was valid stays valid; a map that uses a new field needs a mapcan
593
+ keep `mapcan: 2`. Every map that was valid stays valid; a map that uses a new field needs a mapcan
597
594
  that knows it (see [the format changelog](format-changelog.md)).
598
595
  - **Renames keep the version too.** When a field gets a clearer name (or several fields become one, or
599
596
  fields move into a nested block),
600
- the former spelling stays accepted for the whole of version 1. It is read as the current one with
597
+ the former spelling stays accepted for the whole of the version. It is read as the current one with
601
598
  the warning `deprecated-key`; messages about the field still point at what is written. The
602
599
  editors show and write the current name: editing such a field renames it in place, keeping its
603
600
  position and comment. A map that has both names is an error.
604
601
  - **`mapcan migrate FILE…`** rewrites the former names in the map and its included files, keeping
605
602
  comments and layout; `mapcan migrate --check` exits 1 if anything is left (for CI). In VS Code the
606
603
  quick fix of `deprecated-key` does the same.
607
- - **Removing a field or changing its meaning** would need `mapcan: 2`, read side by side with
608
- version 1 and converted by `mapcan migrate`. None is planned.
604
+ - **Removing a field or a value, or changing its meaning, needs a new version**, read side by side with
605
+ the previous one and converted by `mapcan migrate`. Version 2 removed the signal encodings `raw`,
606
+ `scaled`, `float`, `flag` and `string` (see the table below).
607
+ - **Version 1 is still read.** A map with `mapcan: 1` (and its included files, also `mapcan: 1`) loads
608
+ as version 2 would read it, with the note `format-v1`: its encodings are converted as the table below
609
+ shows, and generated code, DBC and documents are those of the converted map. `mapcan migrate`
610
+ rewrites the files in version 2 (also the `$schema` line, to `v2.json`); in VS Code the quick fix of
611
+ `format-v1` rewrites the file open. Version 2 does not read the encodings of version 1.
609
612
  - **Rule codes do not change**, so `lint.disable` and `--disable` keep working: `dlc-range`, for
610
613
  example, keeps its code after `dlc` became `length`.
611
614
 
@@ -619,6 +622,19 @@ Included devices can be chosen as senders and receivers of the main file's frame
619
622
  | frame `type` (`raw`: omitted) | `canopen` | 0.21 |
620
623
  | signal `invalid` | `invalid_raw` | 0.21 |
621
624
 
625
+ Version 1 → version 2 (mapcan 0.24, #140):
626
+
627
+ | Version 1 | Version 2 |
628
+ |---|---|
629
+ | `encoding: raw`, `encoding: scaled` (signal or SDO value) | `encoding: number` |
630
+ | `encoding: float` | `encoding: number` + `representation: float` |
631
+ | `encoding: flag` | `encoding: enum` + `bit_length: 1` when no length is written |
632
+ | `encoding: string` | `encoding: bytes` + `charset: ascii` when no `charset` is written |
633
+
634
+ An `enum` of version 1 with `representation` (signed values) or `invalid_raw` has no equivalent in version 2: it
635
+ is read as an `enum` and reported (`encoding-field`), to be rewritten by hand (a `number`, or the "no data"
636
+ values moved into the value table).
637
+
622
638
  ## Canonical layout
623
639
 
624
640
  The same map can be written with the keys in any order. `mapcan fmt FILE…` writes the keys of every
@@ -661,9 +677,10 @@ turned off with `--disable CODE` or `lint.disable`.
661
677
  | `number-comma` | error | Number written with a decimal comma (0,1 instead of 0.1) |
662
678
  | `number-cyrillic-x` | error | Cyrillic “х” in a hexadecimal number |
663
679
  | `number-quoted` | warning | Number written as a quoted string |
680
+ | `format-v1` | info | A map of format version 1: still read, `mapcan migrate` rewrites it in version 2. See [Versioning and compatibility](#versioning-and-compatibility) |
664
681
  | `deprecated-key` | warning | A field under its former name: still read, `mapcan migrate` rewrites it (an error when the current name is set too). See [Versioning and compatibility](#versioning-and-compatibility) |
665
682
  | `include` | error | Included file not found, it has keys that cannot be included, or it names another map (`part_of`) or format version |
666
- | `include-part-of` | warning | Included file does not start with `mapcan: 1` and `part_of` |
683
+ | `include-part-of` | warning | Included file does not start with `mapcan` and `part_of` |
667
684
  | `value-table` | error | `values` names a table that is not in `value_tables` |
668
685
 
669
686
  ### Names
@@ -742,9 +759,9 @@ turned off with `--disable CODE` or `lint.disable`.
742
759
  |---|---|---|
743
760
  | `signal-out-of-frame` | error | Signal extends beyond the frame length |
744
761
  | `bit-overlap` | error | Overlapping signals (multiplexing-aware) |
745
- | `float-length` | error | A float signal must be 32 or 64 bits |
746
- | `signal-length` | error | A signal longer than 64 bits that is not an aligned byte array |
747
- | `string-field` | error | A `string` that does not start at a byte boundary or take whole bytes, or a `terminator` that is not one byte |
762
+ | `float-length` | error | A floating-point signal must be 32 or 64 bits |
763
+ | `signal-length` | error | A signal longer than 64 bits that is not aligned bytes |
764
+ | `string-field` | error | Text (`bytes` with `charset`) that does not start at a byte boundary or take whole bytes, or a `terminator` that is not one byte |
748
765
 
749
766
  ### Values and conversion
750
767
 
@@ -768,7 +785,6 @@ turned off with `--disable CODE` or `lint.disable`.
768
785
  | `encoding-field` | error | A field is set that does not apply to the signal's encoding (see [Encodings](#encodings)) |
769
786
  | `flag-out-of-field` | error | Flag extends beyond the bit field |
770
787
  | `flag-overlap` | error | Flags overlap inside the bit field |
771
- | `flag-length` | warning | Flag signal longer than 1 bit |
772
788
 
773
789
  ### Multiplexing
774
790
 
@@ -119,7 +119,7 @@ The profile records who made which changes:
119
119
  | **Properties** | The form for the selected node. A value is applied on Enter or when the field loses focus. Validation messages appear under the field. The form shows only the fields that apply to the node: a frame on a CANopen bus hides **Direction** when its type sets it, an RX frame has no **Receivers** (the device itself receives it), and **Receivers** appear only when there are other devices on the bus. There is no field for the sender: it follows from where the frame is written (its device, or outside the map for a frame of the bus); the master that sends a CANopen RX function written at its node stays `sender` in the YAML. A CANopen service frame (NMT, Heartbeat, TIME, SDO) has no **Length** field: its length comes from its CANopen function. A field that is set in the YAML or has a validation message stays visible so it can be fixed. Elsewhere in the editor (page headings, breadcrumbs, frame, device and bus lists, sender and receivers) objects are shown by their names, with the identifier next to them in grey. Text fields (names, descriptions) are edited in the document language; translations into the other language written in the YAML are kept. The **?** next to a field label explains the setting, why it matters and which values are allowed (shown on hover; click to pin, Esc to close). |
120
120
  | **Frame layout** | The bit map of the frame: rows are bytes, columns are bits 7…0. Cells are labelled with signal names and the flags of bit fields. |
121
121
  | **Frames** | The frame list on a bus or device page; ✕ in a row deletes the frame. **+ Frame** adds a frame to the list without changing the selected node. |
122
- | **Devices** | The device list on a bus page. **+ Device** adds a device to the file that describes the bus. **+ Device in a new file** asks for a file, `devices/<name>.yaml` relative to the map by default, makes it with the device (`mapcan: 1`, `part_of` and the bus by name; the device is named after the file when that name is a free identifier on the bus) and adds it to `include` of the map: one undo step, and **Save** writes both files. A map edited by several people can keep one file per device this way, so changes to different devices do not meet in one file. Deleting such a device deletes its file, left empty, and its line of `include` (on Save; Ctrl+Z brings them back). |
122
+ | **Devices** | The device list on a bus page. **+ Device** adds a device to the file that describes the bus. **+ Device in a new file** asks for a file, `devices/<name>.yaml` relative to the map by default, makes it with the device (`mapcan: 2`, `part_of` and the bus by name; the device is named after the file when that name is a free identifier on the bus) and adds it to `include` of the map: one undo step, and **Save** writes both files. A map edited by several people can keep one file per device this way, so changes to different devices do not meet in one file. Deleting such a device deletes its file, left empty, and its line of `include` (on Save; Ctrl+Z brings them back). |
123
123
  | **Receives** | On a device page: the bus frames the device receives (its own RX frames and other devices' frames that list it as a receiver), with their senders. Below it, **Transmits frames of other devices** lists the frames it sends on behalf of other devices (`sender`). Both are computed from the frames; click a row to jump to the frame. On a frame page, **Receivers** are toggled on and off; renaming a device updates them and `sender`. ✕ in a row of another device's frame removes the device from its receivers. On an RX frame, **Frame of another device** picks a frame that is already described at its sender: the device is added to that frame's receivers and its own copy is removed (Ctrl+Z undoes it). The `rx-duplicate` message on such a frame has a button that does the same. |
124
124
  | **Values / Flags** | Enum and bit field tables: value (decimal or `0x…`), name, description. **+ Flag** adds a row without leaving the signal page. |
125
125
  | **Validation** (bottom) | The same rules as `mapcan validate`. Click a message to jump to the node (or, on the YAML tab, to the line). While the YAML tab holds text that is not applied yet (for example, with a syntax error), the panel lists the messages for that text and marks them **YAML text not applied**. |
@@ -0,0 +1,113 @@
1
+ # yaml-language-server: $schema=../schema/mapcan.schema.json
2
+ # CANopen drive: PDO signals mapped to dictionary objects (CiA 402 and manufacturer),
3
+ # enough for `mapcan export eds` to write the drive's EDS file.
4
+
5
+ mapcan: 2
6
+
7
+ document:
8
+ title: CANopen drive
9
+ version: 0.1.0
10
+ organization: Example Motors
11
+ language: en
12
+
13
+ buses:
14
+ - name: drive_bus
15
+ title: Drive bus
16
+ protocol: canopen
17
+ bitrate: 500000
18
+ devices:
19
+ - name: controller
20
+ title: Vehicle controller
21
+ node_id: 0x01
22
+
23
+ - name: drive
24
+ title: Traction drive
25
+ node_id: 0x05
26
+ frames:
27
+ - name: drive_status # TPDO1, ID 0x185
28
+ canopen: pdo_tx1
29
+ length: 6
30
+ cycle_ms: 10
31
+ receivers: [controller]
32
+ signals:
33
+ - name: statusword
34
+ title: Statusword
35
+ description: CiA 402 statusword
36
+ encoding: number
37
+ byte: 0
38
+ byte_length: 2
39
+ index: 0x6041
40
+ - name: actual_velocity
41
+ title: Velocity actual value
42
+ description: Motor speed
43
+ encoding: number
44
+ byte: 2
45
+ byte_length: 4
46
+ representation: twos_complement
47
+ unit: rpm
48
+ index: 0x606C
49
+
50
+ - name: drive_measurements # TPDO2, ID 0x285
51
+ canopen: pdo_tx2
52
+ length: 4
53
+ cycle_ms: 100
54
+ receivers: [controller]
55
+ signals:
56
+ - name: motor_temp
57
+ title: Motor temperature
58
+ description: Motor winding temperature
59
+ encoding: number
60
+ byte: 0
61
+ byte_length: 1
62
+ offset: -40
63
+ unit: °C
64
+ index: 0x2100
65
+ subindex: 1
66
+ - name: inverter_temp
67
+ title: Inverter temperature
68
+ description: Power stage temperature
69
+ encoding: number
70
+ byte: 1
71
+ byte_length: 1
72
+ offset: -40
73
+ unit: °C
74
+ index: 0x2100
75
+ subindex: 2
76
+ - name: dc_voltage
77
+ title: DC link voltage
78
+ description: DC link voltage
79
+ encoding: number
80
+ byte: 2
81
+ byte_length: 2
82
+ factor: 0.1
83
+ unit: V
84
+ index: 0x2100
85
+ subindex: 3
86
+
87
+ - name: drive_command # RPDO1, ID 0x205, sent by the controller
88
+ canopen: pdo_rx1
89
+ length: 6
90
+ cycle_ms: 10
91
+ sender: controller
92
+ signals:
93
+ - name: controlword
94
+ title: Controlword
95
+ description: CiA 402 controlword
96
+ encoding: number
97
+ byte: 0
98
+ byte_length: 2
99
+ index: 0x6040
100
+ - name: target_velocity
101
+ title: Target velocity
102
+ description: Requested motor speed
103
+ encoding: number
104
+ byte: 2
105
+ byte_length: 4
106
+ representation: twos_complement
107
+ unit: rpm
108
+ index: 0x60FF
109
+
110
+ - name: drive_heartbeat
111
+ canopen: heartbeat
112
+ cycle_ms: 500
113
+ receivers: [controller]