FrSkyRC / ETHOS-Feedback-Community

Feedback & suggestions are welcomed here for ETHOS by FrSky
189 stars 85 forks source link

1.4.7 pre: new lua categories (FUNCTION_SWITCH & TRIM_POSITION) don't return values #2422

Closed strgaltdel closed 1 year ago

strgaltdel commented 1 year ago

Hi, thanks for implementing the new categories, unfortunately i can't read any data, return value is "0.0", independent of state of FSW or TRIM Positions i would have expected to get +1024 in case trim position is active / FSW was pressed (FSWs configured as momentaries)

What's positive: I'm getting the names (-;

regards Udo

`

local monitorCategory = CATEGORY_TRIM_POSITION
local startIndex = 8                    -- >7 = trim 5&6

local src1 = system.getSource({category = monitorCategory, member = startIndex})
local src2 = system.getSource({category = monitorCategory, member = startIndex+1})
local src3 = system.getSource({category = monitorCategory, member = startIndex+2})
local src4 = system.getSource({category = monitorCategory, member = startIndex+3})

local val1 = src1:value()
local val2 = src2:value()
local val3 = src3:value()
local val4 = src4:value()

print("----------------------------")
print(src1:name(),val1)
print(src2:name(),val2)
print(src3:name(),val3)
print(src4:name(),val4)

`

mawzthefinn commented 1 year ago

FSW's and trim positions at least don't have a value but a state. Shouldn't they be true/false?

That's why you can't use them as a source in ETHOS unlike switches

strgaltdel commented 1 year ago

your point would be right in case you refer to "category_switches"

but there is a "category_switch_position" these sources (e.g. sa-) do return 1024 in case they are true since introduced, although they represent a state.

so i would assume trim positions will / should show consistent behavior

edit: just tried to declare the variables as boolean before reading from source, but definitely got type float 0.0 as a return value