Andy Piper
0c6ea4790d
AP_Common: fix initialization of ExpandingString so that it can be used on the stack
...
zero out passed in buffers for ExpandingString
2024-07-24 08:24:06 +10:00
Andrew Tridgell
3a6024e8ab
AP_Common: support QURT
2024-07-12 15:56:48 +10:00
Thomas Watson
1249388f23
AP_Common: use template parameter in bitmask functions
...
Substantially improves code optimization and reduces memory usage.
2024-07-09 11:51:41 +10:00
Thomas Watson
6a4520e8fd
AP_Common: clean up bitmask operators
...
Code already won't compile if there are different numbers of bits as the
template parameter will be different.
2024-07-09 11:51:41 +10:00
Thomas Watson
b030b8e789
AP_Common: correctly bound bitmask datatypes
...
Probably won't work correctly (and of questionable use) if less than 1.
The `first_set()` function might not be able to return a valid value if
greater than INT16_MAX.
unsigned int needs to be >= uint32_t so that the shift ops are in range.
2024-07-09 11:51:41 +10:00
Thomas Watson
0b320fe303
AP_Common: unify bitmask out of bounds checking
...
Ensures out-of-bounds reads and writes are never performed for setting,
clearing, and checking. Fixes test failure when the number of bits
evenly divides the word size.
2024-07-09 11:51:41 +10:00
Thomas Watson
9a89223531
AP_Common: fix bitmask setall()
...
Fixes an issue where the last word was not set to all 1s if the number
of bits evenly divided the word size.
Also fixes UB if there were 31 valid bits.
2024-07-09 11:51:41 +10:00
Thomas Watson
122cd72d9c
AP_Common: improve bitmask test coverage
2024-07-09 11:51:41 +10:00
Thomas Watson
4a2f03f851
AP_Common: test more bitmask bit widths
...
Actually test different widths and reveal problems with edge cases.
2024-07-09 11:51:41 +10:00
Thomas Watson
521cf00964
AP_Common: templatify bitmask tests
...
Enables testing of different widths and edge cases.
2024-07-09 11:51:41 +10:00
Randy Mackay
b6c5ad450d
AP_Common: char_to_hex returns 0 on invalid char
2024-07-09 09:08:51 +10:00
Andrew Tridgell
db19bce1d2
AP_Common: wrap _malloc_r on cygwin
...
fixes dual allocation heap bug
See https://cygwin.com/pipermail/cygwin/2000-July/038916.html
2024-07-07 07:11:59 +10:00
Peter Barker
1d945cc5ac
AP_Common: Location: allow retrieval of Vector3p from vector-from-origin
2024-06-11 19:50:18 +10:00
Peter Barker
911375fa9a
AP_Common: rearrange get_vector_from_origin_NEU to be less destructive
...
this change means that if the origin call failes we don't half-update the object before returning false
2024-06-11 09:47:14 +10:00
Andrew Tridgell
5620fee636
AP_Common: use NEW_NOTHROW for new(std::nothrow)
2024-06-04 09:20:21 +10:00
Andrew Tridgell
aa2f885e2f
AP_Common: added checks for new without std::nothrow
...
and add NEW_NOTHROW macro
2024-06-04 09:20:21 +10:00
Iampete1
1b1ce9530c
AP_Common: add `get_distance_NED_alt_frame` method
2024-04-30 08:03:39 +09:00
Peter Barker
44359ff6b2
AP_Common: add get_alt - 100 times better than get_alt_cm
2024-04-16 19:14:12 +10:00
Peter Barker
5488ca6403
AP_Common: add ASSERT_STORAGE_SIZE macro
...
saves havin gto name the dummy variable yourself
2024-01-22 22:44:05 +11:00
Ryan Friedman
76861eaa9b
AP_Common: Define units for locatoin data members
...
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-12-20 02:37:01 +00:00
Mykhailo Kuznietsov
4e7d5e9ecf
AP_Common: Fix some typos
...
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Peter Barker
61be71eea6
AP_Common: make Location.cpp compile without AP::ahrs() available
2023-10-04 18:10:58 +11:00
Peter Barker
72f485b5a5
AP_Common: remove unused Location constructor from Vector3d
...
Replaced with AHRS method
2023-09-12 09:29:26 +10:00
Peter Barker
a9c62fa565
AP_Common: Location: add offset(Vector3p &ned_offset)
2023-09-12 09:29:26 +10:00
Andy Piper
d94e36fccc
AP_Common: ensure that constants are float not double if not otherwise declared
...
use correct DOUBLE_PRECISION_SOURCES definition
portably define qsort argument in tests
fix test_location
add test_location to double sources
2023-08-02 16:22:59 +01:00
Andrew Tridgell
2d28b59661
AP_Common: removed set_blocking_writes
...
and moved to top level locking in UARTs
2023-07-12 17:06:02 +10:00
Peter Barker
e659667f03
AP_Common: move implemenation of ap_mktime (NFC)
2023-06-27 11:25:11 +10:00
Peter Barker
4124c6ed3f
AP_Common: move AP_RTC::mktime to be ap_mktime
...
in preparation for AP_RTC_ENABLED
2023-06-27 11:25:11 +10:00
Ryan Friedman
1cb8bf6308
AP_Common: Remove type punning utils to AP_Math
...
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-06-05 09:09:13 +10:00
Ryan Friedman
d40b02fbbd
AP_Common: Add type-punning alternative
...
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-06-05 09:09:13 +10:00
Peter Barker
5333f404d3
AP_Common: pre-declare print_vprintf
...
these seem to override a soft symbol somewhere, so can't be static or be removed or the tests fail
2023-05-20 17:28:08 +10:00
Nick Exton
76e8407297
AP_Common: Add same_loc_as function to Location
2023-04-04 09:40:45 +10:00
Nick Exton
c445bb5f9e
AP_Common: Add same_alt_as function to Location
2023-04-04 09:40:45 +10:00
Andy Piper
07532eaf2f
AP_Common: NOINLINE is now defined in ChibiOS
2023-03-29 20:49:40 +11:00
bugobliterator
ac905caae9
AP_Common: add return to strncpy_noterm
2023-03-29 17:16:39 +11:00
Peter Barker
44dad72dd9
AP_Common: correct example for BufferPrinter changes
2023-03-22 17:59:11 +11:00
Tom Pittenger
ea35b28b22
AP_Common: add NMEA output to a buffer
2023-02-07 21:12:07 +11:00
Peter Barker
1dff5b5710
AP_Common: avoid using struct Location
...
clang reports this could be a problem when compiling under some EABIs. Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
2023-02-04 22:51:54 +11:00
Andrew Tridgell
22a16f9672
AP_Common: added MultiHeap class
...
for scripting allocation with multiple heaps
2023-01-16 09:19:16 +11:00
Peter Barker
04adfc814a
AP_Common: use Vector3f.xy() to avoid creating a fresh Vector2f
2022-11-16 17:59:29 +11:00
Andrew Tridgell
4121cc464d
AP_Common: added Float16_t type
2022-10-23 12:14:14 +11:00
Andrew Tridgell
9d42f49ac8
AP_Common: added setonoff() method for bitmask
2022-10-11 11:47:04 +11:00
jackhong12
4a4f361a17
all: use CLASS_NO_COPY() macro
2022-10-04 11:23:04 +11:00
Andrew Tridgell
cda3fb6368
AP_Common: added BIT_IS_SET_64()
2022-09-06 10:49:50 +10:00
Peter Barker
d092e767ea
AP_Common: correct gtests
...
AFAIK it's invalid to new a zero-length array.
2022-08-15 07:39:39 +10:00
bugobliterator
3c87062f27
AP_Common: add support for comparing BitMasks
2022-07-27 18:18:03 +10:00
Peter Barker
5286ad45ad
AP_Common: AP_FWVersion doesn't need mavlink headers
2022-07-16 17:15:52 +10:00
Peter Barker
c085b713ac
AP_Common: correct comments on get_alt_cm and change_alt_frame
2022-06-30 20:08:24 +10:00
François Carouge
772c80a038
AP_Common: class template parameters not compliant in constructor declaration
2022-06-28 11:05:53 +10:00
Ruffalo-sunghwan
988eb67298
AP_Common : correct comment spelling
2022-05-24 20:27:45 +09:00