Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Race Timer Backpack #114

Merged
merged 10 commits into from
Apr 28, 2024
Merged

Generic Race Timer Backpack #114

merged 10 commits into from
Apr 28, 2024

Conversation

i-am-grub
Copy link
Contributor

@i-am-grub i-am-grub commented Nov 18, 2023

Adds in a backpack target for a generic race timer. It has the following features:

  • Ability to configure itself for sending messages to multiple pilot's backpacks as directed from the connected race timer.
  • Ability to start and stop races by monitoring for the MSP_ELRS_BACKPACK_SET_RECORDING_STATE only from the bound backpack (assuming race director's backpack)

The backpack was built to pair with this RotorHazard Plugin for sending OSD messages throughout the race to pilots with hardware to support it (HDZero goggles).

Has only been tested with the ESP32 chipset.

@i-am-grub
Copy link
Contributor Author

FYI, I wasn't sure what to set TIMER_BACKPACK_CONFIG_MAGIC and TIMER_BACKPACK_CONFIG_VERSION to, so I just used the TX values.

lib/config/config.h Outdated Show resolved Hide resolved
lib/config/config.cpp Outdated Show resolved Hide resolved
lib/config/config.cpp Outdated Show resolved Hide resolved
src/Timer_main.cpp Outdated Show resolved Hide resolved
@i-am-grub
Copy link
Contributor Author

I suppose the backpack should still have the ability to send messages to the bound backpack by default. Should be a quick fix on my end.

@i-am-grub i-am-grub marked this pull request as draft November 21, 2023 03:03
@i-am-grub i-am-grub marked this pull request as ready for review November 21, 2023 03:28
@lesharodin
Copy link

Could we have esp82 target too?
I tested osd code on it, it works well #96

@i-am-grub i-am-grub marked this pull request as draft November 21, 2023 21:11
- more generic targets
- rotorhazard targets
- registerPeer function
@i-am-grub i-am-grub marked this pull request as ready for review January 3, 2024 04:11
@i-am-grub i-am-grub deleted the branch ExpressLRS:master January 3, 2024 06:41
@i-am-grub i-am-grub closed this Jan 3, 2024
@i-am-grub i-am-grub deleted the master branch January 3, 2024 06:41
@i-am-grub i-am-grub restored the master branch January 3, 2024 06:47
@i-am-grub i-am-grub reopened this Jan 3, 2024
@i-am-grub
Copy link
Contributor Author

There seems to be an issue that I haven't been able to pinpoint down where there are lost packets between the timer backpack and the HDZero goggle's backpack. This will often result in OSD messages not showing up or being cleared on the display. I'm assuming this issue has to do with the rapid rate at which I've been sending packets over the backpack (multiple messages to multiple pilots as fast as possible).

A few different ideas I've tried:

  • Slowing down the send rate helped to a degree but never solved the issue. I also tried adding in a queue for received messages on the goggles allowing for the goggles to process the received packet as a lower priority task.
  • Taking the queue idea from the previous idea, I added in a condition for the packet to only be processed when the send buffer was empty. This appeared to helped quite a bit, but didn't solve the issue.
  • Repeated attempts to send the packet from the timer bp determined by the status of the esp send callback function. Also seemed to help to a degree, but never enough to completely solve the problem

I'm open to trying any other suggested ideas

@pkendall64
Copy link
Contributor

There seems to be an issue that I haven't been able to pinpoint down where there are lost packets between the timer backpack and the HDZero goggle's backpack. This will often result in OSD messages not showing up or being cleared on the display. I'm assuming this issue has to do with the rapid rate at which I've been sending packets over the backpack (multiple messages to multiple pilots as fast as possible).

A few different ideas I've tried:

  • Slowing down the send rate helped to a degree but never solved the issue. I also tried adding in a queue for received messages on the goggles allowing for the goggles to process the received packet as a lower priority task.
  • Taking the queue idea from the previous idea, I added in a condition for the packet to only be processed when the send buffer was empty. This appeared to helped quite a bit, but didn't solve the issue.
  • Repeated attempts to send the packet from the timer bp determined by the status of the esp send callback function. Also seemed to help to a degree, but never enough to completely solve the problem

I'm open to trying any other suggested ideas

I'm thinking we could change the backpacks so you can send more than a single MSP in an ESPNow packet. That would certainly be beneficial for this use case as you could send all the MSP displayport messages to update the screen in one packet. Bearing in mind that the ESPNow packets are limited to 256 bytes.

- Add recieving queues for timer and HDZero Gogggles
- Switched Timer queue(s) to FreeRTOS
- Checking incoming serial buffer before reset
- Reset ESP32 only when queues are empty
- Synchronization of esp32 multi-core actions (wifi & main loop)
@i-am-grub
Copy link
Contributor Author

i-am-grub commented Apr 4, 2024

These changes seem promising on the bench - field results to come this weekend.

Just a heads up, there is a slight modification to the VRx backpack to allow the HDZero goggle backpack to receive and store messages faster than the goggles can processes them.

@i-am-grub
Copy link
Contributor Author

i-am-grub commented Apr 9, 2024

Testing this past weekend went well. After reviewing the pilot's footage, I would estimate that 98% of the messages are getting through consistently now.

A few ideas as to why its not at 100%

  • General RF interference
  • Maybe the timer's backpack was rebooting when the messages didn't go through. I might try switching it to only reboot when requested to turn on the WiFi
  • The send message callback function on the timer's backpack isn't working properly due to the transmitter's backpack having the same MAC address. When a message is sent from the timer, it currently gets sent all devices with the same MAC address. It would still be considered a successful send by the timer if the transmitter received the message and the goggles didn't.

An interesting (and backwards compatibility breaking) change would be to use the first five octets of the MAC address come from the bind phrase, but the last octet would then be determined by device type (transmitter: 1, Vrx: 2, timer: 3). For simplicity, the transmitter could be set to only send to the vrx and vice versa for the vrx to the transmitter, but the timer would then be able to selectively target one or the other depending on the message being sent.

@i-am-grub
Copy link
Contributor Author

i-am-grub commented Apr 24, 2024

The last unprovoked changes from me. Removing the periodic reboots fixes the last issue I was worried about.

Synced pilot race demo (warning: audio is loud and unedited)

timer_with_backpack

@pkendall64
Copy link
Contributor

I'll go over this one more time and if it's all good I'll merge the changes.

@pkendall64 pkendall64 merged commit 5d7da05 into ExpressLRS:master Apr 28, 2024
34 checks passed
@pkendall64 pkendall64 added enhancement New feature or request V1.5 🍰 Version 1.5 labels Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request V1.5 🍰 Version 1.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants