Hi, I'm new here, but not to programing and scripting. I haven't touched a CHDK script yet (in the research phase), but I'm looking to make some custom modes to replace the ones I don't use in my S95 (low light, scenes, auto,) while making the workings of CHDK transparent to the user.
I'll have to refresh myself on C, and LUA looks like much more pleasant to program in, but I really want to make things as responsive as possible.
The question is, if I have complex code is there much of a speed difference? looking at projects like sunsetF16 the main script is very simple with rather complex libs, why not make those in C and patch them in instead of having to compile them in camera?
Also, Is it upon loading the scripts are compiled or on the fly?
con 2> =t1=get_tick_count(); for i=1,100000 do j = i + i; end return get_tick_count() - t1;3:return:3000
con> =t1=get_tick_count(); for i=1,100000 do j = i + i; end return get_tick_count() - t11:return:340
The bigger difficulty is where things run: Lua code always runs in the kbd task at a specific point. The gui runs in spytask, and raw processing runs in the capt_seq task. To safely interface lua with the other tasks requires additional effort.
lua code yields (for a minimum of 10ms) every 1000 lua bytecode instructions. This could be adjusted if needed, although you do have to be careful not to starve other tasks or hold up kbd task for too long.
Quote from: reyalp on 06 / August / 2011, 17:55:19The bigger difficulty is where things run: Lua code always runs in the kbd task at a specific point. The gui runs in spytask, and raw processing runs in the capt_seq task. To safely interface lua with the other tasks requires additional effort.Where do I find more info about this? I see lots of functions (most of which I can grasp), but as to how everything works is quite a mystery to me thus far.
Different tasks are different threads?
How do you adjust the yields? C yields also? This have to do with tasks?
What I want to do is this: Wait for a button press, run a bit of code for some buttons, pass the button press through for others - depending on which mode is selected on the dial (auto, P, etc) and if I'm in a menu of some sort what code is ran and what's just a button press (passed though) will change. This little bit doesn't sound that hard to implement by a script in alt mode, but I'm guessing modifying kbd.c is where I should do it.
Thank you reyalp for the thorough reply! it helped me piece together enough understanding that I have a good idea where to begin. The problem is looking at the code all you see is functions and its not obvious what's calling them!
Started by Woodsman « 1 2 ... 11 12 » Creative Uses of CHDK
Started by msl LUA Scripting
Started by barberofcivil Completed and Working Scripts
Started by barberofcivil « 1 2 » Completed and Working Scripts
Started by reyalp Completed and Working Scripts