+
+
+ if ((frame->can_id & ~0x1f) != 0x420) {
+ printf("Skipping non-NM from CAN ID %03x\n", frame->can_id);
+ return;
+ }
+
+ printf("Received NM frame from CAN ID %03x\n", frame->can_id);
+
+ id = frame->can_id & 0x1f;
+ next = frame->data[0];
+ state = frame->data[1];
+
+ nm->nodes[id].next = next;
+ nm->nodes[id].state = state;
+
+ nm_dump_all(nm);
+
+ /*
+ switch (state) {
+ case 01:
+ if (frame.data[0] == my_id) {
+ struct can_frame txframe = {.can_id = base_id + next_id,
+ .can_dlc = 8,
+ .data = {next_id, 01, 00, 00, 00, 00, 00, 00},
+ };
+ can_tx(socket, &txframe);
+ }
+ break;
+ case 02:
+ if (ignore_counter > 0) {
+ ignore_counter--;
+ break;
+ }
+ if (next_id <= my_id
+ ? frame.can_id - base_id < next_id
+ : next_id == my_id || frame.can_id - base_id < next_id) {
+ next_id = frame.can_id - base_id;
+
+ struct can_frame txframe = {.can_id = base_id + my_id,
+ .can_dlc = 8,
+ .data = {my_id, 02, 01, 04, 00, 04, 00, 00},
+ };
+ can_tx(socket, &txframe);
+ }
+ break;
+ }
+ */