Commit Graph

63701 Commits

Author SHA1 Message Date
Thomas Watson a077e4a3ed AP_Scripting: introduce serial device simulation support
Allows a script to simulate a device attached via any serial protocol.
The script can read and write data and have it handled according to the
protocol as if exchanged over a serial port. The script can then do
protocol translation, data filtering and validation,
hardware-in-the-loop simulation, experimentation, etc., especially in
combination with the scripting protocol which lets the script itself
handle an attached device and so interpose any communication.
2024-06-27 12:00:18 +10:00
Thomas Watson 4df2a1bce7 AP_Scripting/generator: generate depends for manual functions on singletons 2024-06-27 12:00:18 +10:00
Thomas Watson c18f9f733e AP_Scripting: add writestring for serial
Enables more efficient scripting.
2024-06-27 12:00:18 +10:00
Thomas Watson d93aa15f2a AP_Scripting: refactor serial readstring
Using `luaL_Buffer` avoids the need for any heap allocation in the
common case (count <= 512 bytes) and avoids stressing out the system
heap for large reads, instead using the script heap.

Zero net flash usage change.
2024-06-27 12:00:18 +10:00
Thomas Watson e18449b1b8 AP_Scripting: use generic access userdata for serial ports
Adding another layer instead of just exposing UARTDriver bindings allows
substitution of the different functions for device simulation later.

Also take the opportunity to rework the docs a little.
2024-06-27 12:00:18 +10:00
Thomas Watson c37dba60de AP_Scripting/generator: allow disabling userdata creation from Lua
Passing -1 to the argument count for the `creation` tag (name does not
matter) will stop the generator from giving Lua a function to construct
that userdata. The C `new_<name>` function still works.
2024-06-27 12:00:18 +10:00
Thomas Watson 7fb65aece3 AP_SerialManager: allocate port IDs for scripting serial device ports 2024-06-27 12:00:18 +10:00
Peter Barker 0ee787325a AC_AutoTune: NFC whitespace, ordering and add trailing comma to enumeration 2024-06-27 10:12:30 +10:00
Pierre Kancir 396bca359d AP_Scripting: add an example to use Copter Standby mode in SITL with LUA 2024-06-27 10:11:53 +10:00
Andrew Tridgell 10c6020a66 AP_Scripting: update docs 2024-06-27 10:11:14 +10:00
Andrew Tridgell 57c8c19452 AP_Periph: show MCU temp in PPPGW web UI 2024-06-27 10:11:14 +10:00
Andrew Tridgell bcfc273799 hwdef: enable an ADC on CubePilot-PPPGW
allows for mcu temp
2024-06-27 10:11:14 +10:00
Andrew Tridgell 98479658d4 HAL_ChibiOS: support H7 at 200MHz 2024-06-27 10:11:14 +10:00
Andrew Tridgell d87404adfa AP_Scripting: added mcu_temperature binding 2024-06-27 10:11:14 +10:00
Andrew Tridgell f532f7a9e6 AP_SerialManager: added docs for SERIALn_PROTCOL=PPP 2024-06-27 10:11:14 +10:00
Andrew Tridgell 5a795ccba0 AP_Networking: added TCP reflection test
TCP to an echo server, testing bi-directional transfer
2024-06-27 10:11:14 +10:00
Andrew Tridgell 34815f9fb0 HAL_ChibiOS: scale RTS threshold to make software CTS more effective 2024-06-27 10:11:14 +10:00
Andrew Tridgell ebc4ee99a9 AP_HAL_ChibiOS: add support for GPIO pins as software CTS 2024-06-27 10:11:14 +10:00
bugobliterator b6cdb8b1a6 hwdef: fix hwdef for updated CubePilot-PPPGW 2024-06-27 10:11:14 +10:00
bugobliterator 0a0d5a3e49 AP_HAL_ChibiOS: add support for PPP on CubeOrangePlus 2024-06-27 10:11:14 +10:00
Peter Barker c388943f52 autotest: remove pointless try/except in PayloadPlaceMission 2024-06-26 19:19:19 +10:00
Peter Barker 2425023331 AP_Notify: flash green lights based off location not GPS
Your Copter in stabilize mode can flash rapid-green indicating a good DGPS lock or better, and yet your vehicle still doesn't have a good idea of where it is.

That means that your vehicle may end up RTL'ing onto a point somewhere along your flight path, when you were given an all-green indication by teh vehicle before you armed in stabilize.

Past this PR, we require the same GPS as before, but in addition we must have been happy enough with our location to set the navigation origin, *and* currently be able to get a location.

A user will receive slow-flashing blue lights if they can't currently get a location, or the navigation origin isn't set, even if they've got a "good" fix.

We also require a good location to get a solid green light - you will get a solid blue light if you can't get a location or don't have a navigation origin, even if you have a good GPS lock
2024-06-26 18:39:43 +10:00
Randy Mackay 3439ced236 AP_Mount: add Siyi ZT6 support 2024-06-26 18:37:42 +10:00
Peter Barker c55a5abcd9 AP_RCProtocol: remove redundant check for crsf telem on iomcu
the hwdef for the iomcu already removes crsf
2024-06-26 18:13:01 +10:00
bugobliterator 178cf7c2da AP_GPS: use 64 bit time in the pps interrupt callback in ublox driver 2024-06-26 17:51:31 +10:00
Andy Piper 651f4f15eb AP_RCTelemetry: use get_max_rpm_esc() 2024-06-26 17:36:54 +10:00
Andy Piper 451c1ae347 AP_OSD: use get_max_rpm_esc()
allow ESC index to be specified for OSD ESC info
2024-06-26 17:36:54 +10:00
Andy Piper 038735657a AP_ESC_Telem: add get_max_rpm_esc() 2024-06-26 17:36:54 +10:00
Andy Piper a86f4fdc8f AP_InertialSensor: move gyro and accel instance ids into AP_InertialSensor_Backend 2024-06-26 17:14:56 +10:00
Peter Barker 5911b87ae3 GCS_MAVLink: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker 563c3e7c62 AP_NavEKF3: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker 025888a7d1 AP_NavEKF2: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker 8302e0d1e2 AP_Mount: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker 8ddac54b17 AP_InertialSensor: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker 243e095b4e AP_DAL: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Peter Barker a325ddbfa9 AP_AHRS: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Leonard Hall b45b07d539 Copter: Fix rate input frame and clarify SET_ATTITUDE_TARGET 2024-06-26 11:22:54 +10:00
Leonard Hall 7047e11090 AC_AttitudeControl: Change input_quaternion to use body frame rates 2024-06-26 11:22:54 +10:00
Peter Barker 72a1b97b4c Tools: create_OEM_board.py: include line-feeds on include lines 2024-06-26 11:17:47 +10:00
Peter Barker 87909b5187 Tools: create_OEM_board.py: include defaults.parm, don't copy it 2024-06-26 11:17:47 +10:00
Peter Barker cd2a30ccda Tools: make create_OEM_board.py flake8-clean 2024-06-26 11:17:47 +10:00
Peter Barker 580199dfba AP_Logger: disable HAL_LOGGING_BLOCK_ENABLED if not HAL_LOGGING_ENABLED
HAL_LOGGING_DATAFLASH_ENABLED is set unconditionally in some hwdefs, but we still need to honour HAL_LOGGING_ENABLED
2024-06-25 18:32:41 +10:00
Clyde McQueen 0e6543f0e4 AP_NavEKF3: sub update for yaw reset and inFlight checks
on sub, request final yaw reset after diving 0.5m.
Also update rangefinder tests for sub
2024-06-25 18:09:37 +10:00
Andrew Tridgell f9ee886b2e Tools: update BlitzF745AIO bootloader 2024-06-25 12:05:40 +10:00
Andrew Tridgell ed58758ce6 hwdef: don't use DEFAULTGPIO in bootloaders
setting up a DEFAULTGPIO pulldown in bootloaders is a bad idea as it
overrides any hardware pullups that have been put in place as part of
a "hold in bootloader" mechanism. See discussion in #27360 for ELRS

note that this only impacts one board that I can see, the
BlitzF745AIO, due to the MCU vs DEFAULTGPIO interaction
2024-06-25 12:05:40 +10:00
Peter Barker 9bb343938f AP_Scripting: correct use-after-free in script statistics
run_next_script can free the script if the script runs over-time.

... so stop using data from that freed script structure!
2024-06-25 11:07:07 +10:00
Peter Barker a77a0c22a7 autotest: add test for logged script statistics 2024-06-25 11:07:07 +10:00
Peter Barker 6bb0709b22 Tools: add Copter flight option for requiring position to arm 2024-06-25 11:06:10 +10:00
Peter Barker 180484e0a6 ArduCopter: add Copter flight option for requiring position to arm
this is not quite the same as requiring a good position to arm.
2024-06-25 11:06:10 +10:00
Peter Barker 7dd50cd036 hwdef: JHEMCU-H743HD correct for rename of W25 dataflash driver 2024-06-25 11:05:22 +10:00