Skip to content

Commit

Permalink
AP_ESC_Telem: log raw RPM information
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and tridge committed Sep 1, 2021
1 parent 4ecdf90 commit 9281982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libraries/AP_ESC_Telem/AP_ESC_Telem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ void AP_ESC_Telem::update()

float rpm = 0.0f;
get_rpm(i, rpm);
float rawrpm = 0.0f;
get_raw_rpm(i, rawrpm);

// Write ESC status messages
// id starts from 0
Expand All @@ -392,6 +394,7 @@ void AP_ESC_Telem::update()
time_us : AP_HAL::micros64(),
instance : i,
rpm : (int32_t) rpm * 100,
raw_rpm : (int32_t) rpm * 100,
voltage : _telem_data[i].voltage,
current : _telem_data[i].current,
esc_temp : _telem_data[i].temperature_cdeg,
Expand Down
4 changes: 3 additions & 1 deletion libraries/AP_ESC_Telem/LogStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// @Field: TimeUS: microseconds since system startup
// @Field: Instance: ESC instance number
// @Field: RPM: reported motor rotation rate
// @Field: RawRPM: reported motor rotation rate without slew adjustment
// @Field: Volt: Perceived input voltage for the ESC
// @Field: Curr: Perceived current through the ESC
// @Field: Temp: ESC temperature in centi-degrees C
Expand All @@ -21,6 +22,7 @@ struct PACKED log_Esc {
uint64_t time_us;
uint8_t instance;
int32_t rpm;
int32_t raw_rpm;
float voltage;
float current;
int16_t esc_temp;
Expand All @@ -31,4 +33,4 @@ struct PACKED log_Esc {

#define LOG_STRUCTURE_FROM_ESC_TELEM \
{ LOG_ESC_MSG, sizeof(log_Esc), \
"ESC", "QBeffcfcf", "TimeUS,Instance,RPM,Volt,Curr,Temp,CTot,MotTemp,Err", "s#qvAOaO%", "F-B--BCB-" , true },
"ESC", "QBeeffcfcf", "TimeUS,Instance,RPM,RawRPM,Volt,Curr,Temp,CTot,MotTemp,Err", "s#qqvAOaO%", "F-BB--BCB-" , true },

0 comments on commit 9281982

Please sign in to comment.