Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dzikuvx-ez-tune
Browse files Browse the repository at this point in the history
  • Loading branch information
DzikuVx committed Oct 19, 2023
2 parents 37e1fac + f24d6cf commit e642926
Show file tree
Hide file tree
Showing 29 changed files with 878 additions and 293 deletions.
3 changes: 3 additions & 0 deletions docs/Programming Framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn
| 35 | AGL_STATUS | boolean `1` when AGL can be trusted, `0` when AGL estimate can not be trusted |
| 36 | AGL | integer Above The Groud Altitude in `cm` |
| 37 | RANGEFINDER_RAW | integer raw distance provided by the rangefinder in `cm` |
| 38 | ACTIVE_MIXER_PROFILE | Which mixers are currently active (for vtol etc) |
| 39 | MIXER_TRANSITION_ACTIVE | Currently switching between mixers (quad to plane etc) |
| 40 | ATTITUDE_YAW | current heading (yaw) in `degrees` |

#### FLIGHT_MODE

Expand Down
34 changes: 32 additions & 2 deletions docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Inertia force compensation method when gps is avaliable, VELNED use the acclerat

| Default | Min | Max |
| --- | --- | --- |
| VELNED | | |
| ADAPTIVE | | |

---

Expand Down Expand Up @@ -3528,7 +3528,7 @@ Multicopter hover throttle hint for altitude controller. Should be set to approx

| Default | Min | Max |
| --- | --- | --- |
| 1500 | 1000 | 2000 |
| 1300 | 1000 | 2000 |

---

Expand Down Expand Up @@ -4102,6 +4102,16 @@ Value above which to make the OSD relative altitude indicator blink (meters)

---

### osd_arm_screen_display_time

Amount of time to display the arm screen [ms]

| Default | Min | Max |
| --- | --- | --- |
| 1500 | 1000 | 5000 |

---

### osd_baro_temp_alarm_max

Temperature above which the baro temperature OSD element will start blinking (decidegrees centigrade)
Expand Down Expand Up @@ -4432,6 +4442,16 @@ Temperature under which the IMU temperature OSD element will start blinking (dec

---

### osd_inav_to_pilot_logo_spacing

The space between the INAV and pilot logos, if `osd_use_pilot_logo` is `ON`. This number may be adjusted so that it fits the odd/even col width displays. For example, if using an odd column width display, such as Walksnail, and this is set to 4. 1 will be added so that the logos are equally spaced from the centre of the screen.

| Default | Min | Max |
| --- | --- | --- |
| 8 | 0 | 20 |

---

### osd_left_sidebar_scroll

_// TODO_
Expand Down Expand Up @@ -4852,6 +4872,16 @@ IMPERIAL, METRIC, UK

---

### osd_use_pilot_logo

Use custom pilot logo with/instead of the INAV logo. The pilot logo must be characters 473 to 511

| Default | Min | Max |
| --- | --- | --- |
| OFF | OFF | ON |

---

### osd_video_system

Video system used. Possible values are `AUTO`, `PAL`, `NTSC`, `HDZERO`, 'DJIWTF', 'AVATAR' and `BF43COMPAT`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Software In The Loop (HITL) plugin for X-Plane 11
# Hardware In The Loop (HITL) plugin for X-Plane 11/12

**Hardware-in-the-loop (HITL) simulation**, is a technique that is used in the development and testing of complex real-time embedded systems.

**X-Plane** is a flight simulation engine series developed and published by Laminar Research https://www.x-plane.com/

**INAV-X-Plane-HITL** is plugin for **X-Plane** for testing and developing flight controllers with **INAV flight controller firmware**

https://github.com/iNavFlight/inav.
https://github.com/RomanLut/INAV-X-Plane-HITL

HITL technique can be used to test features during development. Please check page above for installation instructions.
6 changes: 3 additions & 3 deletions src/main/cms/cms.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void cmsYieldDisplay(displayPort_t *pPort, timeMs_t duration);
void cmsUpdate(uint32_t currentTimeUs);
void cmsSetExternKey(cms_key_e extKey);

#define CMS_STARTUP_HELP_TEXT1 "MENU: THR MID"
#define CMS_STARTUP_HELP_TEXT2 "+ YAW LEFT"
#define CMS_STARTUP_HELP_TEXT3 "+ PITCH UP"
#define CMS_STARTUP_HELP_TEXT1 "MENU: THR MID"
#define CMS_STARTUP_HELP_TEXT2 "+ YAW LEFT"
#define CMS_STARTUP_HELP_TEXT3 "+ PITCH UP"

// cmsMenuExit special ptr values
#define CMS_EXIT (0)
Expand Down
16 changes: 11 additions & 5 deletions src/main/drivers/osd_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
// 0x26 // 038 ASCII &
#define SYM_VTX_POWER 0x27 // 039 VTx Power
// 0x28 // 040 to 062 ASCII
#define SYM_AH_NM 0x3F // 063 Ah/NM
#define SYM_AH_NM 0x3F // 063 Ah/NM
// 0x40 // 064 to 095 ASCII
#define SYM_MAH_NM_0 0x60 // 096 mAh/NM left
#define SYM_MAH_NM_1 0x61 // 097 mAh/NM right
Expand All @@ -78,7 +78,7 @@
#define SYM_WH 0x6D // 109 WH
#define SYM_WH_KM 0x6E // 110 WH/KM
#define SYM_WH_MI 0x6F // 111 WH/MI
#define SYM_WH_NM 0x70 // 112 Wh/NM
#define SYM_WH_NM 0x70 // 112 Wh/NM
#define SYM_WATT 0x71 // 113 WATTS
#define SYM_MW 0x72 // 114 mW
#define SYM_KILOWATT 0x73 // 115 kW
Expand Down Expand Up @@ -159,6 +159,7 @@
#define SYM_HEADING_W 0xCB // 203 Heading Graphic west
#define SYM_HEADING_DIVIDED_LINE 0xCC // 204 Heading Graphic
#define SYM_HEADING_LINE 0xCD // 205 Heading Graphic

#define SYM_MAX 0xCE // 206 MAX symbol
#define SYM_PROFILE 0xCF // 207 Profile symbol
#define SYM_SWITCH_INDICATOR_LOW 0xD0 // 208 Switch High
Expand All @@ -175,10 +176,10 @@
#define SYM_FLIGHT_HOURS_REMAINING 0xDB // 219 Flight time (hours) remaining
#define SYM_GROUND_COURSE 0xDC // 220 Ground course
#define SYM_ALERT 0xDD // 221 General alert symbol

#define SYM_TERRAIN_FOLLOWING 0xFB // 251 Terrain following (also Alt adjust)
#define SYM_CROSS_TRACK_ERROR 0xFC // 252 Cross track error


#define SYM_LOGO_START 0x101 // 257 to 297, INAV logo
#define SYM_LOGO_WIDTH 10
#define SYM_LOGO_HEIGHT 4
Expand Down Expand Up @@ -225,7 +226,7 @@
#define SYM_HUD_SIGNAL_3 0x163 // 355 Hud signal icon 75%
#define SYM_HUD_SIGNAL_4 0x164 // 356 Hud signal icon 100%

#define SYM_HOME_DIST 0x165 // 357 DIST
#define SYM_HOME_DIST 0x165 // 357 DIST
#define SYM_AH_CH_CENTER 0x166 // 358 Crossair center
#define SYM_FLIGHT_DIST_REMAINING 0x167 // 359 Flight distance reminaing
#define SYM_ODOMETER 0x168 // 360 Odometer
Expand Down Expand Up @@ -262,8 +263,13 @@
#define SYM_SERVO_PAN_IS_OFFSET_L 0x1C7 // 455 Pan servo is offset left
#define SYM_SERVO_PAN_IS_OFFSET_R 0x1C8 // 456 Pan servo is offset right

#define SYM_PILOT_LOGO_SML_L 0x1D5 // 469 small Pilot logo Left
#define SYM_PILOT_LOGO_SML_C 0x1D6 // 470 small Pilot logo Centre
#define SYM_PILOT_LOGO_SML_R 0x1D7 // 471 small Pilot logo Right
#define SYM_PILOT_LOGO_LRG_START 0x1D8 // 472 to 511, Pilot logo

#else

#define TEMP_SENSOR_SYM_COUNT 0
#define TEMP_SENSOR_SYM_COUNT 0

#endif // USE_OSD
14 changes: 12 additions & 2 deletions src/main/drivers/timer_impl_stdperiph.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ bool impl_timerPWMConfigChannelDMA(TCH_t * tch, void * dmaBuffer, uint8_t dmaBuf
TIM_CtrlPWMOutputs(timer, ENABLE);
TIM_ARRPreloadConfig(timer, ENABLE);

TIM_CCxCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCx_Enable);
if (tch->timHw->output & TIMER_OUTPUT_N_CHANNEL) {
TIM_CCxNCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCxN_Enable);
} else {
TIM_CCxCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCx_Enable);
}

TIM_Cmd(timer, ENABLE);

dmaInit(tch->dma, OWNER_TIMER, 0);
Expand Down Expand Up @@ -382,7 +387,12 @@ bool impl_timerPWMConfigDMABurst(burstDmaTimer_t *burstDmaTimer, TCH_t * tch, vo
TIM_CtrlPWMOutputs(timer, ENABLE);
TIM_ARRPreloadConfig(timer, ENABLE);

TIM_CCxCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCx_Enable);
if (tch->timHw->output & TIMER_OUTPUT_N_CHANNEL) {
TIM_CCxNCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCxN_Enable);
} else {
TIM_CCxCmd(timer, lookupTIMChannelTable[tch->timHw->channelIndex], TIM_CCx_Enable);
}

TIM_Cmd(timer, ENABLE);

if (!tch->timCtx->dmaBurstRef) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/fc/fc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ void processRx(timeUs_t currentTimeUs)
} else {
DISABLE_FLIGHT_MODE(MANUAL_MODE);
}
}else{
DISABLE_FLIGHT_MODE(MANUAL_MODE);
}

/* In airmode Iterm should be prevented to grow when Low thottle and Roll + Pitch Centered.
Expand Down
11 changes: 6 additions & 5 deletions src/main/fc/fc_msp_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void initActiveBoxIds(void)
//Camstab mode is enabled always
ADD_ACTIVE_BOX(BOXCAMSTAB);

if (STATE(MULTIROTOR)) {
if (STATE(MULTIROTOR) || platformTypeConfigured(PLATFORM_MULTIROTOR) || platformTypeConfigured(PLATFORM_TRICOPTER)) {
if ((sensors(SENSOR_ACC) || sensors(SENSOR_MAG))) {
ADD_ACTIVE_BOX(BOXHEADFREE);
ADD_ACTIVE_BOX(BOXHEADADJ);
Expand Down Expand Up @@ -244,13 +244,13 @@ void initActiveBoxIds(void)
#endif
}

if (STATE(AIRPLANE)) {
if (STATE(AIRPLANE) || platformTypeConfigured(PLATFORM_AIRPLANE)) {
ADD_ACTIVE_BOX(BOXSOARING);
}
}

#ifdef USE_MR_BRAKING_MODE
if (mixerConfig()->platformType == PLATFORM_MULTIROTOR) {
if (mixerConfig()->platformType == PLATFORM_MULTIROTOR || platformTypeConfigured(PLATFORM_MULTIROTOR)) {
ADD_ACTIVE_BOX(BOXBRAKING);
}
#endif
Expand All @@ -259,11 +259,12 @@ void initActiveBoxIds(void)
ADD_ACTIVE_BOX(BOXNAVALTHOLD);
}

if (STATE(AIRPLANE) || STATE(ROVER) || STATE(BOAT)) {
if (STATE(AIRPLANE) || STATE(ROVER) || STATE(BOAT) ||
platformTypeConfigured(PLATFORM_AIRPLANE) || platformTypeConfigured(PLATFORM_ROVER) || platformTypeConfigured(PLATFORM_BOAT)) {
ADD_ACTIVE_BOX(BOXMANUAL);
}

if (STATE(AIRPLANE)) {
if (STATE(AIRPLANE) || platformTypeConfigured(PLATFORM_AIRPLANE)) {
if (!feature(FEATURE_FW_LAUNCH)) {
ADD_ACTIVE_BOX(BOXNAVLAUNCH);
}
Expand Down
33 changes: 31 additions & 2 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ groups:
max: PWM_RANGE_MAX
- name: nav_mc_hover_thr
description: "Multicopter hover throttle hint for altitude controller. Should be set to approximate throttle value when drone is hovering."
default_value: 1500
default_value: 1300
field: nav.mc.hover_throttle
min: 1000
max: 2000
Expand Down Expand Up @@ -1452,7 +1452,7 @@ groups:
type: bool
- name: ahrs_inertia_comp_method
description: "Inertia force compensation method when gps is avaliable, VELNED use the accleration from gps, TURNRATE calculates accleration by turnrate multiplied by speed, ADAPTIVE choose best result from two in each ahrs loop"
default_value: VELNED
default_value: ADAPTIVE
field: inertia_comp_method
table: imu_inertia_comp_method

Expand Down Expand Up @@ -3559,59 +3559,88 @@ groups:
max: 6
default_value: 4

- name: osd_use_pilot_logo
description: Use custom pilot logo with/instead of the INAV logo. The pilot logo must be characters 473 to 511
field: use_pilot_logo
type: bool
default_value: OFF

- name: osd_inav_to_pilot_logo_spacing
description: The space between the INAV and pilot logos, if `osd_use_pilot_logo` is `ON`. This number may be adjusted so that it fits the odd/even col width displays. For example, if using an odd column width display, such as Walksnail, and this is set to 4. 1 will be added so that the logos are equally spaced from the centre of the screen.
field: inav_to_pilot_logo_spacing
min: 0
max: 20
default_value: 8

- name: osd_arm_screen_display_time
description: Amount of time to display the arm screen [ms]
field: arm_screen_display_time
min: 1000
max: 5000
default_value: 1500

- name: osd_switch_indicator_zero_name
description: "Character to use for OSD switch incicator 0."
field: osd_switch_indicator0_name
type: string
max: 5
default_value: "FLAP"

- name: osd_switch_indicator_one_name
description: "Character to use for OSD switch incicator 1."
field: osd_switch_indicator1_name
type: string
max: 5
default_value: "GEAR"

- name: osd_switch_indicator_two_name
description: "Character to use for OSD switch incicator 2."
field: osd_switch_indicator2_name
type: string
max: 5
default_value: "CAM"

- name: osd_switch_indicator_three_name
description: "Character to use for OSD switch incicator 3."
field: osd_switch_indicator3_name
type: string
max: 5
default_value: "LIGT"

- name: osd_switch_indicator_zero_channel
description: "RC Channel to use for OSD switch indicator 0."
field: osd_switch_indicator0_channel
min: 5
max: MAX_SUPPORTED_RC_CHANNEL_COUNT
default_value: 5

- name: osd_switch_indicator_one_channel
description: "RC Channel to use for OSD switch indicator 1."
field: osd_switch_indicator1_channel
min: 5
max: MAX_SUPPORTED_RC_CHANNEL_COUNT
default_value: 5

- name: osd_switch_indicator_two_channel
description: "RC Channel to use for OSD switch indicator 2."
field: osd_switch_indicator2_channel
min: 5
max: MAX_SUPPORTED_RC_CHANNEL_COUNT
default_value: 5

- name: osd_switch_indicator_three_channel
description: "RC Channel to use for OSD switch indicator 3."
field: osd_switch_indicator3_channel
min: 5
max: MAX_SUPPORTED_RC_CHANNEL_COUNT
default_value: 5

- name: osd_switch_indicators_align_left
description: "Align text to left of switch indicators"
field: osd_switch_indicators_align_left
type: bool
default_value: ON

- name: osd_system_msg_display_time
description: System message display cycle time for multiple messages (milliseconds).
field: system_msg_display_time
Expand Down
19 changes: 8 additions & 11 deletions src/main/flight/imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,28 +719,25 @@ static void imuCalculateEstimatedAttitude(float dT)
}
if (imuConfig()->inertia_comp_method == COMPMETHOD_ADAPTIVE && isGPSTrustworthy() && STATE(AIRPLANE))
{
//pick the best centrifugal acceleration between velned and turnrate
fpVector3_t compansatedGravityBF_velned;
vectorAdd(&compansatedGravityBF_velned, &imuMeasuredAccelBF, &vEstcentrifugalAccelBF_velned);
float velned_magnitude = fabsf(fast_fsqrtf(vectorNormSquared(&compansatedGravityBF_velned)) - GRAVITY_CMSS);
float velned_error = fabsf(fast_fsqrtf(vectorNormSquared(&compansatedGravityBF_velned)) - GRAVITY_CMSS);

fpVector3_t compansatedGravityBF_turnrate;
vectorAdd(&compansatedGravityBF_turnrate, &imuMeasuredAccelBF, &vEstcentrifugalAccelBF_turnrate);
float turnrate_magnitude = fabsf(fast_fsqrtf(vectorNormSquared(&compansatedGravityBF_turnrate)) - GRAVITY_CMSS);
if (velned_magnitude > turnrate_magnitude)
{
compansatedGravityBF = compansatedGravityBF_turnrate;
}
else
{
compansatedGravityBF = compansatedGravityBF_velned;
}
float turnrate_error = fabsf(fast_fsqrtf(vectorNormSquared(&compansatedGravityBF_turnrate)) - GRAVITY_CMSS);

compansatedGravityBF = velned_error > turnrate_error? compansatedGravityBF_turnrate:compansatedGravityBF_velned;
}
else if (imuConfig()->inertia_comp_method == COMPMETHOD_VELNED && isGPSTrustworthy())
else if (((imuConfig()->inertia_comp_method == COMPMETHOD_VELNED) || (imuConfig()->inertia_comp_method == COMPMETHOD_ADAPTIVE)) && isGPSTrustworthy())
{
//velned centrifugal force compensation, quad will use this method
vectorAdd(&compansatedGravityBF, &imuMeasuredAccelBF, &vEstcentrifugalAccelBF_velned);
}
else if (STATE(AIRPLANE))
{
//turnrate centrifugal force compensation
vectorAdd(&compansatedGravityBF, &imuMeasuredAccelBF, &vEstcentrifugalAccelBF_turnrate);
}
else
Expand Down
Loading

0 comments on commit e642926

Please sign in to comment.