mattdibi / redox-w-firmware

Firmware for nordic MCUs used in the Redox wireless keyboard
MIT License
73 stars 42 forks source link

Is the wrong data payload being put into fifo 1 ? #4

Closed LucidityCrash closed 5 years ago

LucidityCrash commented 5 years ago

https://github.com/mattdibi/redox-w-firmware/blob/b6124a61e6cb8791933c03f6c74f52ed0cbf4181/redox-w-receiver-basic/main.c#L103

Shouldn't this be nrf_gzll_add_packet_to_tx_fifo(1, datapayloadright, TX_PAYLOAD_LENGTH); ?

mattdibi commented 5 years ago

Hi, good question! Looking at that part of the code I would say the same but I looked through the various Mitosis implementation and it stays like that. Unfortunately I left my Redox wireless at work and I cannot test your suggestion right now. I'll try to give it a shot in the following days...

LucidityCrash commented 5 years ago

Indeed, and given that it is only used right at the beginning of main, and at that time both data_payload_left and data_payload_right are the same (and empty), and only on line 288 is an ack sent and that uses the pipe variable and the ack payload, I'm not exactly sure what the 2 lines 102, and 103 actually do.

mattdibi commented 5 years ago

Finally I had time to test it... sorry for the delay.

I updated only the receiver code with the following:

diff --git a/redox-w-receiver-basic/main.c b/redox-w-receiver-basic/main.c
index f12287b..82fc500 100644
--- a/redox-w-receiver-basic/main.c
+++ b/redox-w-receiver-basic/main.c
@@ -100,7 +100,7 @@ int main(void)
     // Load data into TX queue
     ack_payload[0] = 0x55;
     nrf_gzll_add_packet_to_tx_fifo(0, data_payload_left, TX_PAYLOAD_LENGTH);
-    nrf_gzll_add_packet_to_tx_fifo(1, data_payload_left, TX_PAYLOAD_LENGTH);
+    nrf_gzll_add_parcket_to_tx_fifo(1, data_payload_right, TX_PAYLOAD_LENGTH);

     // Enable Gazell to start sending over the air
     nrf_gzll_enable();

and it works exactly the same. I'll update the code leaving this correction in.