Skip to content

Commit 26fa5a7

Browse files
committed
Clean up + small fixes
1 parent b2c2efa commit 26fa5a7

17 files changed

Lines changed: 189 additions & 1350 deletions

File tree

.github/workflows/release.yml

Lines changed: 147 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,147 @@
1-
name: Create Release
2-
3-
on:
4-
push:
5-
tags:
6-
- 'V-*'
7-
- 'Beta-*'
8-
9-
jobs:
10-
parse-tag:
11-
runs-on: ubuntu-latest
12-
outputs:
13-
version: ${{ steps.parse.outputs.version }}
14-
is-prerelease: ${{ steps.parse.outputs.is-prerelease }}
15-
beta-version: ${{ steps.parse.outputs.beta-version }}
16-
release-name: ${{ steps.parse.outputs.release-name }}
17-
steps:
18-
- name: Parse Tag
19-
id: parse
20-
run: |
21-
TAG="${{ github.ref_name }}"
22-
23-
if [[ $TAG =~ ^V-([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
24-
# Release tag format: V-major.minor.patch
25-
VERSION="${BASH_REMATCH[1]}"
26-
IS_PRERELEASE="false"
27-
BETA_VERSION=""
28-
RELEASE_NAME="INAV-XITL-${VERSION}"
29-
elif [[ $TAG =~ ^Beta-([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)$ ]]; then
30-
# Pre-release tag format: Beta-major.minor.patch-betaVersion
31-
VERSION="${BASH_REMATCH[1]}"
32-
BETA_VERSION="${BASH_REMATCH[2]}"
33-
IS_PRERELEASE="true"
34-
RELEASE_NAME="INAV-XITL-${VERSION}-Beta-${BETA_VERSION}"
35-
else
36-
echo "Invalid tag format: $TAG"
37-
exit 1
38-
fi
39-
40-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
41-
echo "is-prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
42-
echo "beta-version=${BETA_VERSION}" >> $GITHUB_OUTPUT
43-
echo "release-name=${RELEASE_NAME}" >> $GITHUB_OUTPUT
44-
45-
download-artifacts:
46-
needs: parse-tag
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout code
50-
uses: actions/checkout@v4
51-
52-
- name: Find Latest CI Run
53-
id: find-run
54-
run: |
55-
# Get the latest successful CI workflow run on main branch
56-
RUNS=$(gh run list --branch main --workflow ci.yml --status success --json databaseId,createdAt --limit 1)
57-
58-
if [ -z "$RUNS" ]; then
59-
echo "No successful CI runs found"
60-
exit 1
61-
fi
62-
63-
RUN_ID=$(echo "$RUNS" | jq -r '.[0].databaseId')
64-
echo "run-id=${RUN_ID}" >> $GITHUB_OUTPUT
65-
echo "Found CI run: ${RUN_ID}"
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
69-
- name: Download Windows Artifact
70-
run: |
71-
gh run download ${{ steps.find-run.outputs.run-id }} --dir ./artifacts-win --pattern "*Windows*" --repo ${{ github.repository }}
72-
echo "Downloaded Windows artifact"
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
76-
- name: Download Linux Artifact
77-
run: |
78-
gh run download ${{ steps.find-run.outputs.run-id }} --dir ./artifacts-linux --pattern "*Linux*" --repo ${{ github.repository }}
79-
echo "Downloaded Linux artifact"
80-
env:
81-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82-
83-
- name: Create Release Assets
84-
id: create-assets
85-
run: |
86-
RELEASE_NAME="${{ needs.parse-tag.outputs.release-name }}"
87-
88-
# Create Windows ZIP - zip the contents directly without nested structure
89-
WIN_ARTIFACT=$(find ./artifacts-win -maxdepth 2 -type d -name "Aircraft" | head -1 | xargs dirname)
90-
if [ -z "$WIN_ARTIFACT" ]; then
91-
WIN_ARTIFACT=$(find ./artifacts-win -maxdepth 1 -type d ! -name "." ! -name ".." | head -1)
92-
fi
93-
cd "$WIN_ARTIFACT"
94-
zip -r "../../${RELEASE_NAME}-Windows.zip" . -x ".*"
95-
cd - > /dev/null
96-
97-
# Create Linux ZIP - zip the contents directly without nested structure
98-
LINUX_ARTIFACT=$(find ./artifacts-linux -maxdepth 2 -type d -name "Aircraft" | head -1 | xargs dirname)
99-
if [ -z "$LINUX_ARTIFACT" ]; then
100-
LINUX_ARTIFACT=$(find ./artifacts-linux -maxdepth 1 -type d ! -name "." ! -name ".." | head -1)
101-
fi
102-
cd "$LINUX_ARTIFACT"
103-
zip -r "../../${RELEASE_NAME}-Linux.zip" . -x ".*"
104-
cd - > /dev/null
105-
106-
echo "Windows asset: ${RELEASE_NAME}-Windows.zip"
107-
echo "Linux asset: ${RELEASE_NAME}-Linux.zip"
108-
109-
- name: Upload Assets as Artifacts
110-
uses: actions/upload-artifact@v4
111-
with:
112-
name: release-assets
113-
path: |
114-
INAV-XITL-*.zip
115-
116-
create-release:
117-
needs: [parse-tag, download-artifacts]
118-
runs-on: ubuntu-latest
119-
steps:
120-
- name: Checkout code
121-
uses: actions/checkout@v4
122-
123-
- name: Download Release Assets
124-
uses: actions/download-artifact@v4
125-
with:
126-
name: release-assets
127-
128-
- name: Read Release Notes
129-
id: read-notes
130-
run: |
131-
NOTES=$(cat ReleaseNotes.md)
132-
# Escape newlines for GitHub Actions
133-
NOTES="${NOTES//'%'/'%25'}"
134-
NOTES="${NOTES//$'\n'/'%0A'}"
135-
NOTES="${NOTES//$'\r'/'%0D'}"
136-
echo "content=${NOTES}" >> $GITHUB_OUTPUT
137-
138-
- name: Create Release
139-
uses: softprops/action-gh-release@v2
140-
with:
141-
tag_name: ${{ github.ref_name }}
142-
name: ${{ needs.parse-tag.outputs.release-name }}
143-
body: ${{ steps.read-notes.outputs.content }}
144-
prerelease: ${{ needs.parse-tag.outputs.is-prerelease }}
145-
token: ${{ secrets.RELEASE_TOKEN }}
146-
files: |
147-
INAV-XITL-*.zip
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'V-*'
7+
- 'Beta-*'
8+
9+
jobs:
10+
parse-tag:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.parse.outputs.version }}
14+
is-prerelease: ${{ steps.parse.outputs.is-prerelease }}
15+
beta-version: ${{ steps.parse.outputs.beta-version }}
16+
release-name: ${{ steps.parse.outputs.release-name }}
17+
steps:
18+
- name: Parse Tag
19+
id: parse
20+
run: |
21+
TAG="${{ github.ref_name }}"
22+
23+
if [[ $TAG =~ ^V-([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
24+
# Release tag format: V-major.minor.patch
25+
VERSION="${BASH_REMATCH[1]}"
26+
IS_PRERELEASE="false"
27+
BETA_VERSION=""
28+
RELEASE_NAME="INAV-XITL-${VERSION}"
29+
elif [[ $TAG =~ ^Beta-([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)$ ]]; then
30+
# Pre-release tag format: Beta-major.minor.patch-betaVersion
31+
VERSION="${BASH_REMATCH[1]}"
32+
BETA_VERSION="${BASH_REMATCH[2]}"
33+
IS_PRERELEASE="true"
34+
RELEASE_NAME="INAV-XITL-${VERSION}-Beta-${BETA_VERSION}"
35+
else
36+
echo "Invalid tag format: $TAG"
37+
exit 1
38+
fi
39+
40+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
41+
echo "is-prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
42+
echo "beta-version=${BETA_VERSION}" >> $GITHUB_OUTPUT
43+
echo "release-name=${RELEASE_NAME}" >> $GITHUB_OUTPUT
44+
45+
download-artifacts:
46+
needs: parse-tag
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Find Latest CI Run
53+
id: find-run
54+
run: |
55+
# Get the latest successful CI workflow run on main branch
56+
RUNS=$(gh run list --branch main --workflow ci.yml --status success --json databaseId,createdAt --limit 1)
57+
58+
if [ -z "$RUNS" ]; then
59+
echo "No successful CI runs found"
60+
exit 1
61+
fi
62+
63+
RUN_ID=$(echo "$RUNS" | jq -r '.[0].databaseId')
64+
echo "run-id=${RUN_ID}" >> $GITHUB_OUTPUT
65+
echo "Found CI run: ${RUN_ID}"
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Download Windows Artifact
70+
run: |
71+
gh run download ${{ steps.find-run.outputs.run-id }} --dir ./artifacts-win --pattern "*Windows*" --repo ${{ github.repository }}
72+
echo "Downloaded Windows artifact"
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Download Linux Artifact
77+
run: |
78+
gh run download ${{ steps.find-run.outputs.run-id }} --dir ./artifacts-linux --pattern "*Linux*" --repo ${{ github.repository }}
79+
echo "Downloaded Linux artifact"
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Create Release Assets
84+
id: create-assets
85+
run: |
86+
RELEASE_NAME="${{ needs.parse-tag.outputs.release-name }}"
87+
88+
# Create Windows ZIP - zip the contents directly without nested structure
89+
WIN_ARTIFACT=$(find ./artifacts-win -maxdepth 2 -type d -name "Aircraft" | head -1 | xargs dirname)
90+
if [ -z "$WIN_ARTIFACT" ]; then
91+
WIN_ARTIFACT=$(find ./artifacts-win -maxdepth 1 -type d ! -name "." ! -name ".." | head -1)
92+
fi
93+
cd "$WIN_ARTIFACT"
94+
zip -r "../../${RELEASE_NAME}-Windows.zip" . -x ".*"
95+
cd - > /dev/null
96+
97+
# Create Linux ZIP - zip the contents directly without nested structure
98+
LINUX_ARTIFACT=$(find ./artifacts-linux -maxdepth 2 -type d -name "Aircraft" | head -1 | xargs dirname)
99+
if [ -z "$LINUX_ARTIFACT" ]; then
100+
LINUX_ARTIFACT=$(find ./artifacts-linux -maxdepth 1 -type d ! -name "." ! -name ".." | head -1)
101+
fi
102+
cd "$LINUX_ARTIFACT"
103+
zip -r "../../${RELEASE_NAME}-Linux.zip" . -x ".*"
104+
cd - > /dev/null
105+
106+
echo "Windows asset: ${RELEASE_NAME}-Windows.zip"
107+
echo "Linux asset: ${RELEASE_NAME}-Linux.zip"
108+
109+
- name: Upload Assets as Artifacts
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: release-assets
113+
path: |
114+
INAV-XITL-*.zip
115+
116+
create-release:
117+
needs: [parse-tag, download-artifacts]
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Checkout code
121+
uses: actions/checkout@v4
122+
123+
- name: Download Release Assets
124+
uses: actions/download-artifact@v4
125+
with:
126+
name: release-assets
127+
128+
- name: Read Release Notes
129+
id: read-notes
130+
run: |
131+
NOTES=$(cat ReleaseNotes.md)
132+
# Escape newlines for GitHub Actions
133+
NOTES="${NOTES//'%'/'%25'}"
134+
NOTES="${NOTES//$'\n'/'%0A'}"
135+
NOTES="${NOTES//$'\r'/'%0D'}"
136+
echo "content=${NOTES}" >> $GITHUB_OUTPUT
137+
138+
- name: Create Release
139+
uses: softprops/action-gh-release@v2
140+
with:
141+
tag_name: ${{ github.ref_name }}
142+
name: ${{ needs.parse-tag.outputs.release-name }}
143+
body: ${{ steps.read-notes.outputs.content }}
144+
prerelease: ${{ needs.parse-tag.outputs.is-prerelease }}
145+
token: ${{ secrets.RELEASE_TOKEN }}
146+
files: |
147+
INAV-XITL-*.zip

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
// Set your X-PLane install folder to deploy the plugin directly to X-Plane while debugging
3-
//"xplane.folder" : "/home/andi/.steam/steam/steamapps/common/X-Plane 11"
4-
"xplane.folder": "D:\\SteamLibrary\\steamapps\\common\\X-Plane 11"
3+
"xplane.folder" : "/home/andi/.steam/steam/steamapps/common/X-Plane 11"
4+
//"xplane.folder": "D:\\SteamLibrary\\steamapps\\common\\X-Plane 11"
55
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## XITL - HITL (Hardware) and SITL (Software) in the loop for INAV
44

5+
![OSD](doc/img/osd.png)
56

67
Since the original X-Plane HITL plugin appears to be no longer in development, we are continuing here.
78
Name change to XITL to make it clear that HITL and SITL connections are supported equally.
@@ -22,8 +23,7 @@ New features and improvements in version 2.0:
2223
#### SITL/HITL
2324
- Rangefinder sensor with 10 m range
2425
- Simulation of a drive train (Lipo/Lion battery with different capacities and motor/propeller for realistic voltage and current)
25-
- Simulation of the reception strength (RSSI) of a virtual receiver
26-
- Failsafe simulation
26+
- Virtual RX: Simulation of the reception strength (RSSI) and failsafe
2727

2828
#### HITL
2929
- Option to use the USB transmitter/joystick connected to X-Plane

doc/img/osd.png

916 KB
Loading

doc/setup.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ Autotrim and servo autotrim have no effect in simulation (TODO).
201201

202202
INAV SITL connection is supported since v 1.4.0.
203203

204-
Start SITL in configurator-only mode (do not select X-Plane/Realflight simulator).
205-
206-
![](img/sitl_start.png)
207-
208204
Connect INav Configurator to SITL and do minimal setup:
209205

210206
![](img/sitl_cfg_connect.png)

src/OSD.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class OSD
122122
std::vector<uint16_t> toastData;
123123
uint32_t toastEndTime = 0;
124124

125-
126125
std::string activeAnalogFont = "";
127126
std::string activeDigitalFont = "";
128127
std::vector<FontBase *> fonts;

src/SimData.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ SimData::SimData() : isHitlConnected(false)
142142

143143
this->lastUpdateMS = this->lastUpdateTimeFlightLoop = 0;
144144

145+
this->df_hasJoystick = XPLMFindDataRef("sim/joystick/has_joystick");
145146
this->df_override_joystick = XPLMFindDataRef("sim/operation/override/override_joystick");
146147
this->df_control_throttle = XPLMFindDataRef("sim/cockpit2/engine/actuators/throttle_ratio_all");
147148
this->df_control_roll = XPLMFindDataRef("sim/joystick/yoke_roll_ratio");
@@ -445,6 +446,8 @@ void SimData::updateFromXPlane()
445446

446447
if (this->isHitlConnected)
447448
{
449+
450+
this->hasJoystick = XPLMGetDatai(this->df_hasJoystick) != 0;
448451
XPLMGetDatavf(this->df_rc_inputs, &this->rc_inputs[SimDataConstants::RC_CHANNEL_PITCH], 1, 1);
449452
XPLMGetDatavf(this->df_rc_inputs, &this->rc_inputs[SimDataConstants::RC_CHANNEL_ROLL], 2, 1);
450453
XPLMGetDatavf(this->df_rc_inputs, &this->rc_inputs[SimDataConstants::RC_CHANNEL_YAW], 3, 1);
@@ -602,11 +605,11 @@ void SimData::sendToINAV_HITL()
602605
(this->muteBeeper ? SIMU_MUTE_BEEPER : 0) |
603606
(this->attitude_use_sensors ? SIMU_USE_SENSORS : 0) |
604607
(this->GPSHasNewData && !this->gps_timeout ? SIMU_HAS_NEW_GPS_DATA : 0) |
605-
SIMU_EXT_BATTERY_VOLTAGE |
606-
(this->simulatePitot ? SIMU_AIRSPEED : 0) |
608+
(this->batEmulation != BATTERY_NONE ? SIMU_EXT_BATTERY_VOLTAGE : 0) |
609+
(this->simulatePitot != TPitotSimulation::None ? SIMU_AIRSPEED : 0) |
607610
(this->simulatePitot == TPitotSimulation::Failure ? SIMU2_PITOT_FAILURE : 0) |
608-
SIMU3_CURRENT_SENSOR |
609-
SIMU3_RC_INPUT |
611+
(this->batEmulation != BATTERY_NONE ? SIMU3_CURRENT_SENSOR : 0) |
612+
(this->hasJoystick ? SIMU3_RC_INPUT : 0) |
610613
(this->rangefinderSimulation != RANGEFINDER_NONE ? SIMU3_RANGEFINDER : 0) |
611614
(this->rxIsFailsafe ? SIMU3_RX_FAILSAFFE : 0);
612615

src/SimData.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ class SimData
222222
XPLMDataRef df_baro;
223223

224224
// RC Inputs
225+
XPLMDataRef df_hasJoystick;
226+
bool hasJoystick = false;
225227
XPLMDataRef df_rc_inputs;
226228
float rc_inputs[SimDataConstants::RC_INPUT_CHANNELS];
227229

src/Utils.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ namespace Utils
149149

150150
static bool IsDebuggerAttached()
151151
{
152-
#if LIN || APL
153-
return ptrace(PTRACE_TRACEME, 0, 1, 0) == -1;
154-
#elif IBM
152+
#if IBM
155153
return IsDebuggerPresent();
156154
#else
157155
return false;

0 commit comments

Comments
 (0)