Skip to content

Commit ca2202e

Browse files
authored
Merge pull request #8957 from iNavFlight/release_6.1.0
Release 6.1.0 mergeback
2 parents 1ea9cf1 + 90a717e commit ca2202e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1590
-623
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ option(SITL "SITL build for host system" OFF)
1515
set(TOOLCHAIN_OPTIONS none arm-none-eabi host)
1616
if (SITL)
1717
set(TOOLCHAIN "host" CACHE STRING "Toolchain to use. Available: ${TOOLCHAIN_OPTIONS}")
18+
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
19+
set(MACOSX TRUE)
20+
endif()
1821
else()
1922
set(TOOLCHAIN "arm-none-eabi" CACHE STRING "Toolchain to use. Available: ${TOOLCHAIN_OPTIONS}")
2023
endif()
@@ -52,7 +55,11 @@ project(INAV VERSION 7.0.0)
5255

5356
enable_language(ASM)
5457

55-
set(CMAKE_C_STANDARD 99)
58+
if(MACOSX AND SITL)
59+
set(CMAKE_C_STANDARD 11)
60+
else()
61+
set(CMAKE_C_STANDARD 99)
62+
endif()
5663
set(CMAKE_C_EXTENSIONS ON)
5764
set(CMAKE_C_STANDARD_REQUIRED ON)
5865
set(CMAKE_CXX_STANDARD 11)

cmake/main.cmake

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,27 @@ set(MAIN_DEFINITIONS
99
__REVISION__="${GIT_REV}"
1010
)
1111

12-
set(MAIN_COMPILE_OPTIONS
13-
-Wall
14-
-Wextra
15-
-Wunsafe-loop-optimizations
16-
-Wdouble-promotion
17-
-Wstrict-prototypes
18-
-Werror=switch
19-
)
12+
13+
# Can't check for OSX yet at this point
14+
if(SITL)
15+
set(MAIN_COMPILE_OPTIONS
16+
-Wall
17+
-Wextra
18+
-Wdouble-promotion
19+
-Wstrict-prototypes
20+
-Werror=switch
21+
#-Wno-unknown-warning-option
22+
)
23+
else()
24+
set(MAIN_COMPILE_OPTIONS
25+
-Wall
26+
-Wextra
27+
-Wunsafe-loop-optimizations
28+
-Wdouble-promotion
29+
-Wstrict-prototypes
30+
-Werror=switch
31+
)
32+
endif()
2033

2134
macro(main_sources var) # list-var src-1...src-n
2235
set(${var} ${ARGN})

cmake/sitl.cmake

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,56 +25,65 @@ main_sources(SITL_SRC
2525
target/SITL/sim/xplane.h
2626
)
2727

28+
29+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
30+
set(MACOSX ON)
31+
endif()
32+
2833
set(SITL_LINK_OPTIONS
29-
-lrt
3034
-Wl,-L${STM32_LINKER_DIR}
31-
-Wl,--cref
32-
-static-libgcc # Required for windows build under cygwin
3335
)
3436

37+
if(${WIN32} OR ${CYGWIN})
38+
set(SITL_LINK_OPTIONS ${SITL_LINK_OPTIONS} "-static-libgcc")
39+
endif()
40+
3541
set(SITL_LINK_LIBRARIS
3642
-lpthread
3743
-lm
3844
-lc
3945
)
4046

47+
if(NOT MACOSX)
48+
set(SITL_LINK_LIBRARIS ${SITL_LINK_LIBRARIS} -lrt)
49+
endif()
50+
4151
set(SITL_COMPILE_OPTIONS
4252
-Wno-format #Fixme: Compile for 32bit, but settings.rb has to be adjusted
43-
-Wno-return-local-addr
44-
-Wno-error=maybe-uninitialized
45-
-fsingle-precision-constant
4653
-funsigned-char
4754
)
4855

56+
if(NOT MACOSX)
57+
set(SITL_COMPILE_OPTIONS ${SITL_COMPILE_OPTIONS}
58+
-Wno-return-local-addr
59+
-Wno-error=maybe-uninitialized
60+
-fsingle-precision-constant
61+
)
62+
endif()
63+
4964
set(SITL_DEFINITIONS
5065
SITL_BUILD
5166
)
5267

53-
function(generate_map_file target)
54-
if(CMAKE_VERSION VERSION_LESS 3.15)
55-
set(map "$<TARGET_FILE:${target}>.map")
56-
else()
57-
set(map "$<TARGET_FILE_DIR:${target}>/$<TARGET_FILE_BASE_NAME:${target}>.map")
58-
endif()
59-
target_link_options(${target} PRIVATE "-Wl,-gc-sections,-Map,${map}")
60-
endfunction()
61-
6268
function (target_sitl name)
69+
if(CMAKE_VERSION VERSION_GREATER 3.22)
70+
set(CMAKE_C_STANDARD 17)
71+
endif()
6372

6473
if(NOT host STREQUAL TOOLCHAIN)
6574
return()
6675
endif()
67-
76+
6877
exclude(COMMON_SRC "${SITL_COMMON_SRC_EXCLUDES}")
6978

7079
set(target_sources)
7180
list(APPEND target_sources ${SITL_SRC})
7281
file(GLOB target_c_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
7382
file(GLOB target_h_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
7483
list(APPEND target_sources ${target_c_sources} ${target_h_sources})
75-
84+
7685
set(target_definitions ${COMMON_COMPILE_DEFINITIONS})
77-
86+
7887
set(hse_mhz ${STM32_DEFAULT_HSE_MHZ})
7988
math(EXPR hse_value "${hse_mhz} * 1000000")
8089
list(APPEND target_definitions "HSE_VALUE=${hse_value}")
@@ -92,35 +101,33 @@ function (target_sitl name)
92101
target_include_directories(${exe_target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
93102
target_compile_definitions(${exe_target} PRIVATE ${target_definitions})
94103

95-
104+
96105
if(WARNINGS_AS_ERRORS)
97106
target_compile_options(${exe_target} PRIVATE -Werror)
98107
endif()
99-
108+
100109
target_compile_options(${exe_target} PRIVATE ${SITL_COMPILE_OPTIONS})
101-
110+
102111
target_link_libraries(${exe_target} PRIVATE ${SITL_LINK_LIBRARIS})
103112
target_link_options(${exe_target} PRIVATE ${SITL_LINK_OPTIONS})
104-
105-
generate_map_file(${exe_target})
106-
113+
107114
set(script_path ${MAIN_SRC_DIR}/target/link/sitl.ld)
108115
if(NOT EXISTS ${script_path})
109116
message(FATAL_ERROR "linker script ${script_path} doesn't exist")
110117
endif()
111118
set_target_properties(${exe_target} PROPERTIES LINK_DEPENDS ${script_path})
112-
target_link_options(${exe_target} PRIVATE -T${script_path})
119+
if(NOT MACOSX)
120+
target_link_options(${exe_target} PRIVATE -T${script_path})
121+
endif()
113122

114123
if(${WIN32} OR ${CYGWIN})
115124
set(exe_filename ${CMAKE_BINARY_DIR}/${binary_name}.exe)
116125
else()
117126
set(exe_filename ${CMAKE_BINARY_DIR}/${binary_name})
118127
endif()
119-
128+
120129
add_custom_target(${name} ALL
121-
cmake -E env PATH="$ENV{PATH}"
122-
${CMAKE_OBJCOPY} $<TARGET_FILE:${exe_target}> ${exe_filename}
123-
BYPRODUCTS ${hex}
130+
cmake -E copy $<TARGET_FILE:${exe_target}> ${exe_filename}
124131
)
125132

126133
setup_firmware_target(${exe_target} ${name} ${ARGN})

cmake/stm32h7.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function(target_stm32h7xx)
185185
VCP_SOURCES ${STM32H7_USB_SRC} ${STM32H7_VCP_SRC}
186186
VCP_INCLUDE_DIRECTORIES ${STM32H7_USB_INCLUDE_DIRS} ${STM32H7_VCP_DIR}
187187

188-
OPTIMIZATION -Ofast
188+
OPTIMIZATION -O2
189189

190190
OPENOCD_TARGET stm32h7x
191191

docs/LedStrip.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ The mapping between modes led placement and colors is currently fixed and cannot
237237

238238
#### Indicator
239239

240+
##### For fixed wing (INAV 6.1 onwards)
241+
242+
This mode flashes LEDs that correspond to the roll stick position. Rolling left will flash any `indicator` LED on the left half of the grid. Rolling right will flash any `indicator` on the right side of the grid.
243+
244+
##### For other platforms (all platforms pre INAV 6.1)
245+
240246
This mode flashes LEDs that correspond to roll and pitch stick positions. i.e. they indicate the direction the craft is going to turn.
241247

242248
| Mode | Direction | LED Color |

docs/SITL/SITL.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The sensors are replaced by data provided by a simulator.
1212
Currently supported are
1313
- RealFlight https://www.realflight.com/
1414
- X-Plane https://www.x-plane.com/
15+
- fl2sim [replay Blackbox Log via SITL](https://github.com/stronnag/bbl2kml/wiki/fl2sitl), uses the X-Plane protocol.
1516

1617
INAV SITL communicates for sensor data and control directly with the corresponding simulator, see the documentation of the individual simulators and the Configurator or the command line options.
1718

@@ -30,25 +31,38 @@ The following sensors are emulated:
3031
Select "FAKE" as type for all mentioned, so that they receive the data from the simulator.
3132

3233
## Serial ports+
33-
UARTs are replaced by TCP starting with port 5760 ascending. UART 1 port 5760, UART2 6761, ...
34-
By default, UART1 and UART2 are available as MSP connections.
35-
To connect the Configurator to SITL: Select TCP and connect to ```127.0.0.1:5760``` (if SITL is running on the same machine).
36-
IPv4 and IPv6 are supported, either raw addresses of hostname lookup.
34+
UARTs are replaced by TCP starting with port 5760 ascending. UART 1 port 5760, UART2 5761, ...
35+
By default, UART1 and UART2 are available as MSP connections. Other UARTs will have TCP listeners if they have an INAV function assigned.
36+
To connect the Configurator to SITL: Select TCP and connect to ```localhost:5760``` (or ```127.0.0.1:5760``` if your OS doesn't understand `localhost`) (if SITL is running on the same machine).
37+
IPv4 and IPv6 are supported, either raw addresses or host-name lookup.
3738

3839
The assignment and status of user UART/TCP connections is displayed on the console.
3940

40-
![STL-Output](assets/SITL-UART-TCP-Connecion.png)
41+
```
42+
INAV 6.1.0 SITL
43+
[SYSTEM] Init...
44+
[SIM] No interface specified. Configurator only.
45+
[EEPROM] Loaded 'eeprom.bin' (32768 of 32768 bytes)
46+
[SOCKET] Bind TCP :: port 5760 to UART1
47+
[SOCKET] Bind TCP :: port 5761 to UART2
48+
[SOCKET] ::1 connected to UART1
49+
```
4150

4251
All other interfaces (I2C, SPI, etc.) are not emulated.
4352

4453
## Remote control
45-
Joystick (via simulator) or serial receiver via USB/Serial interface are supported.
54+
MSP_RX (TCP/IP) or joystick (via simulator) or serial receiver via USB/Serial interface are supported.
55+
56+
### MSP_RX
57+
58+
MSP_RX is the default, 18 channels are supported over TCP/IP serial emulation.
4659

4760
### Joystick interface
4861
Only 8 channels are supported.
4962
Select "SIM (SITL)" as the receiver and set up a joystick in the simulator, details of which can be found in the documentation for the individual simulators.
5063

5164
### Serial Receiver via USB
65+
5266
Connect a serial receiver (e.g. SBUS) to the PC via a UART/USB adapter. Configure the receiver in the Configurator as usual.
5367

5468
The Configurator offers a built-in option for forwarding the serial data to the SITL TCP port, if SITL is started manually the following option can be used:
@@ -65,7 +79,11 @@ For this you need a FT232 module. With FT-Prog (https://ftdichip.com/utilities/)
6579
For SBUS, the command line arguments of the python script are:
6680
```python tcp_serial_redirect.py --parity E --stopbits 2 -c 127.0.0.1:[INAV-UART-PORT] COMXX 100000```
6781

68-
Note: Telemetry via return channel through the receiver is not supported by SITL (yet).
82+
### Telemtry
83+
84+
LTM and MAVLink telemetry are supported, either as a discrete function or shared with MSP.
85+
86+
RX Telemetry via a return channel through the receiver is not yet supported by SITL.
6987

7088
## OSD
7189
For the OSD the program INAV-Sim-OSD is available: https://github.com/Scavanger/INAV-SIM-OSD.
@@ -74,20 +92,22 @@ For this, activate MSP-Displayport on a UART/TCP port and connect to the corresp
7492
Note: INAV-Sim-OSD only works if the simulator is in window mode.
7593

7694
## Command line
77-
The command line options are only necessary if the SITL executable is started by hand, e.g. when debugging.
78-
For normal use, please use the SITL tab in the configurator.
95+
96+
The command line options are only necessary if the SITL executable is started by hand.
97+
98+
There is also a SITL tab in the INAV Configurator (6.1.0 and later).
7999

80100
The following SITL specific command line options are available:
81101

82102
If SITL is started without command line options, only a serial MSP / CLI connection can be used (e.g. Configurator or other application) can be used.
83103

84-
```--path``` Full path and file name to config file, if not present, eeprom.bin in the current directory is used. Example: ```C:\INAV_SITL\flying-wing.bin```
104+
```--path``` Path and file name to config file. If not present, eeprom.bin in the current directory is used. Example: ```C:\INAV_SITL\flying-wing.bin```, ```/home/user/sitl-eeproms/test-eeprom.bin```.
85105

86106
```--sim=[sim]``` Select the simulator. xp = X-Plane, rf = RealFlight. Example: ```--sim=xp```
87107

88-
```--simip=[ip]``` IP address of the simulator, if you specify a simulator with "--sim" and omit this option localhost (127.0.0.1) will be used. Example: ```--simip=172.65.21.15```
108+
```--simip=[ip]``` Hostname or IP address of the simulator, if you specify a simulator with "--sim" and omit this option IPv4 localhost (`127.0.0.1`) will be used. Example: ```--simip=172.65.21.15```, ```--simip acme-sims.org```, ```--sim ::1```.
89109

90-
```--simport=[port]``` Port number of the simulator, not necessary for all simulators. Example: ```--simport=4900```
110+
```--simport=[port]``` Port number of the simulator, not necessary for all simulators. Example: ```--simport=4900```. For the X-Plane protocol, the default port is `49000`.
91111

92112
```--useimu``` Use IMU sensor data from the simulator instead of using attitude data directly from the simulator. Not recommended, use only for debugging.
93113

@@ -100,6 +120,8 @@ Please also read the documentation of the individual simulators.
100120

101121
```--help``` Displays help for the command line options.
102122

123+
For options that take an argument, either form `--flag=value` or `--flag value` may be used.
124+
103125
## Running SITL
104126
It is recommended to start the tools in the following order:
105127
1. Simulator, aircraft should be ready for take-off
@@ -124,6 +146,8 @@ make
124146
Compile under cygwin, then as in Linux.
125147
Copy cygwin1.dll into the directory, or include cygwin's /bin/ directory in the environment variable PATH.
126148

149+
If the build fails (segfault, possibly out of memory), adding `-DCMAKE_BUILD_TYPE=MinRelSize` to the `cmake` command may help.
150+
127151
#### Build manager
128152

129153
`ninja` may also be used (parallel builds without `-j $(nproc)`):
@@ -135,12 +159,12 @@ ninja
135159

136160
### Compiler requirements
137161

138-
* Modern GCC. Must be a *real* GCC, macOS faking it with clang will not work.
162+
* Modern GCC. Must be a *real* GCC, macOS faking it with clang will not work. GCC 10 to GCC 13 are known to work.
139163
* Unix sockets networking. Cygwin is required on Windows (vice `winsock`).
140164
* Pthreads
141165

142166
## Supported environments
143167

144-
* Linux on x86_64, Aarch64 (e.g. Rpi4), RISC-V (e.g. VisionFive2)
168+
* Linux on x86_64, ia-32, Aarch64 (e.g. Rpi4), RISCV64 (e.g. VisionFive2)
145169
* Windows on x86_64
146170
* FreeBSD (x86_64 at least).

src/main/cms/cms_menu_osd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ static const OSD_Entry menuOsdElemsEntries[] =
190190
OSD_ELEMENT_ENTRY("TIME (HOUR)", OSD_RTC_TIME),
191191
OSD_ELEMENT_ENTRY("FLY MODE", OSD_FLYMODE),
192192
OSD_ELEMENT_ENTRY("NAME", OSD_CRAFT_NAME),
193-
OSD_ELEMENT_ENTRY("THR. (MANU)", OSD_THROTTLE_POS),
194-
OSD_ELEMENT_ENTRY("THR. (MANU/AUTO)", OSD_THROTTLE_POS_AUTO_THR),
193+
OSD_ELEMENT_ENTRY("THR. ", OSD_THROTTLE_POS),
194+
OSD_ELEMENT_ENTRY("THR. (SCALED)", OSD_SCALED_THROTTLE_POS),
195195
OSD_ELEMENT_ENTRY("SYS MESSAGES", OSD_MESSAGES),
196196
OSD_ELEMENT_ENTRY("VTX CHAN", OSD_VTX_CHANNEL),
197197
OSD_ELEMENT_ENTRY("CURRENT (A)", OSD_CURRENT_DRAW),

src/main/common/encoding.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#include "platform.h"
1919

20-
FILE_COMPILE_FOR_SPEED
21-
2220
#include "encoding.h"
2321

2422
/**

src/main/common/filter.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#include "platform.h"
2424

25-
FILE_COMPILE_FOR_SPEED
26-
2725
#include "common/filter.h"
2826
#include "common/maths.h"
2927
#include "common/utils.h"
@@ -318,7 +316,6 @@ FAST_CODE void biquadFilterUpdate(biquadFilter_t *filter, float filterFreq, uint
318316
filter->y2 = y2;
319317
}
320318

321-
FUNCTION_COMPILE_FOR_SIZE
322319
void initFilter(const uint8_t filterType, filter_t *filter, const float cutoffFrequency, const uint32_t refreshRate) {
323320
const float dT = US2S(refreshRate);
324321

@@ -335,7 +332,6 @@ void initFilter(const uint8_t filterType, filter_t *filter, const float cutoffFr
335332
}
336333
}
337334

338-
FUNCTION_COMPILE_FOR_SIZE
339335
void assignFilterApplyFn(uint8_t filterType, float cutoffFrequency, filterApplyFnPtr *applyFn) {
340336
*applyFn = nullFilterApply;
341337
if (cutoffFrequency) {

src/main/common/fp_pid.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
#include "platform.h"
2626

27-
FILE_COMPILE_FOR_SPEED
28-
2927
#include <math.h>
3028
#include "common/fp_pid.h"
3129

0 commit comments

Comments
 (0)