Skip to content

Commit

Permalink
Added Consumed mAh
Browse files Browse the repository at this point in the history
For long range flights this is important to monitor
  • Loading branch information
MarioFPVdev authored Jan 30, 2024
1 parent 78b0c21 commit 3408715
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions vdec/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ float telemetry_roll = 0;
float telemetry_yaw = 0;
float telemetry_battery = 0;
float telemetry_current = 0;
float telemetry_current_consumed = 0;
double telemetry_lat = 0;
double telemetry_lon = 0;
double telemetry_lat_base = 0;
Expand Down Expand Up @@ -814,6 +815,12 @@ void* __MAVLINK_THREAD__(void* arg) {
telemetry_current = bat.current_battery;
break;

case MAVLINK_MSG_ID_BATTERY_STATUS:
mavlink_battery_status_t batt;
mavlink_msg_battery_status_decode(&message, &batt);
telemetry_current_consumed = batt.current_consumed;
break;

case MAVLINK_MSG_ID_RC_CHANNELS_RAW:
mavlink_rc_channels_raw_t rc_channels_raw;
mavlink_msg_rc_channels_raw_decode( &message, &rc_channels_raw);
Expand Down Expand Up @@ -1010,10 +1017,12 @@ void* __OSD_THREAD__(void* arg) {

sprintf(msg, "BAT:%.02fV", telemetry_battery / 1000);
fbg_write(fbg, msg, 40, fbg->height - 30);
sprintf(msg, "CUR:%.02fA", telemetry_current / 100);
sprintf(msg, "CONS:%.00fmAh", telemetry_current_consumed / 100);
fbg_write(fbg, msg, 40, fbg->height - 60);
sprintf(msg, "THR:%.00f%%", telemetry_throttle);
sprintf(msg, "CUR:%.02fA", telemetry_current / 100);
fbg_write(fbg, msg, 40, fbg->height - 90);
sprintf(msg, "THR:%.00f%%", telemetry_throttle);
fbg_write(fbg, msg, 40, fbg->height - 120);

sprintf(msg, "SATS:%.00f", telemetry_sats);
fbg_write(fbg, msg, fbg->width - 140, fbg->height - 30);
Expand Down

0 comments on commit 3408715

Please sign in to comment.