Closed CyberGuerro closed 5 months ago
Thanks for the bug report. I need to investigate more the problem. The datareftype 7 is very strange. According to the X-Plane documentation, it's really an invalid type. This is the enum X-Plane defines dataref types: https://developer.x-plane.com/sdk/XPLMDataTypeID/
And here is the error message comes from in my code: https://github.com/norberttak/XPanel/blob/439f28f76d6e9f8555a3f3d5638e216f4b56a05c/src/core/LuaHelper.cpp#L124
Please share with me the plugin's config and the Lua script. I want to reproduce the issue in my environment. Thanks, Norbert
Hi, attached required files; I inserted in xpanel.ini both methods: direct and through lua script. Used datarefs are Zibo's datarefs (4.01.9), but I think that you can find any other datarefs with datatype "double" writable
I hope this helps you to fix the issue.
Another little question:
How can I set array datarefs? I didn't found any documentation about it and
I ipotized this instruction:
set_dataref("ths_is/datarefs_array[index]",value)
I have doubts about "[index]" in the instruction, is it correct?
Regards
Claudio
Hi Claudio,
The bug is identified. It's pretty strange that a dataRef may have more than one type at a time. According to the XPlane SDK documenation it is valid:
Data types each take a bit field; it is legal to have a single dataref be more than one type of data.
Whe this happens, you can pick any matching get/set API.
I've never find such a dataref type before. Anyhow, the Zibo 738 has this type so I updated the plugin to handle these types of dataref. I attached an updated win.xpl taht contains the fix. I tested it with the same Zibo version what you wrote.
Please test this version (don't forget to restart the simulator after win.xpl file updated) and if it works in your environment I'll create a new release version of XPanel.
Regarding your Lua script: it has a problem in your set_pos_by_cmd function. The first parameter is the init_pos but it is never used in the body of the function. Please update this function similar to this (I renamed the first parameter to cur_pos):
-- Global function
local function set_pos_by_cmd(cur_pos,end_pos,cmd_dec,cmd_inc)
-- Reset posizione
while (cur_pos > 0) do
command_once(cmd_dec)
cur_pos = cur_pos - 1
end
-- Impostazione posizione
while (cur_pos < end_pos) do
command_once(cmd_inc)
cur_pos = cur_pos + 1
end
end
After this modification, It works fine for me.
Regarding your question about set array datarefs: I've never tested it so I need a few days to test (and fix if needed). Meanwhile you can get/set array type datarefs from the xpanel.ini like this:
on_push="dataref:/sim/data/data_array[0]:1"
,Norbert
I'm sorry..... I forgot to tell you that I'm under LINUX....
Thank you for function fix (I missed a code line with cut & paste during optimization of my code)
Here you can download the Linux built artifact from my github actions pipeline:
https://github.com/norberttak/XPanel/actions/runs/8287755825/artifacts/1327628182
YEAH!! Now it works!!
PS. For the next release, remember to remove board-config.ini from plugin folder :-)
If I try to get or set dataref of type double, plugin return me this error: Invalid datareftype: 7
and if I try to assign it to variable like below
variable_1 = get_dataref("dataref_name")
variable_1 is setted to nil instead of value of dateref (verified with datarefTool)