Adding new cameras, applying patches into trunk (with source code prepared) - page 169 - General Discussion and Assistance - CHDK Forum

Adding new cameras, applying patches into trunk (with source code prepared)

  • 1685 Replies
  • 834439 Views
*

Offline rivlb

  • *
  • 11
    • Riva Lab
Advertisements
Hi. I experimented with RBF fonts recently. And I noticed that sometimes integer parameters was clipped, for example I saw [  244] instead of [ 2444]. It's because width of char 9 in some fonts smaller then width of other digits, for example digit 4. To be honest sometimes string parameters also was clipped. Missing last char in word isn't a big problem, meaning is still clear. But missing digit in number is more serious problem. So I found solution and modified function void gui_menu_init(CMenu *menu_ptr), file core/gui_menu.c:194. Tested on SX150IS and works perfect - see attached screenshots. Diff file in attachment.

*

Offline reyalp

  • ******
  • 14118
Hi. I experimented with RBF fonts recently. And I noticed that sometimes integer parameters was clipped, for example I saw [  244] instead of [ 2444]. It's because width of char 9 in some fonts smaller then width of other digits, for example digit 4.
Thanks for the patch and the clear explanation. I agree missing digits is bad, added in trunk 6271, stable r6272

Don't forget what the H stands for.

*

Offline rivlb

  • *
  • 11
    • Riva Lab
While experimenting with my SX150, I noticed that I could not get jog dial clicks in Lua script in a simple way like using is_key() or is_pressed() for example. So I tried to fix this problem. Now it is possible to get jog dial rotation event by using script function is_key() (tested in Lua script on SX150):

  is_key("jog_left" ) - true if jog dial performed left click
  is_key("jog_right") - true if jog dial performed left click

If you find this useful, it might be helpful to update the table here. Patch in attachment.

*

Offline rivlb

  • *
  • 11
    • Riva Lab
Going on with experiments with SX150, I tried to use wheel_right() / wheel_left() functions in Lua script. But it failed. So I started digging :)

Firstly, I found this post and useful attached script. I ran it and found that jog dial simulates only in 2ui mode. That is equal to using in CHDK PostLogicalEventToUI() from levent.h. So I opened platform/sx150is/lib.c and changed old _PostLogicalEventForNotPowerType() with the new one. After compiling and testing, nothing happened on the device.

Next, I ran this script with some minor changes (see result in attached txt file). And found that event RotateJogDialRight has ID=0x872, and not 0x874, as it was in the code. The same thing was happened with RotateJogDialLeft. After all the fixes everything worked.

The second parameter of PostLogicalEventToUI() was also changed from 2 to 1. After tests it turned out that this is the number of simulated clicks.

Patch in attachment.

P.S. I posted this fix here because it is a potentially universal solution for all models. But this requires appropriate testing and changes.


*

Offline reyalp

  • ******
  • 14118
Going on with experiments with SX150, I tried to use wheel_right() / wheel_left() functions in Lua script. But it failed. So I started digging :)
...
Patch in attachment.
Thanks, added with slight modification (_PostLogicalEventToUI instead of wrapper since it's platform code) in trunk r6273, stable r6274

Quote
P.S. I posted this fix here because it is a potentially universal solution for all models. But this requires appropriate testing and changes.
The code that was in sx150 likely worked on whatever (probably older) cam that code was copied from.

Someone motivated could check for ports using the wrong event number, tools/find_levent can be used to get the levent table from a dump rather than needing to run a script on the cam. The 2ui and 4npt distinction and parameter value would still need to be confirmed on camera though, or detected using finsig somehow.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14118
While experimenting with my SX150, I noticed that I could not get jog dial clicks in Lua script in a simple way like using is_key() or is_pressed() for example. So I tried to fix this problem.
...
Thanks. I think this one could use a bit more consideration, so I've started a new thread for discussion here: https://chdk.setepontos.com/index.php?topic=14861.msg150293#msg150293
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal