Commit Graph

38194 Commits

Author SHA1 Message Date
Thomas Watson
71be1194cb AP_Filesystem: FATFS: clean up error handling
Remove redundant checks of the stream, cases that could never occur
(both before and after combining allocations), and clarify errno
propagation.
2025-02-25 11:17:50 +11:00
Thomas Watson
b9cad62acf AP_Filesystem: FATFS: combine file allocations
The file handle and object are always allocated together. Combine them
to avoid overhead from extra allocations and additional error cases.

Also simplify by using strdup for the pathname.
2025-02-25 11:17:50 +11:00
Peter Barker
dbffd74fb5 AP_RangeFinder: stop using ownptr for i2c device 2025-02-25 11:12:06 +11:00
Peter Barker
cf1a1ec88b AP_Rangefinder: request measurement for timer routine to collect
the timer routing attempts to read a reading off the bus straihgt-up, but after initialisation the sensor will not be attempting to provide one, so this will always fail.

Request a sample as the last thing we do in the init routine
2025-02-25 11:12:06 +11:00
Peter Barker
e17c3127b1 add teraranger simulator 2025-02-25 11:12:06 +11:00
Peter Barker
0862ec445f SITL: sort i2c include list
will reduce conflicts on various branches if we keep these sorted
2025-02-25 11:12:06 +11:00
Andrew Tridgell
500d190df3 AP_GPS: prevent NULL ptr deref
if we get an unexpected VALSET NACK we could dereference NULL. This
could happen if we reboot while configuring an invalid key
2025-02-25 11:08:56 +11:00
Andrew Tridgell
69c540a0de AP_GPS: fixed the check for disabling CONFIG_RATE_SOL config
we should stop looking for SOL as soon as we know we have PVT, instead
of waiting for all others to be cleared

may help with
https://discuss.ardupilot.org/t/fc-tries-to-config-gps-constantly-when-trying-to-arm-in-loiter-mode/129930
2025-02-25 11:08:56 +11:00
Henry Wurzburg
2ba548bb27 AP_BattMonitor: add AUTOLAND as LOW volt batt failsafe 2025-02-25 11:06:38 +11:00
Willian Galvani
19e10577df SRV_Channel: initialize focus and zoom with 1000 range 2025-02-25 08:18:05 +09:00
Willian Galvani
4bdcb2883e AP_Camera: allow focus and zoom control with servos 2025-02-25 08:18:05 +09:00
Peter Barker
827c8d5f88 AP_Airspeed: inline get_pressure
this doesn't gain us anything; it's a private function which is only called in one place and replicates checks that the caller already makes (it devolves into a one-liner, essentially!)

This method is also confusing as it sits next to "get_temperature" in the code, which is actually a match for get_differential_pressure, not get_pressure

... but the chief advantage IMO is not updating the healthy state in this method.
2025-02-25 08:37:41 +11:00
Peter Barker
d0824a8d9b AP_BattMonitor: add Copter brake/land failsafe action to parameter metadata 2025-02-24 22:42:33 +11:00
Iampete1
fc47d7c2d0 AP_BoardConfig: SAFETY_MASK include full 32 channels in docs 2025-02-24 14:53:08 +11:00
Shiv Tyagi
5f1d3dac68 AP_HAL_ChibiOS: use new AP_PERIPH_MSP_ENABLED define 2025-02-23 10:28:54 +11:00
Shiv Tyagi
e1e074bc09 AP_HAL_ChibiOS: use new AP_PERIPH_RELAY_ENABLED define 2025-02-23 08:58:36 +11:00
Thomas Watson
e696a83371 AP_Filesystem: LittleFS: avoid leaking directory on close error 2025-02-22 09:46:33 -05:00
Thomas Watson
0246b03424 AP_Filesystem: LittleFS: use NEW_NOTHROW instead of new
Unfortunate CI did not catch this...
2025-02-22 09:46:33 -05:00
Thomas Watson
232f6524f6 AP_Scripting: patch vendored Lua to 5.3.6
In particular this fixes some exceedingly rare/impossible
use-after-frees.

Add the new docs from the distribution and clarify where we get our code
from. To maintain our alterations, the following patches have been
applied to the source from upstream's repository (1221e987...75ea9ccb)
to bring the source up to date:

* Bug: Long brackets with a huge number of '=' causes overflow

  A long bracket with too many equal signs can overflow the 'int' used for
  the counting and some arithmetic done on the value. Changing the counter
  to 'size_t' avoids that. (Because what is counted goes to a buffer, an
  overflow in the counter will first raise a buffer-overflow error.)

* Fixed bug in 'lua_upvaluejoin'

  Bug-fix: joining an upvalue with itself could cause a use-after-free
  crash.

* Fixed typos in comments

* Fixed missing GC barriers in compiler and undump

  While building a new prototype, the GC needs barriers for every object
  (strings and nested prototypes) that is attached to the new prototype.

* Updated release number and copyright year

* Fixed bug: invalid mode can crash 'io.popen'

* Fixed bug: Negation overflow in getlocal/setlocal

* 'realloc' can fail when shrinking a block

  According to ISO C, 'realloc' can fail when shrinking a block. If that
  happens, 'l_alloc' simply ignores the fail and returns the original
  block.

* Fixed bug of long strings in binary chunks

  When "undumping" a long string, the function 'LoadVector' can call the
  reader function, which can run the garbage collector, which can collect
  the string being read. So, the string must be anchored during the call
  to 'LoadVector'.
2025-02-22 14:45:30 +00:00
Shiv Tyagi
297ec3fa7c AP_Scripting: use new AP_PERIPH_RC_OUT_ENABLED define 2025-02-22 18:26:07 +11:00
Shiv Tyagi
11e42a94d0 AP_HAL_ChibiOS: use new AP_PERIPH_RC_OUT_ENABLED define 2025-02-22 18:26:07 +11:00
SULILG
1793c4c5f1 AP_HAL_ChibiOS_hwdef : Modify the LED on the SULILGH7-P1-P2 flight controller 2025-02-22 14:03:06 +11:00
Bob Long
8d427dd229 GCS_Common: fix missing #if for CAMERA_FOV_STATUS 2025-02-22 13:52:51 +11:00
Peter Barker
922f86a7ed AP_GPS: correct uBlox config debugging 2025-02-21 21:47:51 -05:00
Shiv Tyagi
0197220bc5 AP_HAL_ChibiOS: use new AP_PERIPH_HOBBYWING_ESC define 2025-02-20 21:56:14 +11:00
Shiv Tyagi
44d07c8f79 AP_Scripting: use new AP_PERIPH_NOTIFY_ENABLED define 2025-02-20 13:32:20 +11:00
Shiv Tyagi
85b3d6a625 AP_HAL_ChibiOS: use new AP_PERIPH_NOTIFY_ENABLED define 2025-02-20 13:32:20 +11:00
Shiv Tyagi
49755d6212 AP_HAL_ChibiOS: use new AP_PERIPH_EFI_ENABLED define 2025-02-20 13:05:19 +11:00
Shiv Tyagi
ab725360c1 AP_HAL_ChibiOS: use new AP_PERIPH_ADSB_ENABLED define 2025-02-20 12:06:00 +11:00
Peter Barker
dac5269af1 AP_RangeFinder: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
2ec34d1b05 AP_Proximity: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
a6d88fd25e AP_Compass: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
51d202fd8a AP_Baro: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
68969e110e AP_Airspeed: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
3e9cb2554e RC_Channel: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
f2104c97d8 AP_Mount: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
bc848d2bed AP_InertialSensor: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
c31d654623 AP_HAL_ChibiOS: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
4d39f80d4c AP_GyroFFT: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
5a2ef8e960 AP_Generator: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
1ec35b57f3 AP_DroneCAN: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
c4428d82cb AP_Declination: mark declination tables as __EXTFLASHFUNC__ 2025-02-19 18:01:48 +11:00
Peter Barker
9351963f78 AP_CANManager: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
b9efab548c AP_BattMonitor: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
65fca2a37d AP_HAL: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
Peter Barker
3bcd04c4c9 AP_HAL_Linux: move AP_Airspeed configuration into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
1f102d8fb9 AP_Airspeed: move AP_Airspeed configuration into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
cbdaf2be46 AP_InertialSensor: move AP_InertialSensor configuration into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
e3e5199e53 AP_HAL_Linux: move AP_InertialSensor configuration into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
c9e4a7d195 AP_HAL_Linux: move defaulting of ublox speed change into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
8f420defc1 AP_GPS: move defaulting of ublox speed change into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
5181350909 AP_OpticalFlow: move enabling of Onboard OF into bebop hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
05bc0c0669 AP_HAL_Linux: move enabling of Onboard OF into bebop hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
64633197cf AP_Relay: move defaulting of relay pin params to linux hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
82ab52a7bf AP_HAL_Linux: move defaulting of relay pin params to linux hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
b377a00ae3 AP_HAL: move defaulting of relay pin params to linux hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
640231c6d5 AP_HAL_Linux: move custom compass rotation into linux hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
c7a9054d14 AP_Compass: move custom compass rotation into linux hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
e26ee85cf6 AP_RangeFinder: move enabling of specific rangefinders into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
0feb2d2f53 AP_HAL_Linux: move enabling of specific rangefinders into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
052914c38f AP_HAL_Linux: move analogue battmonitor configs into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
98570f6456 AP_HAL: move analogue battmonitor configs into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
d22346c3f6 AP_BattMonitor: move analogue battmonitor configs into linux hwdef 2025-02-19 15:42:52 +11:00
Peter Barker
5341690431 AP_Notify: use linux hwdefs to define AP_Notify information 2025-02-19 15:42:52 +11:00
Peter Barker
e6d5efe456 AP_HAL_Linux: use linux hwdefs to define AP_Notify information 2025-02-19 15:42:52 +11:00
Peter Barker
5a60fc1faf AP_HAL: use linux hwdefs to define AP_Notify information 2025-02-19 15:42:52 +11:00
Peter Barker
dddb4583a6 AP_InertialSensor: start tidying Linux GPIO 2025-02-19 15:42:52 +11:00
Peter Barker
a8374a28f3 AP_HAL_Linux: start tidying Linux GPIO 2025-02-19 15:42:52 +11:00
Peter Barker
6d1cea44dd AP_HAL: start tidying Linux GPIO 2025-02-19 15:42:52 +11:00
Peter Barker
eaf0feef44 AP_HAL_Linux: specify Linux SPI devices in hwdefs 2025-02-19 15:42:52 +11:00
Peter Barker
d60a7e5f93 AP_HAL_Linux: factor functionality in hwdef.py classes 2025-02-19 15:42:52 +11:00
Peter Barker
0c0278a70d AP_HAL: factor functionality in hwdef.py classes 2025-02-19 15:42:52 +11:00
Peter Barker
51729e62a5 AP_HAL_ChibiOS: factor functionality in hwdef.py classes 2025-02-19 15:42:52 +11:00
Peter Barker
d0510b0a26 AP_HAL_ChibiOS: chibios_hwdef.py: inherit from hwdef.py 2025-02-19 15:42:52 +11:00
Peter Barker
6004ed44c7 AP_HAL_Linux: add and use linux_hwdef.py
like chibios_hwdef.py - but for Linux
2025-02-19 15:42:52 +11:00
Peter Barker
7ce9ec2c61 AP_HAL: add and use linux_hwdef.py
like chibios_hwdef.py - but for Linux
2025-02-19 15:42:52 +11:00
Peter Barker
d31889854c chibios_hwdef.py: prune out unused hal.i2c_mgr parsing code
we have GET_I2C_DEVICE now-adays
2025-02-19 15:42:52 +11:00
Henry Wurzburg
984409ca82 RC_Channel: add AUTOLAND AUX Function 2025-02-19 10:51:25 +11:00
Randy Mackay
ebbf3998b6 AP_Proximity: add Hexsoon radar support 2025-02-18 16:38:12 +09:00
Randy Mackay
7fbad0bea3 AP_Arming: integrate NanoRadar to RadarCAN rename 2025-02-18 16:38:12 +09:00
Randy Mackay
0abb0a70f0 AP_RangeFinder: integrate RadarCAN rename 2025-02-18 16:38:12 +09:00
Randy Mackay
4f3981ce27 AP_CANManager: rename NanoRadar to RadarCAN 2025-02-18 16:38:12 +09:00
Iampete1
9da6be2ef8 RC_Channel: Document EKF lane switch and yaw reset aux functions. 2025-02-18 14:19:51 +09:00
Thomas Watson
7a6861e28d AP_Filesystem: FATFS: drop tty check logic
In Standard C, the first three file descriptors are usually standard in,
out, and error. However, ArduPilot doesn't have a concept of this and
other backends (such as LittleFS) don't bother to reject them.

Remove this logic to simplify implementation and allow use of more open
files.
2025-02-18 12:33:37 +11:00
Peter Barker
5fcac2b304 SITL: add instructions for testing MaxSonarI2CXL in SITL 2025-02-18 11:34:10 +11:00
Peter Barker
fd1ade76ca SITL: clamp rangefinder distance to 0m
our starting positions are often underground
2025-02-18 11:34:10 +11:00
Peter Barker
e348c6e7a3 AP_Rangefinder: avoid OwnPtr for MaxSonarI2CXL I2CDevice 2025-02-18 11:34:10 +11:00
abaghiyan
9893017f3c AP_TECS: Corrected formula for _TASmin according to fix in formula for the load factor
To connect loadFactor to airspeed we can use formula of balancing between lift force and gravity force:
liftForce = loadFactor * gravityForce; on the other hand lift force can be expressed as
liftForce = 0.5 * lifCoefficient * airDensity * sq(airspeed) * referenceArea; minimum airseepd is at loadFactor = 1
and lift force only balances the gravit force, so gravity force (which is same as lift force at minimum airspeed) with minimum airspeed can be expressed as
gravityForce = 0.5 * lifCoefficient * airDensity * sq(airspeed_min) * referenceArea; substituting gravit force in previous formula gives us
0.5 * lifCoefficient * airDensity * sq(airspeed) * referenceArea = loadFactor * 0.5 * lifCoefficient * airDensity * sq(airspeed_min) * referenceArea;
from where we get:
loadFactor = sq(airspeed / airspeed_min); and_TASmin should be
_TASmin *= safe_sqrt(_load_factor);
2025-02-18 10:53:06 +11:00
SULILG
59e0f5cc84 AP_HAL_ChibiOS : add SULILGH7 board 2025-02-17 19:50:16 +11:00
Iampete1
494af643b5 GCS_MAVLink: move from MAV_MODE enum to uint8_t 2025-02-17 17:20:24 +11:00
Iampete1
a74f0b35c7 RC_Channel: add docs for copter inflight trim 2025-02-17 17:15:10 +11:00
Thomas Watson
ec7ece3a4d AP_Filesystem: littlefs: drop singleton 2025-02-17 16:33:51 +11:00
Thomas Watson
ca3c2c7c72 AP_Logger: File: take advantage of new optimal fsync API
Now FATFS will always sync on 4K boundaries even if it gets misaligned
due to a short or forced write.

LittleFS behavior is verified identical.
2025-02-17 16:33:51 +11:00
Thomas Watson
ed2c42ede2 AP_Filesystem: new API for performing optimal fsyncs 2025-02-17 16:33:51 +11:00
Thomas Watson
182646a7e4 AP_Filesystem: littlefs: debug warn of misaligned fsyncs 2025-02-17 16:33:51 +11:00
Randy Mackay
a6c2c1527b AP_Mount: CADDX RC rate control fix 2025-02-17 13:39:44 +09:00
Shiv Tyagi
3d96c7e419 AP_HAL_ChibiOS: create and use AP_PERIPH_NETWORKING_ENABLED 2025-02-17 09:55:51 +11:00
Shiv Tyagi
15376a4908 AP_HAL_ChibiOS: replace AP_PERIPH_AIRSPEED_ENABLED with HAL_PERIPH_ENABLE_AIRSPEED 2025-02-16 10:11:10 +11:00
Thomas Watson
fb8f3488d5 AP_Filesystem: littlefs: fix lseek
lseek must return the current file position. Previously, the littlefs
version always returned 0, which broke terrain I/O as it checks that the
position returned is the one it seeked to. Fix to return the current
position, which is correctly returned from littlefs.

This problem was originally and incorrectly diagnosed as an issue with
littlefs seeking past the end of the file, but this functionality works
fine and fixing the incorrect return completely fixes terrain.

Terrain functionality was verified using `TERRAIN_DEBUG` on
KakuteH7Mini-Nand running sim on HW. Terrain data is correctly
downloaded from the GCS and loaded from the filesystem after reboot.
2025-02-14 13:29:12 +01:00
Andrew Tridgell
f1a7abb31b AP_BLHeli: fixed documentation for SERVO_BLH_3DMASK and SERVO_BLH_RVMASK
they can be combined on both BLHeli32 and AM32
2025-02-13 11:22:50 +01:00