ecc1 / gnarl

GNARL is Not A RileyLink
MIT License
30 stars 39 forks source link

GetPacket command not interruptible #8

Closed trixing closed 4 years ago

trixing commented 4 years ago

I noticed a problem with gnarl and a 754 pump with Loop. The problem is that Loop has a feature called "idlelistening" where it waits for mysentry packets. These are a GetPacket command with a timeout of 4 minutes. This calls - from what I can tell - a pretty uninterruptible "receive" command (in rfm95.c). Subsequent commands send by loop will all timeout, eventually fill up the queue, and reboot gnarl. As a result communication is a bit on/off and not very reliable in general.

My understanding is that in the rileylink firmware any additional command will cancel the ongoing get_packet (https://github.com/ps2/subg_rfspy/blob/5d1d7fb912e5334ee3388d6e6ee40805979b610d/radio.c#L366) . The code in the phone will re-issue the idlelisten command.

What I have tried to fix it is to do a

My understanding is that rfspy_command is running on the ble task and receive is on the gnarl_loop task.

My try to fix this was to do a xTaskNotifyGive(gnarl_loop_handle) in rfspy_command (gnarl_looop_handle is the value from xTaskCreate).

Here is a typical log file

I (2169) GNARL: CmdGetPacket D (2169) GNARL: get_packet: listen_channel 0 timeout_ms 240000 D (2169) GNARL: rfspy_command 3, queue length 0 D (60969) GNARL: timer tick 1 D (60969) GNARL: GAP event 13 D (60969) GNARL: notify for timer tick data_access: received 7 bytes: 06 03 00 00 03 A9 80 D (61359) GNARL: rfspy_command 3, queue length 1 data_access: received 2 bytes: 01 0D D (61419) GNARL: rfspy_command 13, queue length 2 data_access: received 26 bytes: 19 05 00 00 00 00 00 00 00 00 C8 01 00 00 A9 68 E5 96 3D 16 68 D5 55 6A 50 00 D (63489) GNARL: rfspy_command 5, queue length 3 data_access: received 26 bytes: 19 05 00 FF 00 00 00 00 00 2E E0 00 00 00 A9 68 E5 96 3D 16 94 D5 55 68 B0 00 D (66009) GNARL: rfspy_command 5, queue length 4 data_access: received 2 bytes: 01 0D D (85869) GNARL: rfspy_command 13, queue length 5 data_access: received 26 bytes: 19 05 00 00 00 00 00 00 00 00 C8 01 00 00 A9 68 E5 96 3D 16 68 D5 55 6A 50 00 D (87999) GNARL: rfspy_command 5, queue length 6 data_access: received 122 bytes: 79 05 00 00 00 00 00 00 00 00 C8 03 00 00 A9 68 E5 96 3D 16 94 D5 72 57 15 71 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 67 10 00 D (90549) GNARL: rfspy_command 5, queue length 7 data_access: received 26 bytes: 19 05 00 00 00 00 00 00 00 00 C8 01 00 00 A9 68 E5 96 3D 16 68 D5 55 6A 50 00 D (93669) GNARL: rfspy_command 5, queue length 8 data_access: received 122 bytes: 79 05 00 00 00 00 00 00 00 00 C8 03 00 00 A9 68 E5 96 3D 16 94 D5 72 57 15 71 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 67 10 00 D (96179) GNARL: rfspy_command 5, queue length 9 data_access: received 26 bytes: 19 05 00 00 00 00 00 00 00 00 C8 01 00 00 A9 68 E5 96 3D 16 68 D5 55 6A 50 00 D (99279) GNARL: rfspy_command 5, queue length 10 data_access: received 122 bytes: 79 05 00 00 00 00 00 00 00 00 C8 03 00 00 A9 68 E5 96 3D 16 94 D5 72 57 15 71 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 67 10 00 E (101819) GNARL: rfspy_command: cannot queue request for command 5 data_access: received 2 bytes: 01 0D E (104949) GNARL: rfspy_command: cannot queue request for command 13 data_access: received 4 bytes: 03 06 0B 77

ecc1 commented 4 years ago

Closed with ea646d21ab998622716f648c80310933aba1e3bd