From 4c4ce09005c0e2f2bd025f89ac117c6cd3af0459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 2 Sep 2019 18:20:01 +0200 Subject: [PATCH] esc_status: trim the message and remove unused fields --- msg/esc_report.msg | 6 ++---- msg/esc_status.msg | 5 ----- src/drivers/mkblctrl/mkblctrl.cpp | 6 ++---- src/drivers/tap_esc/tap_esc.cpp | 1 - src/drivers/telemetry/hott/messages.cpp | 5 ++--- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/msg/esc_report.msg b/msg/esc_report.msg index 106d43bb4f..8aaadb39f9 100644 --- a/msg/esc_report.msg +++ b/msg/esc_report.msg @@ -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 diff --git a/msg/esc_status.msg b/msg/esc_status.msg index cb5ea77d41..38472800f9 100644 --- a/msg/esc_status.msg +++ b/msg/esc_status.msg @@ -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 diff --git a/src/drivers/mkblctrl/mkblctrl.cpp b/src/drivers/mkblctrl/mkblctrl.cpp index cc311dbba1..9c40ac7425 100644 --- a/src/drivers/mkblctrl/mkblctrl.cpp +++ b/src/drivers/mkblctrl/mkblctrl.cpp @@ -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(Motor[i].Current) * 0.1F; esc.esc[i].esc_rpm = (uint16_t) 0; @@ -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(Motor[i].Temperature); - esc.esc[i].esc_state = (uint16_t) Motor[i].State; + esc.esc[i].esc_temperature = static_cast(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) diff --git a/src/drivers/tap_esc/tap_esc.cpp b/src/drivers/tap_esc/tap_esc.cpp index 27970cc02b..c5c1068baf 100644 --- a/src/drivers/tap_esc/tap_esc.cpp +++ b/src/drivers/tap_esc/tap_esc.cpp @@ -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; diff --git a/src/drivers/telemetry/hott/messages.cpp b/src/drivers/telemetry/hott/messages.cpp index 3f14dee2ab..edee553d82 100644 --- a/src/drivers/telemetry/hott/messages.cpp +++ b/src/drivers/telemetry/hott/messages.cpp @@ -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(msg.temperature1) - 20.0F; + esc.esc[0].esc_temperature = msg.temperature1 - 20; esc.esc[0].esc_voltage = static_cast((msg.main_voltage_H << 8) | (msg.main_voltage_L & 0xff)) * 0.1F; esc.esc[0].esc_current = static_cast((msg.current_H << 8) | (msg.current_L & 0xff)) * 0.1F; @@ -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);