Bug in DC24 emulator
- simonwood
- Offline Autor
- Neues Mitglied
- Beiträge: 3
- Dank erhalten: 0
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"}
von simonwood
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- IG-Modellbau
- Offline
- Moderator
- Beiträge: 3392
- Dank erhalten: 2425
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.
Ingmar
von IG-Modellbau
Folgende Benutzer bedankten sich: simonwood
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonwood
- Offline Autor
- Neues Mitglied
- Beiträge: 3
- Dank erhalten: 0
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.
von simonwood
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
- simonwood
- Offline Autor
- Neues Mitglied
- Beiträge: 3
- Dank erhalten: 0
Ignore that - just found it !
My mistake - thanks for helping.
My mistake - thanks for helping.
von simonwood
Bitte Anmelden oder Registrieren um der Konversation beizutreten.
Ladezeit der Seite: 1.077 Sekunden