Author Topic: Lua Module: Long key press  (Read 5547 times)

garry23

  • Hero Member
  • *****
  • Posts: 1310
Lua Module: Long key press
« on: March 09, 2016, 10:38:05 AM »
David

I've tried to get an event.keypress to 'detect' a log key press, but have failed.

Is there any chance you could 'hard wire' such a feature into the Lua module.

To be clear, so the Lua event.keypress can flag up the difference between a simple key press and a long key press.

This will greatly increase the functionality of script, especially on cameras with limited buttons, eg the EOS-M

Cheers

Garry

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: Lua Module: Long key press
« Reply #1 on: March 09, 2016, 01:03:16 PM »
You can only tell a long keypress on buttons that have an 'unpress' event. Just use dryos.ms_clock to measure the time between press and unpress.

For the EOSM, I've pretty much abandoned trying to use buttons altogether, and just use the touchscreen. See the lua_touch branch, the touch keyboard is quite functional. I'd eventually like to make the ML menu completely touch based.

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #2 on: March 09, 2016, 03:06:04 PM »
David

Understood: I'll look into using the touchscreen UI to control things.

Cheers

Garry

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #3 on: March 09, 2016, 03:15:54 PM »
David

Sorry, I forgot to add, when I looked at the touchscreen Lua UI before, it wasn't clear to me how to register what part of the screen was touched.

Can you give me a gentle nudge in the right direction.

Cheers

Garry

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: Lua Module: Long key press
« Reply #4 on: March 09, 2016, 03:30:01 PM »
look at touch.lua, lib/keys.lua and lib/keyboard.lua in the lua_touch branch, or look at the comments in lua_touch.c

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #5 on: March 09, 2016, 10:33:03 PM »
David

Thanks: but I don't feel confident to compile my own from the branch source :(

I guess I'll have to wait.

Cheers

Garry

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #6 on: March 09, 2016, 10:46:43 PM »
Plunge in, sharks are actually friendly. (Even may not be sharks but some kind of dolphins).
I built a Hackingtosh machine following some thread here, used dfort's easy to follow instructions to build a development enviroment and it is just fun to run "make" and have stuff at hand not yet available in main repository. Most of the time I have no idea what I'm doing.
http://www.magiclantern.fm/forum/index.php?topic=16012.5
 

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #7 on: March 09, 2016, 10:52:46 PM »
Walter

About a year ago I did successfully compile via the cloud. But I think this isn't possible anymore ?

Also I'm a Windows guy  :)

Cheers

Garry

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #8 on: March 09, 2016, 10:59:27 PM »
As I said: I built a Hackintosh and you may call me a Windows (and DOS/NetWare) guy coming from DOS.3.x/Win 3.0/Netware 3.11. Had no affiliation to OS X before.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3204
  • 60Da / 1100D / EOSM
Re: Lua Module: Long key press
« Reply #9 on: March 10, 2016, 03:23:23 AM »
Well you can just about as easily run your own Linux vm, that's all "compile in the cloud" really was (the vm was just hosted in the cloud).

dfort

  • Hero Member
  • *****
  • Posts: 2087
Re: Lua Module: Long key press
« Reply #10 on: March 10, 2016, 06:45:09 AM »
Cygwin is also easy to use on Windows.

http://magiclantern.fm/forum/index.php?topic=15894.0

I've also been looking at lua-touch. Pretty cool.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #11 on: March 10, 2016, 07:25:53 AM »
Thanks everyone. I will look at setting up a compile environment this weekend.

Cheers

Garry

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #12 on: March 10, 2016, 06:35:10 PM »
I have tried and got so far following the instructions. But I'm not cleaver enough to fight errors about 'bash' :-)

$ cd && wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eabi-4_8-2013q4-20131204-win32.zip && mkdir gcc-arm-none-eabi-4_8-2013q4 && unzip -n gcc-arm-none-eabi-4_8-2013q4-20131204-win32.zip -d gcc-arm-none-eabi-4_8-2013q4 && rm gcc-arm-none-eabi-4_8-2013q4-20131204-win32.zip
-bash: wget: command not found


Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #13 on: March 10, 2016, 06:39:59 PM »
Do you have wget installed? Try
Code: [Select]
sudo apt-get install wget

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #14 on: March 10, 2016, 06:45:42 PM »
I get this if I type that cmd line into the Cygwin64 Terminal

Code: [Select]
$ sudo apt-get install wget
-bash: sudo: command not found

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #15 on: March 10, 2016, 06:52:19 PM »
Please google first. First hit about "wget cygwin"
http://superuser.com/questions/693284/wget-command-not-working-in-cygwin

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #16 on: March 10, 2016, 07:00:47 PM »
Thank you :)

I get the following now: should I worry about the error at the end?

Code: [Select]
$ cd && wget https://launchpad.net/gcc-arm-embedde                      d/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eab                      i-4_8-2013q4-20131204-win32.zip && mkdir gcc-arm-n                      one-eabi-4_8-2013q4 && unzip -n gcc-arm-none-eabi-                      4_8-2013q4-20131204-win32.zip -d gcc-arm-none-eabi                      -4_8-2013q4 && rm gcc-arm-none-eabi-4_8-2013q4-201                      31204-win32.zip
--2016-03-10 17:58:40--  https://launchpad.net/gcc                      -arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-                      arm-none-eabi-4_8-2013q4-20131204-win32.zip
Resolving launchpad.net (launchpad.net)... 91.189.                      89.222, 91.189.89.223
Connecting to launchpad.net (launchpad.net)|91.189                      .89.222|:443... connected.
HTTP request sent, awaiting response... 302 Moved                       Temporarily
Location: https://launchpadlibrarian.net/160488289                      /gcc-arm-none-eabi-4_8-2013q4-20131204-win32.zip [                      following]
--2016-03-10 17:58:42--  https://launchpadlibraria                      n.net/160488289/gcc-arm-none-eabi-4_8-2013q4-20131                      204-win32.zip
Resolving launchpadlibrarian.net (launchpadlibrari                      an.net)... 91.189.89.228, 91.189.89.229
Connecting to launchpadlibrarian.net (launchpadlib                      rarian.net)|91.189.89.228|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104379892 (100M) [application/zip]
Saving to: ‘gcc-arm-none-eabi-4_8-2013q4-20131204-                      win32.zip’

Segmentation fault (core dumped)

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #17 on: March 10, 2016, 07:08:17 PM »
Walter

Forget it  :)

I keep getting errors beyond me.

I play in the background.

Thanks for your help.

Cheers

Garry

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #18 on: March 10, 2016, 07:09:41 PM »
Cygwin and I never got friends, though. Fell in love with virtual machines ...

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #19 on: March 10, 2016, 07:17:26 PM »
The up side of the ML site is you get to e-speak with some great people. The down side is that idiots like me simply can not keep up or understand some of the conversation.

It truly would be great if some kind sole could refresh the 'compile your own' instructions, truly for total novices like me.

As I said, I value your attempts at helping me  :-[

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #20 on: March 10, 2016, 07:26:51 PM »
As I said: I made a Hackintosh (crude without sound and after some failure) up and running and just followed dfort's tutorial. If you have enough RAM and if you are able to cope with some hardware limitations you may just be fine with a virtual machine running OS X.
Did you give dmilligan's hint about compiling in the cloud a chance?

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #21 on: March 10, 2016, 07:46:15 PM »
Walter

I have an account on Codio so I have just retried it, following these instructions: http://magiclantern.fm/forum/index.php?topic=14725.0

For the life of me I can't find Install Software under tools - "When the project opens, goto Tools > Install Software and install 'zip'"

Any ideas :)

Cheers

Garry

Walter Schulz

  • Hero Member
  • *****
  • Posts: 5758
Re: Lua Module: Long key press
« Reply #22 on: March 10, 2016, 08:02:01 PM »
I tried to explain I have a development machine running and therefore my experience with codio (= lack of) is not helping.

garry23

  • Hero Member
  • *****
  • Posts: 1310
Re: Lua Module: Long key press
« Reply #23 on: March 10, 2016, 08:21:15 PM »
Hopefully someone else 'watching' can add some value, i.e. Using Codio for ML compiling.

dfort

  • Hero Member
  • *****
  • Posts: 2087
Re: Lua Module: Long key press
« Reply #24 on: March 11, 2016, 10:34:03 PM »
I was able to do my first successful ML build with Codio. It took me a while to figure out how to set up my own ML development environment  computers but once I did I posted tutorials for others who found themselves in the same situation I was in.

As for the problem with wget, if you followed my Cygwin tutorial you should have installed wget but no worries, simply re-run the Cygwin installer and pick wget.

Want a shortcut to set up Cygwin? Check out the "Quick start for the terminally impatient" in my tutorial.

By the way the 32-bit version is the preferred version for ML even if you have a 64-bit system.
EOSM.202 EOSM.203 EOSM2.103 700D.115 5D3.*

garry23

  • Hero Member
  • *****
  • Posts: 1310
Cygwin
« Reply #25 on: March 12, 2016, 09:49:34 AM »
@dfort

Thank you :)

I followed your instructions, eg used the 32bit route, and I just successfully compiled the latest nightly source for my EOSM on my laptop using the Cygwin environment.

Many thanks to you, Walter and David who have helped me get to where I am.

Cheers!

Garry