Commit Graph

93 Commits

Author SHA1 Message Date
Thomas Watson
89c9e59c55 AP_DroneCAN: DNA_Server: polish db methods
No compiler output change.
2024-09-02 11:53:24 +10:00
Iampete1
5453f3a0cc AP_DroneCAN: register handle_actuator_status_Volz callback and fix logging 2024-08-27 11:18:18 +10:00
Thomas Watson
7c5a46bac2 AP_DroneCAN: DNA_Server: arrange db methods into more logical order 2024-08-20 10:22:55 +10:00
Thomas Watson
b38766c469 AP_DroneCAN: DNA_Server: clarify comments with consistent terminology 2024-08-20 10:22:55 +10:00
Thomas Watson
9669b4e85d AP_DroneCAN: DNA_Server: rename db methods to use consistent terminology
Also use snake_case like the rest of Ardupilot.
2024-08-20 10:22:55 +10:00
Thomas Watson
ddf74e2da4 AP_DroneCAN: DNA_Server: rename node record structure
Rename NodeData to NodeRecord to provide a more specific name and match
the record term used in the comments. Also nominally allows stuff to be
associated with the nodes that's not the record, as expanding the record
is hard.

Additionally, rename the `hwid` field to `uid` as that's what's used in
the rest of the code.
2024-08-20 10:22:55 +10:00
Thomas Watson
e22f26e507 AP_DroneCAN: DNA_Server: briefly document database to guide cleanup 2024-08-20 10:22:55 +10:00
Thomas Watson
e12f345bae AP_DroneCAN: DNA_Server: make lower level database tasks private
All the higher level database operations need to be locked for the whole
duration of the operation, so nobody should be using the lower-level
tasks or raw read/write functions. We can also remove the locks from
them.

The database can now safely be used by multiple servers.
2024-08-13 09:58:44 +10:00
Thomas Watson
4097e9fa42 AP_DroneCAN: DNA_Server: move allocation operation to db
Must be locked for the whole operation due to the find free/add
read-modify-write.

Preserves the previous behavior of sending back an ID of 0 in case of
allocation failure, for better or worse.
2024-08-13 09:58:44 +10:00
Thomas Watson
f406c62449 AP_DroneCAN: DNA_Server: move node info update operation to db
Must be locked for the whole operation due to the occupied check and
addition read-modify-write.
2024-08-13 09:58:44 +10:00
Thomas Watson
e79437d04a AP_DroneCAN: DNA_Server: move init operation into db
Must be locked for the whole operation due to the get/add
read-modify-write.
2024-08-13 09:58:44 +10:00
Thomas Watson
01e285c681 AP_DroneCAN: DNA_Server: move database tasks to db class
The server should not have raw read/write access to the database so the
database needs to take over the tasks.
2024-08-13 09:58:44 +10:00
Thomas Watson
a9774d2334 AP_DroneCAN: DNA_Server: move storage read/write to its own class
There is (currently) only one storage area that is used by all servers,
so it needs to be managed by its own class shared among them.

The occupied mask is also moved as it reflects the storage contents and
so can't be stored by each server.
2024-08-13 09:58:44 +10:00
Iampete1
8ec3d0f0a9 AP_DroneCAN: populate ESC power percentage 2024-08-07 11:23:35 +01:00
Pradeep CK
c7216c05b8 AP_DroneCAN: addition of ESC extended status message
- Conditional compilation definition : AP_EXTENDED_ESC_TELEM_ENABLE
 - ESCX log structure
 - Update functionalities for ESCX status message
 - ESCX DroneCAN callback
2024-08-06 10:57:36 +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
Thomas Watson
9aeab7b424 AP_DroneCAN: DNA_Server: use 0 as unknown ID
Slightly reduces flash usage and probably is clearer.
2024-07-30 09:49:43 +10:00
Thomas Watson
8d57533f1c AP_DroneCAN: DNA_Server: fix cases involving use of invalid node IDs 2024-07-30 09:49:43 +10:00
Thomas Watson
a9317b1a07 AP_DroneCAN: correct and validate allowed NODE range
Node IDs >= 128 don't exist, and IDs 126 and 127 are "reserved for
network maintenance tools" according to the spec.
2024-07-30 09:49:43 +10:00
Thomas Watson
485a9387b1 AP_DroneCAN: DNA_Server: clean up storage failure handling
The StorageManager read_block/write_block methods only return failure if
an out of bounds access is performed. Assert statically that this does
not happen.

Also remove the now-impossible failed to add node state.
2024-07-30 09:49:43 +10:00
Thomas Watson
cd8519321b AP_DroneCAN: DNA_Server: search for valid nodes after magic check
Ensures the occupation mask doesn't get populated with junk if the magic
is not valid.
2024-07-30 09:49:43 +10:00
Thomas Watson
c1f59186fa AP_DroneCAN: DNA_Server: make reset method private 2024-07-30 09:49:43 +10:00
Andrew Tridgell
35a8f6c7b2 AP_DroneCAN: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Andrew Tridgell
ed8926361f AP_DroneCAN: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Iampete1
3f6ce2dc09 AP_DroneCAN: Serial: map baudrates so param works as expected 2024-05-28 10:27:20 +10:00
Iampete1
982cc3a00f AP_DroneCAN: call RPM subscribe 2024-05-02 20:25:38 +10:00
Peter Barker
75bbff01c1 AP_DroneCAN: move Arming, Beacon and RC_Mapper into ardupilotwaf.py
these were built for all vehicles, so put them in the common list
2024-04-17 18:11:46 +10:00
Patrick José Pereira
3c095706ca DroneCAN_sniffer: Use new default for reboot
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2024-03-12 21:13:41 +11:00
Andrew Tridgell
ed27e30f9e AP_DroneCAN: map DroneCAN debug levels to MAV_SEVERITY levels 2024-02-22 15:03:01 +11:00
Iampete1
ff00d562fe AP_DroneCAN: DNA_Server: log driver index in CAND 2024-02-16 21:55:07 +11:00
Iampete1
5fd3be1b75 AP_DroneCAN: add subscribe msgs for TemperatureSensor 2024-01-30 10:13:35 +11:00
Peter Barker
dd4d017717 AP_DroneCAN: allow compilation with HAL_LOGGING_ENABLED false 2024-01-17 18:25:55 +11:00
Iampete1
c8a63a1de4 AP_DroneCAN: remove duplicate rgb_led set_timeout_ms and set_priority 2024-01-10 18:29:24 +11:00
Iampete1
69e076605e AP_DroneCAN: support streaming relay hardpoint command 2024-01-10 18:29:24 +11:00
Andrew Tridgell
77fbe1dcfb AP_DroneCAN: don't hold semaphore during CAN send
this mirrors the changes in the networking code, and ensures we don't
hold a semaphore that may be held by the main thread when we are doing
CAN sends
2024-01-10 18:07:29 +11:00
Andrew Tridgell
036ae93cbb AP_DroneCAN: reimplement with BinarySemaphore 2024-01-03 07:37:05 +11:00
Andrew Tridgell
ad59f6db01 AP_DroneCAN: support an aux 11 bit protocol with DroneCAN 2023-11-28 11:38:16 +11:00
Thomas Watson
008c0baf5f AP_DroneCAN_sniffer: use get_HAL_mutable() to install new CAN interface
Avoids dubious const_casting.
2023-11-28 08:24:25 +11:00
Andrew Tridgell
a725d8b90c AP_DroneCAN: support CAN serial ports
this allows any serial protocol to be mapped to a remote DroneCAN node
2023-11-22 17:19:12 +11:00
Andrew Tridgell
713745ed28 AP_DroneCAN: don't update hobbywing ESC table while armed
some hobbywing ESCs have a bug where requesting the ID table can cause
the ESC to stutter
2023-11-17 16:21:58 +11:00
Andrew Tridgell
4cb2562ee5 AP_DroneCAN: cope with null stats (for SLCAN interface)
this caused a crash on CubeOrange on boot if SLCAN is enabled
2023-11-15 23:52:49 -08:00
bugobliterator
fb26bbfc4c AP_DroneCAN: add support for detecting downed link 2023-11-02 15:55:21 +11:00
Mykhailo Kuznietsov
e3d9ce3fd0 AP_DroneCAN: Fix some typos
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Andrew Tridgell
3ba12d16db AP_DroneCAN: fixed sim on hw build
tested using:

Tools/scripts/sitl-on-hardware/sitl-on-hw.py --board Pixhawk6C --vehicle plane --simclass Plane --frame plane
2023-10-12 18:29:32 +11:00
Randy Mackay
1f11d5f3fc AP_DroneCAN: support string parameters 2023-09-19 10:58:52 +10:00
Andrew Tridgell
b33cf11bfb AP_DroneCAN: make himark servo support optional 2023-09-07 08:44:54 +10:00
Peter Barker
e7def98195 AP_DroneCAN: use correct define for DroneCAN GPS drivers 2023-09-03 08:43:03 +10:00
Andrew Tridgell
232509ad7a AP_DroneCAN: removed native_millis/micros 2023-08-24 13:06:40 +10:00