FrSkyRC / ETHOS-Feedback-Community

Feedback & suggestions are welcomed here for ETHOS by FrSky
192 stars 87 forks source link

[1.5 RC3] TELEMETRY_ACTIVE Source do not get updated? #3445

Closed JimB40 closed 9 months ago

JimB40 commented 9 months ago

Doing some mor LUA tests.

X18S with ELRS module

  1. Telemetery stream not present (EXT 0%) IMG_1412
  2. Telemetry stream present (EXT 100%) IMG_1413

Can I check in LUA if RC link is active (telemetry stream available)? Source value reading from LUA for CATEGORY_SYSTEM_EVENT,TELEMETRY_ACTIVE is not updated to my test?

Although in ETHOS UI same event (System event, Telemetry active) gets highligted when telemetry stream shows.

BTW shouldn it be boolen (false/true)? Strange readings anyway. member (suppose to be int8) is 3.0 decimal is 0 but value is 0.0 with one decimal.

bsongis-frsky commented 9 months ago

X16S? Should I understand X18S?

bsongis-frsky commented 9 months ago

I have a doubt, is your screen refreshed?

(Perhaps you are used to OpenTX / EdgeTX where the screen is ALWAYS refreshed, which is already a problem on X12S, but which becomes even worst with the bigger resolution LCDs!)

Perhaps you could share your script (or parts of it) so that I can try to help if I find spare time?

bsongis-frsky commented 9 months ago

As a first test, and because your script doesn't look too much complex, I would call lcd.invalidate() in the wakeup() method, to mimic OpenTX behaviour.

bsongis-frsky commented 9 months ago

member (suppose to be int8) is 3.0

Fixed (ready for 1.5.0 RC5), it should be an integer. Doc updated.

decimal is 0 but value is 0.0 with one decimal.

Value is a number. 0.0 = 0 = False

JimB40 commented 9 months ago

Invalidated. Printed also on console via serial port and value=0.0 all the time

local appicon = lcd.loadMask("appicon.png")

local m, t, tlm

local gS = function (c,m, o)
  return system.getSource( { category=c, member=m, options=o } )
end

local event = function (w, et, e, x, y)
  if e then
    lcd.invalidate()
  end
end

local run = function()
  lcd.invalidate()
  m = system.getMemoryUsage()
  t = os.clock()*100
end

local draw = function()
  lcd.color(WHITE)
  lcd.font(FONT_S)
  if m then
    lcd.drawText(0,0,'Total: '..m.ramAvailable)
    lcd.drawText(0,20,'Stack: '..m.mainStackAvailable)
    lcd.drawText(0,40,'LUA: '..m.luaRamAvailable)
    lcd.drawText(0,60,'Bitmaps: '..m.luaBitmapsRamAvailable)
  end
  if t then
    lcd.drawText(0,80,'Clock: '..t)
  end
  if appicon then
    lcd.drawText(0,120,'icon w: '..appicon:width())
    lcd.drawText(0,140,'icon h: '..appicon:height())
  end
  if tlm then
    lcd.drawText(240,0,"tlm variable (Source)")
    lcd.drawText(240,20,"Source::category "..tostring(tlm:category()))
    lcd.drawText(240,40,"Source::member "..tostring(tlm:member()))
    lcd.drawText(240,60,"Source::decimals "..tostring(tlm:decimals()))
    lcd.drawText(240,80,"Source::minimum "..tostring(tlm:minimum()))
    lcd.drawText(240,100,"Source::maximum "..tostring(tlm:maximum()))
    lcd.drawText(240,120,"Source::name "..tostring(tlm:name()))
    lcd.drawText(240,140,"Source::options "..tostring(tlm:options()))
    lcd.drawText(240,160,"Source::rawValue "..tostring(tlm:rawValue()))
    lcd.drawText(240,180,"Source::stringUnit "..tostring(tlm:stringUnit()))
    lcd.drawText(240,200,"Source::stringValue "..tostring(tlm:stringValue()))
    lcd.drawText(240,220,"Source::unit "..tostring(tlm:unit()))
    lcd.drawText(240,240,"Source::value "..tostring(tlm:value()))
  end
end

local init = function()
  tlm = gS(CATEGORY_SYSTEM_EVENT,TELEMETRY_ACTIVE)

  local p = {
    name = "Test",
    icon = appicon,
    event = event,
    paint = draw,
    wakeup = run,
  }
  system.registerSystemTool(p)
end

return {init=init}
bsongis-frsky commented 9 months ago

Bug. It should return +100 or -100

bsongis-frsky commented 9 months ago

Fix ready for 1.5.0 RC5

image