yaapu / FrskyTelemetryScript

A LUA telemetry script and widget for the Horus X10(S),X12 and Taranis X9D+,X9E,QX7 and X-Lite radios using ArduPilot frsky passthru protocol
GNU General Public License v3.0
431 stars 136 forks source link

Horus 1.9.5: battery % by voltage issue #143

Open i3dm opened 2 years ago

i3dm commented 2 years ago

Horus V1.9.5: using PX4 and one power module on Power 2 of PX4. Yaapu config: dual battery config - dual with alert on B2 (didnt find any other way to work with B2 only) enable battery % by voltage: YES default voltage source: fc Battey 2 count override: 3 cells

expected behaviour: battery % changes according to pack voltage displayed. actual behaviour: battery shows 99% regardless of voltage (12.6V down to 10.0V)

yaapu commented 2 years ago

Hi, please excuse the very late reply. The battery % by voltage requires an extra lua file where you specify the discharge curve. The script looks for a file named modelname_batt.lua in the cfg directory (same place as the script config file)

the content is:


local voltageDrop = 0.6

local useCellVoltage = false;

local dischargeCurve = { 
  {3.48*12, 0}, 
  {3.51*12, 10}, 
  {3.58*12, 20}, 
  {3.66*12, 30}, 
  {3.76*12, 40},
  {3.81*21, 50},
  {3.88*12, 60},
  {3.93*12, 70},
  {4.03*12, 80},
  {4.08*12, 90},
  {4.20*12, 99},
  }

return {voltageDrop=voltageDrop,useCellVoltage=useCellVoltage,dischargeCurve=dischargeCurve}

The script uses an 11 points discharge curve mapped into the array voltageDrop acounts for under load voltage sags, adjust per your needs useCellVoltage specifies if the 11 values you enter in the array refer to cell voltage or battery voltage

i3dm commented 2 years ago

Hi, please excuse the very late reply. The battery % by voltage requires an extra lua file where you specify the discharge curve. The script looks for a file named modelname_batt.lua in the cfg directory (same place as the script config file)

the content is:

local voltageDrop = 0.6

local useCellVoltage = false;

local dischargeCurve = { 
  {3.48*12, 0}, 
  {3.51*12, 10}, 
  {3.58*12, 20}, 
  {3.66*12, 30}, 
  {3.76*12, 40},
  {3.81*21, 50},
  {3.88*12, 60},
  {3.93*12, 70},
  {4.03*12, 80},
  {4.08*12, 90},
  {4.20*12, 99},
  }

return {voltageDrop=voltageDrop,useCellVoltage=useCellVoltage,dischargeCurve=dischargeCurve}

The script uses an 11 points discharge curve mapped into the array voltageDrop acounts for under load voltage sags, adjust per your needs useCellVoltage specifies if the 11 values you enter in the array refer to cell voltage or battery voltage

thank you. why are you not including this file by default?

yaapu commented 2 years ago

good question, I guess I forgot to include it, but will asap

i3dm commented 2 years ago

i added the attached lua (zipped here) file in the CFG folder. configured bat % by voltage to YES voltage of both the pack and the lowest cell is quite low.yet still showing constant 99% any ideas? modelname_batt.zip 20220315_204131 20220315_204153

yaapu commented 2 years ago

hi, did you rename the file based on your actual model name just like the .cfg file?

i3dm commented 2 years ago

hi, did you rename the file based on your actual model name just like the .cfg file?

i forgot, thank you. will test it soon and report.

i3dm commented 2 years ago

Renamed the file, and now it shows a constant 00%. here is the final renamed lua file: s550_batt.zip

and a photo of CFG folder: image

and the widget settings and result: 20220316_132635 20220316_132620

any ideas?

yaapu commented 2 years ago

Your lua file is fine, seems like you spotted a bug in the 1.9.5 version, I tested in my dev branch and it works, here's the latest dev version for you to check SD.ZIP

i3dm commented 2 years ago

Your lua file is fine, seems like you spotted a bug in the 1.9.5 version, I tested in my dev branch and it works, here's the latest dev version for you to check SD.ZIP

may i bother you to know which files do i need to replace to install the new version without messing up my existing configuration? will just the WIDGET folder be enough?

yaapu commented 2 years ago

everything but the CFG,

i3dm commented 2 years ago

everything but the CFG,

over written all files (but the CFG) and still im getting 00%

i3dm commented 2 years ago

everything but the CFG,

over written all files (but the CFG) and still im getting 00%

any ideas?

i3dm commented 2 years ago

everything but the CFG,

Dear Yaapu. any other ideas why its not working? can you share your working configuration?

JEFlatt53 commented 2 years ago

Hello, I am having a similar issue in 1.9.6dev where the percentage displayed does not align with what I have in the cfg file for my model (using the lookup table you attached here). Per cell voltage is 4.11v but I am getting a 65% reading.

JEFlatt53 commented 2 years ago

Hello, I am having a similar issue in 1.9.6dev where the percentage displayed does not align with what I have in the cfg file for my model (using the lookup table you attached here). Per cell voltage is 4.11v but I am getting a 65% reading.

It seems my issue was the voltage drop parameter. I think you can disregard this.

i3dm commented 2 years ago

@yaapu can you please advise about my issue?

Nerenye commented 2 years ago

Is there a possibility to enable that on Ethos too? Since there is no CFG folder i?