I'm struggling to create a I2C protocol

Hi, I'm working on a project that is kind of a modular machine, there is a master device to control other devices, I'm trying to create a protocol that when a device is connected, the master device will send a message that the slave device will answer with another message, so the master device can know what device it is, up to here I'm good, but then I need to ask again for some data bytes to send it elsewhere, but I can't get it to work, here are both codes.

Mega2560.ino (5.3 KB)

Clock-ATMega328.ino (11.9 KB)

There is almost no internal documentation in your code. Just a couple of single line comments... that makes it a lot of work to understand. You have a lot of in-line statements that should be converted to arrays.