Commit Graph

23330 Commits

Author SHA1 Message Date
Beat Küng 72f9371ca4 micrortps_client_main: remove unnecessary sleep(1);
... and some strange reformatting due to astyle...
2017-08-08 21:47:17 +02:00
Beat Küng 77785c01ef micrortps_client.cpp.template: avoid 0-init & check result of orb_copy 2017-08-08 21:47:17 +02:00
Beat Küng de8e0b54b6 micrortps_client_main: use new module documentation & check param range 2017-08-08 21:47:17 +02:00
Beat Küng e7d19f0a1a micrortps_client_main: add status command 2017-08-08 21:47:17 +02:00
Beat Küng 55f65b4aff Tools/message_id.py: rename to uorb_rtps_message_ids.py for clarity 2017-08-08 21:47:17 +02:00
José Roberto de Souza 925efe990d Initialize all outgoing vehicle_command_ack_s and vehicle_command_s
This will initialize those structs with zero in all fields not set
and all fields set will only be change once to the final value not
wasting CPU time zeroing it.

This will guarantee that no non-unitialized structs will have
a trash value on from_external causing it to be sent to the
MAVLink channel without need it.
2017-08-08 21:46:30 +02:00
José Roberto de Souza 7c268f4fa1 mavlink: Safely avoid send the same vehicle_command and vehicle_command_ack back
The previous approach was checking system id and component id but it
will not work in 100% of cases as external devices can send MAVLink
message with the right system id but with broadcast component id.
2017-08-08 21:46:30 +02:00
José Roberto de Souza 89a428fbfe commander: Keep vehicle_command_ack_s local
No need to keep this struct as global or alive while looping.
2017-08-08 21:46:30 +02:00
José Roberto de Souza 7082cc13e0 mavlink: Allow vehicle to receive a command_ack message and publish it to listeners 2017-08-08 21:46:30 +02:00
José Roberto de Souza a8cfd6f36a msg: Use the correctly data types on vehicle_command
Lets save a few bytes using the right data types.
2017-08-08 21:46:30 +02:00
David Sidrane 1af5ed9024 crazyflie: Use BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT 2017-08-08 21:45:01 +02:00
David Sidrane 8c1f506944 tapv1:Use BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT 2017-08-08 21:45:01 +02:00
David Sidrane b4f5e36fb1 px4fmu-v5:Add all I2C defines for all busses
Define BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT
   for I2C1-4
2017-08-08 21:45:01 +02:00
David Sidrane 64aaec4419 i2c_nuttx:Use BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT
Used the board overrideable vlaues to define the _bus_clocks
   array and initalize it.
2017-08-08 21:45:01 +02:00
David Sidrane 9644f855e3 common:Define default BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT
Define the default I2C buss frequncies that are backward compatible
   with the existing code. While allowing it the defaults to be overridden
   by a board config.

   Based on the legacy STM32 code, the I2C buss numbering starts at 1.
   The bus frequency is stored in a 0 based array. If px4_i2cbus_initialize
   returns a valid device, then the _bus-1 will act as the index to the
   busses frequency.

   A board may define BOARD_NUMBER_I2C_BUSES - the number of I2C busses
   it supports* and BOARD_I2C_BUS_CLOCK_INIT to initalize the bus
   clocks for a given busses.

   BOARD_NUMBER_I2C_BUSES - the number of busses including the *highest
                            number bus. If the board has 2 I2C
                            busses I2C1 and I2C3 BOARD_NUMBER_I2C_BUSES
                            would be set to 3

   BOARD_I2C_BUS_CLOCK_INIT - Initalization for the bus frequencies
                              by bus. A call init, with a frequency
                              less then the value used for the
                              Initalization will result in the device
                              not starting becuase the buss runs too
                              fast for it.
2017-08-08 21:45:01 +02:00
David Sidrane 9a21969189 px4_micro_hal:Define PX4_NUMBER_I2C_BUSES based on the arch/chip
PX4_NUMBER_I2C_BUSES number of busses that the HW can support
  not all of them my be usesd. I.E. The STM32F427 has 3 I2C
  busses but only I2C1 and I2C3 are used.
2017-08-08 21:45:01 +02:00
Beat Küng 98396a0bc5 frsky_telemetry: cleanup static vars, use less memory & fix process priority 2017-08-08 14:47:01 +02:00
Beat Küng cb23817317 frsky_telemetry: send flight mode & gps info
This uses the TEMP1 & TEMP2 fields, which probably were used for something
else initially. However this implementation matches with OpenTX and APM.
2017-08-08 14:47:01 +02:00
Beat Küng a2bfcb94ef frsky_telemetry D protocol: refactor to use less memory & allocations
Also add the vehicle_gps_position & flight mode information
2017-08-08 14:47:01 +02:00
Beat Küng 9dea515eaa frsky_telemetry S.Port: refactor to use less memory & allocations 2017-08-08 14:47:01 +02:00
Beat Küng cf8b6a9de1 frsky_telemetry: use new module documentation 2017-08-08 14:47:01 +02:00
Beat Küng 4e5c6fc805 frsky_telemetry: fix heading for D protocol 2017-08-08 14:47:01 +02:00
Beat Küng 1d40336723 airframes parser: add dodecarotor image 2017-08-08 11:59:00 +02:00
Peter Duerr 453937a89a Fix va_arg calls (always call va_end)
From the manpage: "Each invocation of va_start() must be matched by a
corresponding invocation of va_end() in the same function."
2017-08-07 22:05:54 +02:00
Peter Duerr b845edba64 Yet another erroneous call to `px4_close` instead of `close`
* As indicated by @bkueng
2017-08-07 22:05:17 +02:00
Peter Duerr 6e808ad0a6 Fix additional erroneous px4_close call
* As indicated by @bkueng
2017-08-07 22:05:17 +02:00
Peter Duerr 73ef772537 Fix erroneous use of px4_close
* Close handle opened with `open` with `close` as indicated by @bkueng
2017-08-07 22:05:17 +02:00
Peter Duerr 40dff737c5 Fix uninitialized values identified by cppcheck
* Replace `malloc` by `calloc` for c-string initialization
* Add initializer braces for structs
2017-08-07 22:05:17 +02:00
Peter Duerr 7cf2a49948 Cosmetic fix (silencing cppcheck)
* For some reason cppcheck complains with `fp != nullptr` but accepts truthiness
  of handle by itself.
* Note that the expressions are equivalent according to the C++ standard ("A
  prvalue of arithmetic, unscoped enumeration, pointer, or pointer to member
  type can be converted to a prvalue of type bool. A zero value, null pointer
  value, or null member pointer value is converted to false; any other value is
  converted to true. A prvalue of type std::nullptr_t can be converted to a
  prvalue of type bool; the resulting value is false.")
2017-08-07 22:05:17 +02:00
Peter Duerr cc1b766824 Fix memory leaks identified by cppcheck
* Add `free` / `delete`
* Add comment explaining the (presumed) motivation for the use of new instead of
  allocating on the stack
2017-08-07 22:05:17 +02:00
Peter Duerr 5be23060e7 Fix resource leaks identified by cppcheck
* Where possible rearrange error checks to avoid branching
* Otherwise add missing `fclose`, `close`, `px4_close` calls before return
2017-08-07 22:05:17 +02:00
Vicente Monge 0a61e9b279 micro RTPS CMakeLists.txt identation 2017-08-07 12:00:35 +02:00
Vicente Monge a93174dee4 Fix for manual/automatic micro RTPS bridge generation 2017-08-07 12:00:35 +02:00
Beat Küng 4ee9cb2e2f px4airframes markdown: always use '/' for path separation
Because it's an URL and os.path.join() will use '\' on windows.
2017-08-07 11:12:51 +02:00
Vicente Monge d1e39ed9e0 Added link to documentation and suppress local doc 2017-08-07 09:46:56 +02:00
Lorenz Meier 490f40bee1 Sensors: Use temperature for airspeed validation to avoid false positives for high-performance airspeed sensors
This is required to enable new high-performance sensors which otherwise would provide incorrect readings.
2017-08-06 20:52:37 +02:00
Lorenz Meier 45f2a52a7d Sensor startup: Simplify and fix Pixhawk 2.1
This change simplifies the sensor startup and fixes the detection of airspeed sensors on Pixhawk 2.1
2017-08-06 20:52:23 +02:00
Sander Smeets c81dd46b02 land detector VTOL inherit MC maybe_landed (#7738)
* maybe_landed state for VTOL inherited from MC
* set correct land detector for SITL
2017-08-06 10:02:56 -04:00
David Sidrane 102003c664 rc.sensors:Use HW type to refine startup / deprecate mpu9250 on PixhawkMini
Using the hwvercmp on FMUv2 HW derivatives built with px4fmu_v3_default
   to ues a more targeted startup approach:

  1) Detect V3 and V2M

  2) On V3 use the external mpu9250 to further discriminate between 2.0
     and 2.1. Then only start the devices that are on that version of
     the board.

 3) Due to HW errata on PixhawkMini deprecate mpu9250.
     The mpu9250 will not start reliably on the PixhawkMini
     Since we have an ICM20608 and an External Mag the
     mpu9250 is not to be used.
2017-08-05 19:26:20 +02:00
David Sidrane ed74530da8 mpu9250:More cleanup 2017-08-05 19:26:20 +02:00
David Sidrane 5bb084408d bmi160_main:Make the internal interface conditional on PX4_SPIDEV_BMI
px4fmuv2 had PX4_SPIDEV_BMI defined, for the v3 cmake, but never
   provided a Chip select decoded by PX4_SPIDEV_BMI. PX4_SPIDEV_BMI
   has been removed from V2, but PX4_SPIDEV_EXT_BMI still remains
   and has a chip select assigned to it.
2017-08-05 19:26:20 +02:00
David Sidrane 43843b753d px4fmu-v2, px4fmu-v3:Restruture SPI Selects and DRDY
The removes the alias so it is clear what bus and port bit
    is associated with as CS or DRDY signal.

    This becomes important when varients of V2 a) use the CS on differnt
    busses or b) swap a RDY (in) for a CS (out). In both cases,
    a CS on once buss, can back feed and cause sensor reset to not be
    able to turn off the power if all the pins are not tunered
    off
2017-08-05 19:26:20 +02:00
David Sidrane d58a802eaa px4fmu-v2:Use versioning API to only change a GPIO for pixhawkmini
Pixhawk mini has reused the GPIO_SPI_CS_EXT1 signal that was associated
   with SPI4. We can not in good faith assert a CS on a bus wer are not resetting.
   So we must do this only on HW_VER_FMUV2MIN
2017-08-05 19:26:20 +02:00
David Sidrane 553c649252 px4fmu-v2:Init GPIO_VDD_3V3_SENSORS_EN off at reset
Insure a 0.0 voltage initial condition on VDD_3V3_SENSORS
  By starting the GPIO_VDD_3V3_SENSORS_EN, low and deferring
  the GPIO init of the slave selects and drdy signals until
  board_app_initialize. We get ~ 80 ms of power off time
  with 0.00 voltage applied to the sensors.
2017-08-05 19:26:20 +02:00
David Sidrane 60ce1bc5c5 px4fmu-v2:Add GPIO_VDD_USB_VALID and initalize it 2017-08-05 19:26:20 +02:00
David Sidrane 5fd8ef1055 px4fmu-v2:Insure the discharge of the pins PWM pins on rest.
On resets invoked from system (not boot) insure we establish a low
  output state (discharge the pins) on PWM pins before they become
  inputs.
2017-08-05 19:26:20 +02:00
David Sidrane 4832ad3191 ver:Add support for HW versioning
1) Add hwtypecmp command to allow rc to further enumerate PX4FMU_V2
      for sub types of 'V2' -FMUv2  'V2M' PixhawkMini, 'V30' Cube

   2) Extend hw to report to display
      HW type
      HW version
      HW revision
2017-08-05 19:26:20 +02:00
David Sidrane afb01d015e px4fmu-v2:Use simple HW versioning API to differentiate V2 variant at runtime.
There are several boards that share the px4fmu-v2 build as px4fmu-v3 build.

   It was initially envisioned, that the build would be binary compatable and
   the RC script would probe different sensors and determine at runtime the
   HW type. Unfortunately, a failed sensor, can result in mis-detection
   of the HW and result in an improper start up and not detect the HW
   failure.

   All these boards's bootloader report board type as px4fmu-v2.
   This precludes and automated selection of the correct fw if it
   had been built, by a different build i.e. px4fmu-cube etc.

   We need a way to deal with the slight differences in HW that effect
   the operations of drivers and board level functions that are different
   from the FMUv2 pinout and bus utilization.

   1) FMUv3 AKA Cube 2.0 and Cube 2.1 Bothe I2C busses are external.
      This effected the mag on GPS2 not reporting Internal and
      having the wrong rotation applied.

   2) FMUv3 does not performa a SPI buss reset correctly.
      FMUv2 provides a SPI1 buss reset. But FMUv3 is on
      SPI4. To complicate matters the CS cross bus
      boundries.

   3) PixhawkMini reused a signal that was associated with SPI4
      as a SPI1 ready signal.

   Based on hardware differnce in the use of PB4 and PB12 this code
   detects: FMUv2,  the Cube, and PixhawkMini and provides the
   simple common API for retriving the type, version and revision.

   On FmuV5 this same API will be used.
2017-08-05 19:26:20 +02:00
David Sidrane dfdb61d2a7 board_common:Add support for simple hardware versioning
Define methods to get:
    1) The sub type of the hardware as a string.
    2) The version as an integer
    3) The revision as an integer
2017-08-05 19:26:20 +02:00
David Sidrane c8bd60bef8 Mpu9250:Allow internal reset to complete, when started from VDD of 0V
Per the data sheet: Start-up time for register read/write from power-up is
   Typically 11 ms and the Maximum is 100 ms.

   It seems the power up reset is only triggered at VDD < 150 mV. So the
   symptom reported: Failure is only happening after a long power down is
   consistent with VDD not dropping below 150 mV, therefore not generating
   a POR and being ready to be written with out delay.

  This fix adds a delay of 110 ms to ensure the reset has ended with some.
  margin.
2017-08-05 19:26:20 +02:00