aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/hott
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-05-13 08:38:07 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-05-13 08:38:07 +0200
commitf10395e05a9fc11b36f70f6a9d864e83b6eadc01 (patch)
tree5d88468ec766370059d16fe5b5ed94157c877371 /src/drivers/hott
parent37970c58284591bd994f0320e7656c1106be505b (diff)
downloadpx4-firmware-f10395e05a9fc11b36f70f6a9d864e83b6eadc01.tar.gz
px4-firmware-f10395e05a9fc11b36f70f6a9d864e83b6eadc01.tar.bz2
px4-firmware-f10395e05a9fc11b36f70f6a9d864e83b6eadc01.zip
HoTT driver: Add timestamp, rename function-level variable from _esc to esc to match conventions
Diffstat (limited to 'src/drivers/hott')
-rw-r--r--src/drivers/hott/messages.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/drivers/hott/messages.cpp b/src/drivers/hott/messages.cpp
index fe8ad6a9e..1e779e8dc 100644
--- a/src/drivers/hott/messages.cpp
+++ b/src/drivers/hott/messages.cpp
@@ -51,6 +51,8 @@
#include <uORB/topics/sensor_combined.h>
#include <uORB/topics/vehicle_gps_position.h>
+#include <drivers/drv_hrt.h>
+
/* The board is very roughly 5 deg warmer than the surrounding air */
#define BOARD_TEMP_OFFSET_DEG 5
@@ -103,24 +105,25 @@ publish_gam_message(const uint8_t *buffer)
size_t size = sizeof(msg);
memset(&msg, 0, size);
memcpy(&msg, buffer, size);
- struct esc_status_s _esc;
- memset(&_esc, 0, sizeof(_esc));
+ struct esc_status_s esc;
+ memset(&esc, 0, sizeof(esc));
// Publish it.
- _esc.esc_count = 1;
- _esc.esc_connectiontype = ESC_CONNECTION_TYPE_PPM;
+ esc.timestamp = hrt_absolute_time();
+ esc.esc_count = 1;
+ esc.esc_connectiontype = ESC_CONNECTION_TYPE_PPM;
- _esc.esc[0].esc_vendor = ESC_VENDOR_GRAUPNER_HOTT;
- _esc.esc[0].esc_rpm = (uint16_t)((msg.rpm_H << 8) | (msg.rpm_L & 0xff)) * 10;
- _esc.esc[0].esc_temperature = msg.temperature1 - 20;
- _esc.esc[0].esc_voltage = (uint16_t)((msg.main_voltage_H << 8) | (msg.main_voltage_L & 0xff));
- _esc.esc[0].esc_current = (uint16_t)((msg.current_H << 8) | (msg.current_L & 0xff));
+ esc.esc[0].esc_vendor = ESC_VENDOR_GRAUPNER_HOTT;
+ esc.esc[0].esc_rpm = (uint16_t)((msg.rpm_H << 8) | (msg.rpm_L & 0xff)) * 10;
+ esc.esc[0].esc_temperature = msg.temperature1 - 20;
+ esc.esc[0].esc_voltage = (uint16_t)((msg.main_voltage_H << 8) | (msg.main_voltage_L & 0xff));
+ esc.esc[0].esc_current = (uint16_t)((msg.current_H << 8) | (msg.current_L & 0xff));
/* announce the esc if needed, just publish else */
if (_esc_pub > 0) {
- orb_publish(ORB_ID(esc_status), _esc_pub, &_esc);
+ orb_publish(ORB_ID(esc_status), _esc_pub, &esc);
} else {
- _esc_pub = orb_advertise(ORB_ID(esc_status), &_esc);
+ _esc_pub = orb_advertise(ORB_ID(esc_status), &esc);
}
}