mirror of
https://github.com/andreili/katapult.git
synced 2025-08-23 19:34:06 +02:00
canbus: add a clear node id admin command
This broadcasts a command to clear the id for all nodes running the bootloader, which should prevent ID collisions. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
26c89e8b0e
commit
1e79868003
@ -93,6 +93,7 @@ canboot_sendf(uint8_t* data, uint16_t size)
|
||||
// Available commands and responses
|
||||
#define CANBUS_CMD_QUERY_UNASSIGNED 0x00
|
||||
#define CANBUS_CMD_SET_NODEID 0x01
|
||||
#define CANBUS_CMD_CLEAR_NODE_ID 0x02
|
||||
#define CANBUS_RESP_NEED_NODEID 0x20
|
||||
|
||||
// Helper to verify a UUID in a command matches this chip's UUID
|
||||
@ -124,6 +125,13 @@ can_process_query_unassigned(uint32_t id, uint32_t len, uint8_t *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
can_process_clear_node_id(void)
|
||||
{
|
||||
canbus_assigned_id = 0;
|
||||
canbus_set_filter(canbus_assigned_id);
|
||||
}
|
||||
|
||||
static void
|
||||
can_id_conflict(void)
|
||||
{
|
||||
@ -161,6 +169,9 @@ can_process(uint32_t id, uint32_t len, uint8_t *data)
|
||||
case CANBUS_CMD_SET_NODEID:
|
||||
can_process_set_nodeid(id, len, data);
|
||||
break;
|
||||
case CANBUS_CMD_CLEAR_NODE_ID:
|
||||
can_process_clear_node_id();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user