First link sending to master
This commit is contained in:
parent
82b5037b9d
commit
c28e19c546
2 changed files with 42 additions and 12 deletions
|
@ -32,14 +32,24 @@ void router_set_master(bool master) {
|
|||
}
|
||||
|
||||
void route_incoming_frame(uint8_t link, uint8_t* data, uint16_t size){
|
||||
if (data[size-1] & 1) {
|
||||
transport_recv_frame(0, data, size - 1);
|
||||
if (is_master) {
|
||||
transport_recv_frame(1, data, size);
|
||||
}
|
||||
else {
|
||||
if (data[size-1] & 1) {
|
||||
transport_recv_frame(0, data, size - 1);
|
||||
}
|
||||
data[size-1] >>= 1;
|
||||
validator_send_frame(DOWN_LINK, data, size);
|
||||
}
|
||||
data[size-1] >>= 1;
|
||||
validator_send_frame(DOWN_LINK, data, size);
|
||||
}
|
||||
|
||||
void router_send_frame(uint8_t destination, uint8_t* data, uint16_t size) {
|
||||
data[size] = destination;
|
||||
validator_send_frame(DOWN_LINK, data, size + 1);
|
||||
if (destination == 0) {
|
||||
validator_send_frame(UP_LINK, data, size);
|
||||
}
|
||||
else {
|
||||
data[size] = destination;
|
||||
validator_send_frame(DOWN_LINK, data, size + 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue