CAN actions: can.json's "actions" ({name, node, index, subindex, data: 1–4 bytes hex}) are SDO expedited downloads, a button beside their node on /can.html (confirm first, the result in the status line) — POST /api/can/actions/:n (login, 409 with no config, 404 unknown, 502 on an SDO error), GET /api/can lists them; first one: Level IMU on node 0x21 (0x2022:1 ← 01)

This commit is contained in:
randy committed 2026-12-03 01:29:12 +01:00
1 parent 0a5548cd8f
commit 97d1bda09c
6 files changed
+77 -7

No files matched your search

+8
View File
@@ -85,6 +85,14 @@ class CanDiscoveryTest < Minitest::Test
assert_equal "\x01", node.od[[0x20E2, 1]]
end
def test_an_action_writes_its_bytes_and_rejects_bad_data
node = FakeNode.new(0x21, {})
action = Maptool::Can::Sdo::Action.parse("name" => "Level IMU", "node" => 33, "index" => "0x2022", "subindex" => 1, "data" => "01")
action.run(Maptool::Can::Sdo.new(node))
assert_equal "\x01".b, node.od[[0x2022, 1]]
assert_raises(ArgumentError) { Maptool::Can::Sdo::Action.parse("name" => "x", "node" => 1, "index" => 1, "data" => "0102030405") }
end
def test_a_node_described_decodes_its_own_tpdos
sdo = Maptool::Can::Sdo.new(FakeNode.new(0x21, GNSS_OD.dup))
description = Maptool::Can::Discovery.describe(sdo, 0x21, aliases: { "XIAO STM32C5 2.Latitude" => "gnss.lat" })