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

EL18 Vspd in telemetry screen #3515

Open
1 task done
CharlesGauci opened this issue Apr 23, 2023 · 3 comments
Open
1 task done

EL18 Vspd in telemetry screen #3515

CharlesGauci opened this issue Apr 23, 2023 · 3 comments
Labels
enhancement ✨ New feature or request

Comments

@CharlesGauci
Copy link

Is there an existing issue for this feature request?

  • I have searched the existing issues

Is your feature request related to a problem?

Would it be possible to include 'Vspd' with 'Alt' and 'Temp1' in the telemetry screen of the EL18 similar to Pull Request numbers NV14 #1477 #1477 and NV14 #1485 #1485 ?

Describe the solution you'd like

It should make vario function work if implemented

Describe alternatives you've considered

No response

Additional context

No response

@CharlesGauci CharlesGauci added the enhancement ✨ New feature or request label Apr 23, 2023
@richardclli
Copy link
Collaborator

richardclli commented Apr 28, 2023

Well, the firmware for NV14 and EL18 are nothing different except the name displayed. So what works with NV14 should works with EL18 as well.

Flysky did a full test and fix some problems about the sensors in v2.8 3, did you tried this version?

@CharlesGauci
Copy link
Author

CharlesGauci commented Apr 28, 2023

Thanks for the reply richardclli , yes I am on 2.8.3 and I use both NV14 and EL18, but Vspd only appears on NV14.
Altitude readings are also erratic on EL18 as they keep constantly changing by large amounts, I mentioned this problem on pr #3467.

@pfeerick
Copy link
Member

pfeerick commented May 1, 2023

#3386 is the actual relevant PR changes stem from, #3467 is simply a backport of it with no functional changes.

I commented there that the altitude, which is used to calculate VSpd on the NV14/AFHDS2A, that:

I'm pretty sure the previous behaviour was coded so that it would be relative to takeoff, i.e. 0 and then go up or down. whereas now for me it starts off at about 48m and goes up in 0.5m increments. Is it supposed to be an approximation relative to sea level or something?

#3386 (comment)

Rather than using this altitude code like before:

#if 0
int32_t getALT(uint32_t value)
{
uint32_t pressurePa = value & PRESSURE_MASK;
if (pressurePa == 0) return 0;
uint16_t temperatureK = ibusTempToK((uint16_t) (value >> 19));
static uint32_t initPressure = 0;
static uint16_t initTemperature = 0;
if (initPressure <= 0) // use current pressure for ground altitude -> 0
{
initPressure = pressurePa;
initTemperature = temperatureK;
}
int temperature = (initTemperature + temperatureK) >> 1; //div 2
bool tempNegative = temperature < 0;
if (tempNegative) temperature = temperature * -1;
uint64_t helper = R_DIV_G_MUL_10_Q15;
helper = helper * (uint64_t) temperature;
helper = helper >> ALT_PRECISION;
uint32_t po_to_p = (uint32_t)(initPressure << (ALT_PRECISION - 1));
po_to_p = po_to_p / pressurePa;
//shift missing bit
po_to_p = po_to_p << 1;
if (po_to_p == 0) return 0;
uint64_t t = log2fix(po_to_p) * INV_LOG2_E_Q1DOT31;
int32_t ln = t >> 31;
bool neg = ln < 0;
if (neg) ln = ln * -1;
helper = helper * (uint64_t) ln;
helper = helper >> ALT_PRECISION;
int result = (int) helper;
if (neg ^ tempNegative) result = result * -1;
return result;
}
#else

it now uses this code, with a table of values in 0.5m increments and references to sea level presssure?

https://github.com/EdgeTX/edgetx/blob/53f172bb0703156db1cedaeb381bdbb88b8a9e9d/radio/src/telemetry/flysky_ibus.cpp#L555C4-L618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants