Jaime did the hard work on this one. He reworked notify device
selection to take place on init rather than on compile like before. The
notify decivces are mostly set on compile using preprocessor directives
based on board type. I created NTF_OREO_THEME. This will allow the
user to enable/disable the OreoLED driver. And it also allows you to
select between aircraft and rover lighting themes. This allows the Solo
to use the OreoLEDs, and doesn't waste the memory on vehicles not
equipped with Oreo LEDs. The OreoLED driver is restricted to Pixhawk 2
FCs by proprocessor directive due to memory constraints. So it will
never work by accident on another board.
There is also a new notify flag for GPS Fusion. This flag is true when
the EKF is happy with the GPS, actively using it for position
information.
Evaluated solo specific tones file vs standard px4 tones files. The
only thing the Solo had that standard ArduPilot does not have is the GPS
unplugged tone and the power off tone.
* Some tones have a different tune, which is fine. We want the Solo to
sound like ArduPilot if it is running ArduPilot.
* GPS unplugged tone abandoned. Determined to be unnecessary.
* Power off tone merged into standard px4 tones file. Smart battery
signalling a power off will make use of this tone. Has application for
any smart battery equipped vehicle, not just Solo.
* Removed all references and dependencies to `ToneAlarm_PX4_Solo.cpp`
and `ToneAlarm_PX4_Solo.h`
* Deleted `ToneAlarm_PX4_Solo.cpp` and `ToneAlarm_PX4_Solo.h` since
they're no longer needed.
This makes the display architecture closer to our other frontend/backend splits
Added check that display is initialised successfully in hw_init
Renamed _update_timer to just _timer to make more consistent with other drivers
pwm backend to drive leds.
In new Disco releases, the led sysfs api will replace the pwm sysfs
api to drive the tricolor led.
Keep pwm sysfs api for compatibility reasons.
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file. Having the makefiles
there is misleading since people try to build and realize the build is
broken.
when this is set the board RGB LED will be controlled by MAVLink
instead of internally. This is useful for cases where the LED patterns
and colours needed are specified by an external authority (such as the
OBC organisers)
- Initialize device on hw_init() method, allowing it not to be
present
- Add missing lock
- Add packed attribute to structs
- Move defines to source file
- Add missing semaphore take on bus
- Initialize device on init function rather than constructor: the
constructor may run before I2CDeviceManager is initialized since our
AP_Notify objects are static so it can't be used.
On early versions of minlure an RGB LED was wrongly placed next to the
barometer, causing trouble on it.
Additionally depending on the LED intensity it may be a pain to leave it
turned on for boards supposed to be used for bench testing. This allows
to disable the LED by software so we don't have to remove it.
- got rid of a lot of not needed defines
- allocated channels on init instead of accessing them every time
through the HAL reference
- simpliefied hw_set_rgb()
<command-line>:0:18: warning: "HAL_BOARD_LINUX" is not defined [-Wundef]
../../libraries/AP_Notify/Buzzer.h:20:5: note: in expansion of macro ‘CONFIG_HAL_BOARD’
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
^
In file included from ../../libraries/AP_Notify/Buzzer.cpp:18:0:
../../libraries/AP_Notify/Buzzer.h:20:25: warning: "HAL_BOARD_VRBRAIN" is not defined [-Wundef]
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
^
Due to the way the headers are organized changing a single change in
an AP_Notify driver would trigger a rebuild for most of the files in
the project. Time could be saved by using ccache (since most of the
things didn't change) but we can do better, i.e. re-organize the headers
so we don't have to re-build everything.
Currently, the default behaviour on linux boards tries to
write LED gpios with fixed values among them. There is no way
to declare that there are no LED GPIOs.
This commit moves the declaration of the LED Gpios in AP_HAL_Boards.h
and makes AP_Notify do nothing if no LED gpio was declared
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.
A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.
The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.
Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.
The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.
Check by false instead of checking by -1. Fix the following compiler warning
with gcc 5.1.0:
ardupilot/libraries/AP_Notify/ToneAlarm_Linux.cpp:64:13: warning: comparison of constant '-1' with boolean expression is always false [-Wbool-compare]
if (err == -1) {
^
Also change the initialization code not to use -1.