Frsky D4R-II 8 channels receiver with telemetry part 3: testing

 I still have a set of DR4II with invert circuit and pixhawk, I pair it up with my jumper T18, and start some testing.

D port is set at serial 2 with 9600 and 3 for serial protocol.

OpenTX has decoded these sensors:


Tmp2 =93, means 9 sat in view, 3D fix, temp1 should be flight mode

https://github.com/moschotto/OpenTX_GPS_Telemetry

does what it should do.



Inav lua deocde, gps correctly, and Hdg, but the RSSI bar seems not correct, and it talks alot, I will setup pixhawk fully and try again.



after setup pixhawk, the flight mode does match inav setting.
the rssi is related to my elevator stick
but the battery voltage and fuel is the same as mission planner

Here is the flight mode for inav: https://github.com/iNavFlight/inav/blob/master/docs/INAV_Modes.pdf


-- Modes: t=text / f=flags for text / w=wave file

local modes = {
{ t = "! TELEM !", f = 3 },
{ t = "HORIZON", f = 0, w = "hrznmd" },
{ t = " ANGLE", f = 0, w = "anglmd" },
{ t = " ACRO", f = 0, w = "acromd" },
{ t = " NOT OK ", f = 3 },
{ t = " READY", f = 0, w = "ready" },
{ t = "POS HOLD", f = 0, w = "poshld" },
{ t = "WAYPONT", f = 0, w = "waypt" },
{ t = " MANUAL", f = 0, w = "manmd" },
{ t = " RTH ", f = 3, w = "rtl" },
{ t = "! FAIL !", f = 3, w = "fson" },
{ t = "! THROT !", f = 3 },
{ t = " CRUISE", f = 0, w = "cruzmd" }
}

mode_id = getTelemetryId("Tmp1"),

https://github.com/iNavFlight/OpenTX-Telemetry-Widget/blob/master/src/SCRIPTS/TELEMETRY/iNav.lua
data.mode = getValue(data.mode_id)

https://doc.open-tx.org/opentx-lua-reference-guide/part_iii_-_opentx_lua_api_reference/general_functions/getvalue

where is data.mode processed?
line 211

  • Tmp1: Flight mode, sent as an integer: 18 - Manual, 23 - Altitude, 22 - Position, 27 - Mission, 26 - Hold, 28 - Return, 19 - Acro, 24 0 Offboard, 20 - Stabilized, 21 - Rattitude, 25 - Takeoff, 29 - Land, 30 - Follow Me.
  • Tmp2: GPS information. Right-most digit is GPS fix type (0 = none, 2 = 2D, 3 = 3D). Other digits are number of satellites.

from http://shipow.github.io/cleanflight-web/docs/telemetry.html

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. 1 is GPS Hold, 2 is GPS Home, 4 is Headfree
  2. 1 is mag enabled, 2 is baro enabled, 4 is sonar enabled
  3. 1 is angle, 2 is horizon, 4 is passthrough
  4. 1 is ok to arm, 2 is arming is prevented, 4 is armed

For arduplane flight modes

ModeRollPitchThrottleGPSNeed
 TX
Summary
MANUAL---YManual control surface movement, passthrough
FBWAss-YRoll and pitch follow stick input, up to set limits
FBWBsASPDYYlike FBWA, but with automatic height and speed control
CRUISEAASPDYYlike FBWB, but with ground course tracking and terrain following
STABILIZE++-YWing-leveling on stick release
AUTOTUNEss-Ylike FBWA, but learns attitude tuning while flying
TRAINING++-YManual control up to roll and pitch limits
ACRO++-Yrate controlled mode with no attitude limits
Q(Copter Modes)ssAYYVaries depending on mode. See quadplane documentation
AUTOAAAYFollows Mission
LOITERAAAYCircles point where mode switched
CIRCLEAAAGently turns aircraft
GUIDEDAAAYCircles user defined point from GCS
Return To Launch
(RTL)
AAAYReturns to and circles home or rally point
LAND (AUTO)AAAYFinal part of automatic mission for touchdown
THERMALAAAYMode entered to search for thermal lift by SOARING feature or
 manually if lift is encountered. 
SymbolDefinition
-Full manual control of flight surfaces
+Manual control with stabilized limits or assistance
sStabilized control with limits
AAutomatic control
SPDControls speed
Now I have 2 ways to do with D port. 
1. modify inav script on the flight mode and RSSI stuff(some times it's correct, some times not)
2. take examples from the fly sky rx demo or gps lua and modify to what i need.

gps lua seems good, I only need flight modes on it.

Now, to find out what is my Dport send out when change flight mode with arduplane.
it's clearly not 4 digits.

Form setting of mission planner, the flight mode is set with these nr, seems correct from my reading of Temp1 in openTX sensor list
0:Manual
1:CIRCLE
2:STABILIZE
3:TRAINING
4:ACRO
5:FBWA
6:FBWB
7:CRUISE
8:AUTOTUNE
10:Auto
11:RTL
12:Loiter
13:TAKEOFF
14:AVOID_ADSB
15:Guided
17:QSTABILIZE
18:QHOVER
19:QLOITER
20:QLAND
21:QRTL
22:QAUTOTUNE
23:QACRO
24:THERMAL
25:Loiter to QLand 

checking with my openTX and mission planner, in openTX RTL and auto are decoded the same as 11....this is not going to work....

留言

這個網誌中的熱門文章

Heltec ESP32+OLED+Lora, hardware testing

micro SD card for ESP32, on lolin32 with OLED and heltec 32 lora oled

Install Network Time Protocol(NTP) on BeagleBone with Angstrom linux and set local time zone