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

Grace period before setting sensor auto offset #3918

Closed
wants to merge 1 commit into from

Conversation

mha1
Copy link
Contributor

@mha1 mha1 commented Aug 9, 2023

Harmonized setting sensor auto offset with TELEMETRY_STREAMING() which returns true after one second of stable telemetry data. Auto offset will be written for the specific sensor if it is enabled and telemetry streaming is stable and

  • was not yet stored in this power cycle or
  • auto offset is disabled and enabled (later) again in this power cycle or
  • Reset Telemetry is requested

…etry streaming which gives a grace period of 1s to allow the sensor to settle rather than using the first incoming data which might be 0.
@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

@3djc please review

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

Hmmm did you test it actually working ? I have a feeling it does not change anything, since TELEMETRY_STREAMING will be true when first telem packet is received, hence I think there is actually no grace period here. (And I know I suggested using it, apologies for that).

I know of pilots who share sensors between planes, so they might connect sensors even after telem is up, so ideally, who should be counting how long this sensor has been up, ideally without consuming more RAM. Probably can be achieved within the union size

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

Very strange, it would mean that the module send rssi only after some time ? What module/protocol did you test with ?

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

MPM/Graupner HoTT

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

That must be a very edge case then, combination of MPM and Hott, here is the result of:

image

on a simple ELRS module

image

When you get there first, TELEMETRY_STREAMING() is already true (which makes sense because data should not be processed if it isn't)

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

I wonder because it's exactly 1s

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

Please try the following with your trace enabled:

  • turn on radio, leave rx off
  • wait 30s or so
  • turn on rx

what's your trace looking like now?

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

Exactly what I did (except I waited 22.5s instead of 30s as can been seen in the logs

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

do you have equipment to try MPM/FrSky X2?

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

This is ghost in similar conditions

image

@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

MPM with FRSKY

image

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

Thx for looking at this. I have to think about it ...

@mha1
Copy link
Contributor Author

mha1 commented Aug 15, 2023

@3djc You were right, ELRS and FrSky are working as expected. My observation is not tied to the MPM in general but is indeed a quirk of the way HoTT telemetry works.

The 1s delay until RSSI can be explained. HoTT sends RSSI and LQI. LQI > 0 is used to reset the telemetry streaming timer. The rx calculates LQI as number of decodable packets received over a period of 1s. So for the first second LQI is zero because only after the first second a sampled value is available.

The fact that the first two packets contain zero data for RxBt might be also related to some internal filtering. Anyhow, this behavior makes auto offset to use zero values because the real values are two packets too late.

The remedy for both quirks is easy. The Graupner HoTT protocol decoder just needs to ignore the first batch of incoming packets, basically to allow LQI and real values to be available for sure.

I'm not sure yet if I put in a PR for this (hott.cpp) because no one (besides myself) ever complained about auto offset not working for Graupner HoTT. On the other hand there is no harm in ignoring the x telemetry packets either.

@mha1 mha1 closed this Aug 15, 2023
@3djc
Copy link
Collaborator

3djc commented Aug 15, 2023

Ignored issues always come back bitting you, usually with a vengeance. Raise a PR to fix it and be done with it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants