Bug in DC24 emulator
- simonwood
-
Topic Author
- Offline
- New Member
-
- Posts: 3
- Thank you received: 0
TPL_KUNENA_MESSAGE_CREATED Bug in DC24 emulator
06 Apr 2017 10:22
Hi guys,
been playing with the DC24 emulator to test some Lua code and have come across a bug there. Seems like this is the right place to report it.
The getInputsVal call only returns -1 and 1 for any stick defined. If you get the label from the switchinfo structure and call getInputs you get the correct value. If you look at the switchinfo value field that is also incorrect.
Please find some code below to demonstrate the issue.
Regards
Simon
been playing with the DC24 emulator to test some Lua code and have come across a bug there. Seems like this is the right place to report it.
The getInputsVal call only returns -1 and 1 for any stick defined. If you get the label from the switchinfo structure and call getInputs you get the correct value. If you look at the switchinfo value field that is also incorrect.
Please find some code below to demonstrate the issue.
Regards
Simon
Code:
local InputE
local count
local function loop()
if (not InputE) then return end
-- don;t flood the debug console
count = count + 1
if (count < 25) then return end
count = 0
local val = system.getInputsVal(InputE)
local swInfo = system.getSwitchInfo(InputE)
local val2 = system.getInputs(swInfo.label)
print(string.format("val=%f, gival=%f", val, val2))
end
-------------------------------------------------------------------------------
-- form Code
local function OnChangedES(value)
InputE = value
system.pSave("InputE", value)
end
local function initForm(formID)
form.addRow(2)
form.addLabel({label="control",font=FONT_BOLD})
form.addInputbox(InputE, true, OnChangedES)
end
--------------------------------------------------------------------------------
local function init()
system.registerForm(1, MENU_FINE, "Hysteresis Switch",initForm,nil,printForm)
InputE = system.pLoad("InputE", nil)
count = 0
end
--------------------------------------------------------------------------------
return {init=init, loop=loop, author="Simon Wood", version="1.1", name="pot test"}
Please Log in or Create an account to join the conversation.
- IG-Modellbau
-
- Offline
- Moderator
-
- Posts: 3781
- Thank you received: 2809
TPL_KUNENA_MESSAGE_REPLIED_NEW Bug in DC24 emulator
06 Apr 2017 10:35
Hello Simon,
have you set the Stick to proportional?
If I do so, I get values form -1 to +1 as real numbers.
So your code works perfectly all right.
Ingmar
have you set the Stick to proportional?
If I do so, I get values form -1 to +1 as real numbers.
So your code works perfectly all right.
Attachment Test.PNG not found
Ingmar
The following user(s) said Thank You: simonwood
Please Log in or Create an account to join the conversation.
- simonwood
-
Topic Author
- Offline
- New Member
-
- Posts: 3
- Thank you received: 0
TPL_KUNENA_MESSAGE_REPLIED_NEW Bug in DC24 emulator
06 Apr 2017 10:54
Hi Ingmar,
thanks for the fast response. Where do I set the stick proportional ? I get the correct values from getInputs, but incorrect from getInputsVal - so I'm guessing this is not a global setting ?
S.
thanks for the fast response. Where do I set the stick proportional ? I get the correct values from getInputs, but incorrect from getInputsVal - so I'm guessing this is not a global setting ?
S.
Please Log in or Create an account to join the conversation.
- simonwood
-
Topic Author
- Offline
- New Member
-
- Posts: 3
- Thank you received: 0
TPL_KUNENA_MESSAGE_REPLIED_NEW Bug in DC24 emulator
06 Apr 2017 10:56
Ignore that - just found it !
My mistake - thanks for helping.
My mistake - thanks for helping.
Please Log in or Create an account to join the conversation.
Time to create page: 0.230 seconds