Wheel control under chdkptpremote.net - Script Writing - CHDK Forum supplierdeeply

Wheel control under chdkptpremote.net

  • 7 Replies
  • 225 Views
*

Offline Davo

  • ***
  • 153
Wheel control under chdkptpremote.net
« on: 12 / March / 2019, 16:25:07 »
Advertisements
I am trying to control the wheel on my sx230 using chdkptpremote.net. Neither of the following lines work.

session.ExecuteScript("wheel_left()");
session.ExecuteScript("click(\"wheel_left\")");

 Any pointers as to what I am doing wrong would be much appreciated.

Re: Wheel control under chdkptpremote.net
« Reply #1 on: 12 / March / 2019, 16:39:18 »
I am trying to control the wheel on my sx230 using chdkptpremote.net.
Does wheel_left() or click("wheel_left") work if you use them in a little test script on your camera locally?  Could be a problem with the port if not.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11848
Re: Wheel control under chdkptpremote.net
« Reply #2 on: 12 / March / 2019, 17:18:25 »
session.ExecuteScript("wheel_left()");
session.ExecuteScript("click(\"wheel_left\")");
Note only wheel_left() is valid, the click version will fail with a Lua error. It's a good idea to check status when something like this doesn't work.

I'd second waterwingz suggestion of trying it directly.

From a cursory look the port seems to be set up correctly for a wheel.
Don't forget what the H stands for.

*

Offline Davo

  • ***
  • 153
Re: Wheel control under chdkptpremote.net
« Reply #3 on: 13 / March / 2019, 15:39:29 »

Thanks for the hints folks. I haven't coded CHDK for a while so I am a bit rusty. However, I think I have the answer.


session.ExecuteScript("wheel_left()"); does not work under chdkptpremote.net.


I used chdkptp standalone to execute =wheel_left() and that worked OK. Then I looked at its gui.lua and found it uses different code for the wheel. I tweaked this like below for my C# app.


session.ExecuteScript("post_levent_to_ui(\"RotateJogDialLeft\",1)");

This works fine under chdkptpremote.net so I am good to go. Thanks again for the pointers.


*

Offline reyalp

  • ******
  • 11848
Re: Wheel control under chdkptpremote.net
« Reply #4 on: 13 / March / 2019, 16:05:33 »

session.ExecuteScript("wheel_left()"); does not work under chdkptpremote.net.
It's good that you found a solution, but from the CHDK POV, it really shouldn't matter whether the script came from chdkptp or chdkptpremote.net. I'd again encourage you to check the status, it seems likely something is wrong somewhere else.

I don't recall exactly why I used post_levent instead of the wheel functions in the GUI, maybe because some ports didn't implement the wheel functions, or because the levents work on some cams without a wheel. Neither of these applies to your case, since sending wheel_left() works in chdkptp.
Don't forget what the H stands for.

*

Offline Davo

  • ***
  • 153
Re: Wheel control under chdkptpremote.net
« Reply #5 on: 13 / March / 2019, 16:25:55 »

Silly question. How do I check the status of
[/size][/color]
session.ExecuteScript("wheel_left()");

*

Offline reyalp

  • ******
  • 11848
Re: Wheel control under chdkptpremote.net
« Reply #6 on: 13 / March / 2019, 22:38:37 »

Silly question. How do I check the status of

session.ExecuteScript("wheel_left()");
I don't know much about chdkptpremote.net, but I guess from https://github.com/mweerden/CHDKPTPRemote/blob/master/CHDKPTPRemote/Session.cs it should throw an exception if there were an error. Odd.
Don't forget what the H stands for.

*

Offline Davo

  • ***
  • 153
Re: Wheel control under chdkptpremote.net
« Reply #7 on: 14 / March / 2019, 09:19:41 »

Got you. All my code is within try-catchers and any exceptions raise errors. wheel_left() did not raise any exceptions - it just didn't work.


However, this morning I found that it did work as intended for a short while and then stopped. I couldn't get it to work again even after powering down the cam and disconnecting the USB cable. Weird or what?


 

Related Topics