Each of the six available timers now handles two consecutive PWM output
channels. This also implements support for changing the group PWM
frequency in a similar manner to the ChibiOS HAL.
Enabling/disabling the timer would apply the setting to whole groups of
channels. Fix to poke the comparator so that the setting only applies to
the particular channel.
Conveniently, though not necessarily intentionally, this avoids
truncating the output pulse and causing unexpected reactions from
servos. This also preserves the old behavior.
the AP_CANManager::log_text() gets called from debug logging in
AP_DroneCAN. It is a method on a common AP_CANManager object which is
shared by multiple AP_DroneCAN threads.
if two threads call the debug log messages at the same time then we
can end up with _log_pos greater than LOG_BUFFER_SIZE (1024) and
overwrite past the end of the buffer
in the crash_dump we have for this case the next piece of memory was
hal.can[0], and the overwrite of the buffer had corrupted the
MessageRam_ structurre in the ChibiOS CAN interface code. That led to
a hardfault on receive of a CAN message
Note that this issue only happens if CAN_LOGLEVEL is set to greater
than zero, and the default is zero. So users can avoid the bug by
checking they have not changed CAN_LOGLEVEL.
Also, this is likely an issue that only happens on startup, as once
the two AP_DroneCAN threads are fully running they have the same
thread priority so can't pre-empt each other. During startup some
messages are sent from the main thread which has a different priority
to the AP_DroneCAN threads, and can thus trigger this issue
the automatic min-alt fence should not auto-enable based on altitude
if the fence has been manually disabled. This is needed to allow for a
manual landing by disabling the fence before descending
the _auto_enable_mask was try to make AUX function overrides disable
the FENCE_AUTOENABLE functionality. This isn't the right bevaviour,
both the aux function and the auto-enable should be edge triggered,
with last function taking effect
we should only add fence types to the no auto-enable mask if the
enable actually changed that type of fence. This fixes the case where
the user has both FENCE_AUTOENABLE=3 and RCn_OPTION=11. The disable
triggered by the init of the aux function was preventing the fence
from auto-enabling
this supports logging of all bxCAN and CANFD frames, which helps with
debugging tricky CAN support issues and for the development of new CAN
driver lua scripts