teckel12 / LuaTelemetry

FrSky SmartPort(S.Port), D-series, F.Port and TBS Crossfire telemetry on all Taranis and Horus transmitters
https://github.com/teckel12/LuaTelemetry/wiki
GNU General Public License v3.0
289 stars 58 forks source link

Bug v1.4.1 Pilot view “Battery Percentage" always show 0 #173

Closed davidngrc closed 5 years ago

davidngrc commented 6 years ago

I am using opentx 2.2.2, iNav 2.0 FPORT

Pilot view “Battery Percentage" always show 0 I think this also exists in v1.4.0

when using classic view, the battery percentage bar is not 100%, like 80% (cell voltage is 4.02v) but in in x9d+ "telemetry" screen, the Fuel sensor shows 100% iNav already using smartport_fuel_unit = PERCENT

image

davidngrc commented 6 years ago

this is my diff

diff

version

INAV/SPRACINGF4EVO 2.0.0 Aug 24 2018 / 19:34:41 ()

resources

mixer

mmix 0 1.000 0.000 0.000 0.000 mmix 1 1.000 0.000 0.000 0.000

servo mix

smix 0 3 0 100 0 smix 1 4 0 100 0 smix 2 5 2 100 0 smix 3 2 1 100 0

servo

servo 2 1000 2000 1500 -100 servo 3 1000 2000 1500 -100 servo 4 1000 2000 1500 -100 servo 5 1000 2000 1500 -100

feature

feature -TX_PROF_SEL feature THR_VBAT_COMP feature VBAT feature MOTOR_STOP feature GPS feature BLACKBOX feature PWM_OUTPUT_ENABLE

beeper

map

map TAER

serial

serial 1 2048 115200 38400 0 115200 serial 2 2 115200 38400 0 115200 serial 4 0 115200 38400 0 115200 serial 30 64 115200 38400 0 115200

led

color

mode_color

aux

aux 0 0 0 1450 2100 aux 1 1 1 900 1075 aux 2 2 1 1125 1275 aux 3 20 3 1825 2100 aux 4 3 2 1300 1700 aux 5 9 1 1325 1475 aux 6 8 5 1300 1700 aux 7 35 1 1525 1675 aux 8 10 1 1725 1900 aux 9 14 3 1300 1700 aux 10 28 2 1850 2100 aux 11 18 5 1850 2100

adjrange

rxrange

master

set acc_hardware = MPU6500 set acczero_x = -16 set acczero_y = -1 set acczero_z = -20 set accgain_x = 4102 set accgain_y = 4097 set accgain_z = 4106 set mag_hardware = NONE set baro_hardware = NONE set pitot_hardware = NONE set rssi_channel = 16 set serialrx_provider = FPORT set serialrx_inverted = ON set serialrx_halfduplex = ON set failsafe_procedure = RTH set failsafe_min_distance = 2000 set failsafe_min_distance_procedure = SET-THR set align_board_yaw = 900 set vbat_scale = 1082 set platform_type = AIRPLANE set model_preview_type = 14 set small_angle = 180 set gps_sbas_mode = AUTO set nav_user_control_mode = CRUISE set nav_rth_allow_landing = FS_ONLY set nav_rth_altitude = 5000 set nav_fw_cruise_thr = 1500 set nav_fw_max_thr = 1900 set nav_fw_bank_angle = 45 set nav_fw_climb_angle = 25 set nav_fw_loiter_radius = 4000 set nav_fw_launch_accel = 1400 set nav_fw_launch_detect_time = 30 set nav_fw_launch_thr = 1800 set nav_fw_launch_idle_thr = 1200 set nav_fw_launch_motor_delay = 50 set nav_fw_launch_timeout = 30000 set nav_fw_launch_climb_angle = 21 set smartport_fuel_unit = PERCENT set tz_offset = 480 set vtx_band = 1 set vtx_channel = 8 set vtx_freq = 5725

profile

profile 1

set fw_p_pitch = 10 set fw_ff_pitch = 60 set max_angle_inclination_rll = 600 set max_angle_inclination_pit = 600 set nav_fw_pos_z_p = 30 set nav_fw_pos_z_i = 10 set pitch_rate = 25

battery_profile

battery_profile 1

set vbat_min_cell_voltage = 280

teckel12 commented 6 years ago

@davidngrc Set another telemetry screen to show the sensors fuel and battery voltage. Fuel in Lua Telemetry just comes direct from the sensor. Voltage is either the total or cell depending on what you select in the config.

My guess is that INAV is guessing the wrong number of cells, and calculating the fuel. Your min voltage of 2.8 may be throwing INAV off (as this is typically set much higher, like 3.5 volts).

Setting another telemetry screen with the fuel and battery telemetry is the way to go, that will show if the problem is with your INAV settings. Fuel being wrong really suggests that, as Lua Telemetry does no math to calculate fuel, it comes directly from INAV.

teckel12 commented 6 years ago

@davidngrc Any update on this?

davidngrc commented 6 years ago

I have test this on a new matek f405 wing last night, from full 4.2v to 2.3v per cell (almost kill my 18650 battery) no problem found

Previously, I use FC: SP Racing F4 EVO, maybe tonight I will test this one again

teckel12 commented 6 years ago

@davidngrc The fuel % comes straight from INAV, so any problems with that must be with INAV.

The battery voltage could be a problem because you're taking your voltage all the way down to 2.3v. The issue is that INAV doesn't send the cell count and both INAV and Lua Telemetry need to guess the number of cells. This works well if you always start with a full battery. But, if the battery isn't full either INAV and/or Lua Telemetry may calculate the wrong number of cells. Neither have a fool-proof way of calculating this when you take your battery voltage that low.

If you have cell voltage reporting issues, I would suggest changing Lua Telemetry to show the total voltage instead of cell voltage, then there won't be an issue in Lua Telemetry. You also may need to mess with the new battery profiles in INAV to set your battery cell count. That way INAV will know the correct cell count and show the correct voltage per cell and fuel percentage.