Modulo for telemetry value

ersky9xr is the port of the er9x firmware to the 9XRPRO radio.
Post Reply
vodkabears
Posts: 47
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Modulo for telemetry value

Post by vodkabears »

Hello.

I want to setup a voice alarm for armed/disarmed based on telemetry value. Betaflight sends flight mode in smartport T1 sensor in the following way:
Tmp1 : actual flight mode, sent as 4 digits. Number is sent as (1)1234. Please ignore the leading 1, it is just there to ensure the number as always 5 digits (the 1 + 4 digits of actual data) the numbers are aditives (for example, if first digit after the leading 1 is 6, it means GPS Home and Headfree are both active) :

1 is GPS Hold, 2 is GPS Home, 4 is Headfree
1 is mag enabled, 2 is baro enabled, 4 is sonar enabled
1 is angle, 2 is horizon, 4 is passthrough
1 is ok to arm, 2 is arming is prevented, 4 is armed
So to get armed state I need only the last digit. To get the last digit I need to divide T1 by 10 and take a remainder. If it becomes 4 or more, it's armed, otherwise disarmed. Is it possible in ersky9x?

User avatar
MikeB
9x Developer
Posts: 17992
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Modulo for telemetry value

Post by MikeB »

Use a scaler, you should find a "MOD" option, set this to 10 and you get the value MOD 10, so the last digit.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
vodkabears
Posts: 47
Joined: Thu Aug 23, 2018 5:37 am
Country: Russian Federation
Contact:

Re: Modulo for telemetry value

Post by vodkabears »

Thanks, Mike. It worked, didn't notice this in scaler setup first. For a strange reason with mod value 10 it returns the first, not the last digit. 9 works just right.

Post Reply

Return to “ersky9xr”