Commit Graph

64318 Commits

Author SHA1 Message Date
Peter Barker cac2c63e72 AC_PID: remove method operator
remove the metho operator from the class.

This means this will no longer work:

Quaternion q{0,1,2,3};
q(5,6,7,8);

.... that used to set the quaternion componets, but is an odd / atypical syntax to use
2024-07-31 08:54:37 +10:00
Hayden Donald 52ba8e8513 AP_Scripting: Change serial depends HAL_GCS to AP_SERIALMANAGER
Serial bindings were dependant on HAL_GCS_ENABLED but this is not ideal, it should be dependant on AP_SERIALMANAGER_ENABLED so that serial can function without GCS
2024-07-31 08:27:34 +10:00
“Jane_ZeroOne” 7f0e7ad097 Tools: add ZeroOneX6 2024-07-30 20:07:31 +10:00
“Jane_ZeroOne” d43dd5227a AP_HAL_ChibiOS: add ZeroOneX6 2024-07-30 20:07:31 +10:00
Peter Barker 61196b7d04 autotest: add tests for iBus telemetry 2024-07-30 20:00:16 +10:00
Peter Barker 602f5bc61c autotest: correct applet-testing scripts to use contexts for scripts
means we don't leave the script lying around in case of test failure
2024-07-30 11:39:46 +10:00
Iampete1 106068818e Tools: Scripts: cygwin build: remove setting of git safe directory 2024-07-30 11:39:06 +10:00
Iampete1 f17545b4c3 Actions: Cygwin: mark repo as safe on using correct path 2024-07-30 11:39:06 +10:00
Iampete1 75d74ccf90 Actions: enviroment and scripts: fix safe directory 2024-07-30 11:39:06 +10:00
Iampete1 4df05bac28 Actions: test environment: increase timeout to 60 mins 2024-07-30 11:39:06 +10:00
Peter Barker c47b795f34 board_types.txt: add comment on limiting allocations to 10-at-a-time 2024-07-30 11:38:17 +10:00
rishabsingh3003 6929ae60f9 board_types.txt: Reserving board id for Easy Aerial 2024-07-30 11:38:17 +10:00
Iampete1 26c51a8002 AP_TemperatureSensor: add logging option to only log sensors with no source 2024-07-30 11:07:17 +10:00
Iampete1 600d9eb7a8 AP_BattMonitor: Sum: report average temperature 2024-07-30 11:00:49 +10:00
Iampete1 45647718cb AP_BattMonitor: ESC: integrate consumed mah if not provided by ESC 2024-07-30 10:59:17 +10:00
Thomas Watson dc4d1bacdd AP_Scripting: adjust string metatable setup to fix sandbox integrity
In Lua, strings are the only type that come with a default metatable.
The metatable must be shared by all string objects, and it is set to be
the `string` library table each time that library is opened. In
Ardupilot's scripting engine, the last script to load then has access to
the string metatable as the library is opened fresh for each script, as
its `string` library will have been set to the metatable.

Therefore, if two scripts are loaded, A first and B second, and script B
executes e.g. `string.byte = "haha"`, then `string.byte()` and
`s:byte()` for script B are broken. Because the metatable is shared,
this also breaks `s:byte()` for script A, which violates the integrity
of the sandbox.

Fix the issue by disabling the metatable setup functionality when the
string libary is opened, then manually opening an additional copy of the
library (which won't be given to any script) and setting it as the
string metatable during intialization.

This will break any script that modifies the string metatable for
constructive purposes, but such a script could have been broken if it
weren't the only script running anyway.
2024-07-30 10:54:00 +10:00
Peter Barker 95281e5c17 hwdef: turn monior thread back on on some boards
most of these boards probably don't need it, but to make a PR no-binary-output...
2024-07-30 10:52:36 +10:00
Peter Barker 90b2a2acaa hwdef: change HAL_NO_MONITOR_THREAD out for HAL_MONITOR_THREAD_ENABLED
... and use a default value for peripherals
2024-07-30 10:52:36 +10:00
Thomas Watson 3a834e83c7 AP_Scripting: reference script environment directly
Referencing the original function to run is of questionable value and
the only user uses it to grab the script environent from the upvalues.

Instead, use a reference to the script environment table directly.
2024-07-30 10:33:56 +10:00
Thomas Watson 15255a36e4 AP_Scripting: reference function to run separately
Some bits of the code in the require machinery use the `lua_ref` to
access the script environment. However, this can change after the script
is rescheduled and it returns an arbitrary function to run next.

Resolve this by introducing `run_ref` which is specifically a reference
to the function to run next. `lua_ref` is preserved for the script
lifetime.
2024-07-30 10:33:56 +10:00
Thomas Watson c797baa37b autotest: add test for require() after rescheduling
It can end up broken due to incorrect assumptions about the executed
function's upvalues, which might change after rescheduling.
2024-07-30 10:33:56 +10:00
Thomas Watson da006d427d AP_Scripting: add test for require() after rescheduling
It can end up broken due to incorrect assumptions about the executed
function's upvalues, which might change after rescheduling.
2024-07-30 10:33:56 +10:00
Peter Barker 58f33087ac Copter: correct skyviper-v2450 compilation 2024-07-30 10:30:44 +10:00
Peter Barker f3e980d687 Tools: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 40c3d1881c Rover: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 004764032e Blimp: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 29ff6a28d1 ArduSub: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker aec3feee25 ArduPlane: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 86faf1ac52 ArduCopter: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 7d6aeb38e4 AntennaTracker: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker be377da6a4 GCS_MAVLink: add build option to not send RC_CHANNELS_RAW
we keep this around in case we break old OSD setups
2024-07-30 10:29:58 +10:00
Peter Barker 6f5ea5a5e9 RC_Channel: rework duplicate-rc-options check to use a Bitmask
just for the memory saving.

Co-authored-by: muramura <ma2maru@gmail.com>
2024-07-30 10:28:42 +10:00
Peter Barker b358c503fb autotest: add test for detection of duplicate AuxSw values 2024-07-30 10:28:42 +10:00
Peter Barker 3c1021d208 Tools: add documentation for SIM_ENGINE_FAIL and SIM_ENGINE_MUL 2024-07-30 09:21:26 +09:00
Peter Barker 93704c573c SITL: add documentation for SIM_ENGINE_FAIL and SIM_ENGINE_MUL 2024-07-30 09:21:26 +09:00
Peter Barker 6881f42cba Copter: add a Mode method to disable crash check
prevents looking for specific modes in the crash checker
2024-07-30 09:21:26 +09:00
Peter Barker 9397ece55a AC_AutoTune: make axis-type enum-class
Co-authored-by: Andrew Tridgell <andrew@tridgell.net>
2024-07-30 10:20:26 +10:00
Iampete1 55f51eabe8 Plane: move `have_autoenabled_fences` to be private in `ModeTakeoff` 2024-07-30 09:59:01 +10:00
Peter Barker 535f806c96 Tools: make include file mistakes nicer to interpret 2024-07-30 09:57:01 +10:00
Peter Barker f3766b831a AP_HAL_ChibiOS: make include file mistakes nicer to interpret 2024-07-30 09:57:01 +10:00
Thomas Watson 6acfc98cf4 AP_Scripting: factor out ap_object checker
Reduces flash usage.

Saves ~160B.
2024-07-30 09:55:25 +10:00
Thomas Watson 212256731f AP_Scripting: improve object allocation efficiency
Make new_X return the new object instead of having to grab it to
configure it.

Saves ~1.3K.
2024-07-30 09:55:25 +10:00
Thomas Watson 3e05cd9729 AP_Scripting: factor out field access argument error
Saves ~830B.
2024-07-30 09:55:25 +10:00
Thomas Watson 575ed6224f AP_Scripting: improve binding index function efficiency
Move the string checks into the load functions to avoid duplicating it
for each binding.

Also sync up the return types to avoid an unnecessary conversion.

Saves ~1.5K.
2024-07-30 09:55:25 +10:00
Thomas Watson e66d2a1495 AP_Scripting: remove redundant memsets
Matches current generator behavior.
2024-07-30 09:55:25 +10:00
Thomas Watson 837b17e82e AP_Scripting: more intelligently manage Lua stack
The Lua stack is guaranteed to have at least LUA_MINSTACK (default 20)
slots upon entry to C. Check to see if we might need more than that
minimum and only in that case call the function to check and resize the
stack. In virtually all cases the check can then be optimized away.

Additionally remove the redundant "Out of stack" message. Lua already
says "stack overflow" and a null message is valid.

Saves ~330B.
2024-07-30 09:55:25 +10:00
Thomas Watson 7212e35fb0 AP_Scripting: slightly improve codegen
Get singleton pointer closer to where it is used.

Saves ~170B.
2024-07-30 09:55:25 +10:00
Thomas Watson 60a9f1722c AP_DroneCAN: DNA_Server: unify bitmask handling
Put documentation with each bitmask and use the object directly. Node ID
range checks can be removed as the bitmask itself checks and we don't
expect to trip them.

Substantially cleans up the code.
2024-07-30 09:49:43 +10:00
Thomas Watson 56593574a9 AP_DroneCAN: DNA_Server: miscellaneous cleanup 2024-07-30 09:49:43 +10:00
Thomas Watson 5e0bb99dbb AP_DroneCAN: DNA_Server: fix handling of empty entry
Replaces the check for a CRC of 0 with a check that the hwid is 0.
Substantially reduces 1/256 chance that a particular node ID couldn't be
stored.
2024-07-30 09:49:43 +10:00