Browse Source

esc_status: trim the message and remove unused fields

sbg
Beat Küng 6 years ago
parent
commit
4c4ce09005
  1. 6
      msg/esc_report.msg
  2. 5
      msg/esc_status.msg
  3. 6
      src/drivers/mkblctrl/mkblctrl.cpp
  4. 1
      src/drivers/tap_esc/tap_esc.cpp
  5. 5
      src/drivers/telemetry/hott/messages.cpp

6
msg/esc_report.msg

@ -1,12 +1,10 @@ @@ -1,12 +1,10 @@
uint64 timestamp # time since system start (microseconds)
uint8 esc_vendor # Vendor of current ESC
uint32 esc_errorcount # Number of reported errors by ESC - if supported
int32 esc_rpm # Motor RPM, negative for reverse rotation [RPM] - if supported
float32 esc_voltage # Voltage measured from current ESC [V] - if supported
float32 esc_current # Current measured from current ESC [A] - if supported
float32 esc_temperature # Temperature measured from current ESC [degC] - if supported
uint8 esc_temperature # Temperature measured from current ESC [degC] - if supported
float32 esc_setpoint # setpoint of current ESC
uint16 esc_setpoint_raw # setpoint of current ESC (Value sent to ESC)
uint16 esc_address # Address of current ESC (in most cases 1-8 / must be set by driver)
uint16 esc_version # Version of current ESC - if supported
uint16 esc_state # State of ESC - depend on Vendor
uint8 esc_state # State of ESC - depend on Vendor

5
msg/esc_status.msg

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
uint64 timestamp # time since system start (microseconds)
uint8 CONNECTED_ESC_MAX = 8 # The number of ESCs supported. Current (Q2/2013) we support 8 ESCs
uint8 ESC_VENDOR_GENERIC = 0 # generic ESC
uint8 ESC_VENDOR_MIKROKOPTER = 1 # Mikrokopter
uint8 ESC_VENDOR_GRAUPNER_HOTT = 2 # Graupner HoTT ESC
uint8 ESC_VENDOR_TAP = 3 # TAP ESC
uint8 ESC_CONNECTION_TYPE_PPM = 0 # Traditional PPM ESC
uint8 ESC_CONNECTION_TYPE_SERIAL = 1 # Serial Bus connected ESC
uint8 ESC_CONNECTION_TYPE_ONESHOOT = 2 # One Shoot PPM

6
src/drivers/mkblctrl/mkblctrl.cpp

@ -614,8 +614,6 @@ MK::task_main() @@ -614,8 +614,6 @@ MK::task_main()
for (unsigned int i = 0; i < _num_outputs; i++) {
esc.esc[i].esc_address = (uint8_t) BLCTRL_BASE_ADDR + i;
esc.esc[i].esc_vendor = esc_status_s::ESC_VENDOR_MIKROKOPTER;
esc.esc[i].esc_version = (uint16_t) Motor[i].Version;
esc.esc[i].esc_voltage = 0.0F;
esc.esc[i].esc_current = static_cast<float>(Motor[i].Current) * 0.1F;
esc.esc[i].esc_rpm = (uint16_t) 0;
@ -630,8 +628,8 @@ MK::task_main() @@ -630,8 +628,8 @@ MK::task_main()
esc.esc[i].esc_setpoint_raw = (uint16_t) Motor[i].SetPoint;
}
esc.esc[i].esc_temperature = static_cast<float>(Motor[i].Temperature);
esc.esc[i].esc_state = (uint16_t) Motor[i].State;
esc.esc[i].esc_temperature = static_cast<uint8_t>(Motor[i].Temperature);
esc.esc[i].esc_state = (uint8_t) Motor[i].State;
esc.esc[i].esc_errorcount = (uint16_t) 0;
// if motortest is requested - do it... (deprecated in future)

1
src/drivers/tap_esc/tap_esc.cpp

@ -563,7 +563,6 @@ void TAP_ESC::cycle() @@ -563,7 +563,6 @@ void TAP_ESC::cycle()
if (feed_back_data.channelID < esc_status_s::CONNECTED_ESC_MAX) {
_esc_feedback.esc[feed_back_data.channelID].esc_rpm = feed_back_data.speed;
_esc_feedback.esc[feed_back_data.channelID].esc_state = feed_back_data.ESCStatus;
_esc_feedback.esc[feed_back_data.channelID].esc_vendor = esc_status_s::ESC_VENDOR_TAP;
_esc_feedback.esc_connectiontype = esc_status_s::ESC_CONNECTION_TYPE_SERIAL;
_esc_feedback.counter++;
_esc_feedback.esc_count = num_outputs;

5
src/drivers/telemetry/hott/messages.cpp

@ -113,9 +113,8 @@ publish_gam_message(const uint8_t *buffer) @@ -113,9 +113,8 @@ publish_gam_message(const uint8_t *buffer)
esc.esc_count = 1;
esc.esc_connectiontype = esc_status_s::ESC_CONNECTION_TYPE_PPM;
esc.esc[0].esc_vendor = esc_status_s::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 = static_cast<float>(msg.temperature1) - 20.0F;
esc.esc[0].esc_temperature = msg.temperature1 - 20;
esc.esc[0].esc_voltage = static_cast<float>((msg.main_voltage_H << 8) | (msg.main_voltage_L & 0xff)) * 0.1F;
esc.esc[0].esc_current = static_cast<float>((msg.current_H << 8) | (msg.current_L & 0xff)) * 0.1F;
@ -186,7 +185,7 @@ build_gam_response(uint8_t *buffer, size_t *size) @@ -186,7 +185,7 @@ build_gam_response(uint8_t *buffer, size_t *size)
msg.gam_sensor_id = GAM_SENSOR_ID;
msg.sensor_text_id = GAM_SENSOR_TEXT_ID;
msg.temperature1 = (uint8_t)(esc.esc[0].esc_temperature + 20.0F);
msg.temperature1 = esc.esc[0].esc_temperature + 20;
msg.temperature2 = 20; // 0 deg. C.
const uint16_t voltage = (uint16_t)(esc.esc[0].esc_voltage * 10.0F);

Loading…
Cancel
Save