forked from Archive/PX4-Autopilot
Added log print ability to md25 driver.
This commit is contained in:
parent
f3bfbd87b1
commit
7643106208
|
@ -49,6 +49,7 @@
|
|||
|
||||
#include <systemlib/err.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <mavlink/mavlink_log.h>
|
||||
|
||||
// registers
|
||||
enum {
|
||||
|
@ -73,6 +74,9 @@ enum {
|
|||
REG_COMMAND_RW,
|
||||
};
|
||||
|
||||
// File descriptors
|
||||
static int mavlink_fd;
|
||||
|
||||
MD25::MD25(const char *deviceName, int bus,
|
||||
uint16_t address, uint32_t speed) :
|
||||
I2C("MD25", deviceName, bus, address, speed),
|
||||
|
@ -579,6 +583,7 @@ int md25Sine(const char *deviceName, uint8_t bus, uint8_t address)
|
|||
usleep(1000000 * dt);
|
||||
t += dt;
|
||||
float speed_rpm = 60*(md25.getRevolutions1() - prev_revolution)/dt;
|
||||
mavlink_log_info(mavlink_fd, "rpm: %10.4f\n", (double)speed_rpm);
|
||||
md25.readData();
|
||||
if (t > 2.0f) break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue