Skip to content

Commit c520ff8

Browse files
committed
Update SmartPort telemetry to reflect latest flight modes
This brings the SmartPort flight modes in line with what is shown on the OSD and CRSF telemetry. I am working on updating the OpenTX Telemetry Widget. All have been tested, except Turtle, using SmartPort. I just need to test with CRSF.
1 parent def8d25 commit c520ff8

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/main/io/osd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2565,7 +2565,7 @@ static bool osdDrawSingleElement(uint8_t item)
25652565
p = "MANU";
25662566
#ifdef USE_GEOZONE
25672567
else if (FLIGHT_MODE(NAV_SEND_TO) && !FLIGHT_MODE(NAV_WP_MODE))
2568-
p = "GEO";
2568+
p = "GEO ";
25692569
#endif
25702570
else if (FLIGHT_MODE(TURTLE_MODE))
25712571
p = "TURT";

src/main/telemetry/smartport.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ static smartPortWriteFrameFn *smartPortWriteFrame;
162162
static bool smartPortMspReplyPending = false;
163163
#endif
164164

165-
static uint16_t frskyGetFlightMode(void)
165+
static uint32_t frskyGetFlightMode(void)
166166
{
167-
uint16_t tmpi = 0;
167+
uint32_t tmpi = 0;
168168

169169
// ones column
170170
if (!isArmingDisabled())
@@ -187,11 +187,11 @@ static uint16_t frskyGetFlightMode(void)
187187
tmpi += 100;
188188
if (FLIGHT_MODE(NAV_ALTHOLD_MODE))
189189
tmpi += 200;
190-
if (FLIGHT_MODE(NAV_POSHOLD_MODE))
190+
if (FLIGHT_MODE(NAV_POSHOLD_MODE) && !STATE(AIRPLANE))
191191
tmpi += 400;
192192

193193
// thousands column
194-
if (FLIGHT_MODE(NAV_RTH_MODE))
194+
if (FLIGHT_MODE(NAV_RTH_MODE) && !isWaypointMissionRTHActive())
195195
tmpi += 1000;
196196
if (FLIGHT_MODE(NAV_COURSE_HOLD_MODE)) // intentionally out of order and 'else-ifs' to prevent column overflow
197197
tmpi += 8000;
@@ -208,6 +208,22 @@ static uint16_t frskyGetFlightMode(void)
208208
else if (FLIGHT_MODE(AUTO_TUNE)) // intentionally reverse order and 'else-if' to prevent 16-bit overflow
209209
tmpi += 20000;
210210

211+
// hundred thousands column
212+
if (FLIGHT_MODE(NAV_FW_AUTOLAND))
213+
tmpi += 100000;
214+
if (FLIGHT_MODE(TURTLE_MODE))
215+
tmpi += 200000;
216+
else if (FLIGHT_MODE(NAV_POSHOLD_MODE) && STATE(AIRPLANE))
217+
tmpi += 800000;
218+
if (FLIGHT_MODE(NAV_SEND_TO))
219+
tmpi += 400000;
220+
221+
// million column
222+
if (FLIGHT_MODE(NAV_RTH_MODE) && isWaypointMissionRTHActive())
223+
tmpi += 1000000;
224+
if (FLIGHT_MODE(ANGLEHOLD_MODE))
225+
tmpi += 2000000;
226+
211227
return tmpi;
212228
}
213229

0 commit comments

Comments
 (0)