Bitte ändert euer Passwort!

Im März 2026 wurde das Forum gehackt. Dabei hatten die Angreifer Zugriff auf die Datenbank und somit Zugriff auf eure Passwörter. Auch wenn das Forum kein Passwort im Klartext speichert, können die Angreifer eure Passwörter knacken. Bitte ändert daher dringend euer Passwort für das Forum. Solltet ihr das gleiche Passwort auch an anderer Stelle verwenden, ändert es bitte unbedingt an allen Stellen!

Bug in DC24 emulator

  • simonwood
  • Autor
  • Offline
  • Neues Mitglied
  • Neues Mitglied
  • Beiträge: 3
  • Thanks: 0

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
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"}

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • IG-Modellbau
  • Offline
  • Moderator
  • Moderator
  • Beiträge: 3779
  • Thanks: 2809

Re: 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
Folgende Benutzer bedankten sich: simonwood

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • simonwood
  • Autor
  • Offline
  • Neues Mitglied
  • Neues Mitglied
  • Beiträge: 3
  • Thanks: 0

Re: 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.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • simonwood
  • Autor
  • Offline
  • Neues Mitglied
  • Neues Mitglied
  • Beiträge: 3
  • Thanks: 0

Re: Bug in DC24 emulator

06 Apr. 2017 10:56
#
Ignore that - just found it !

My mistake - thanks for helping.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Ladezeit der Seite: 0.525 Sekunden
Powered by Kunena Forum