Porting a camera sx530hs - page 14 - DryOS Development - CHDK Forum

Porting a camera sx530hs

  • 300 Replies
  • 153599 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: Porting a camera sx530hs
« Reply #130 on: 24 / April / 2016, 18:26:57 »
Advertisements
Yes, KEY_DISPLAY is probably unnecessary, it's the same key as the KEY_DOWN.
Yeah, I missed that.
Quote
Missing KEY_WIFI.
With the above mentioned changes I see something like this:
Code: [Select]
MEM: 0x1e3c1e3c
PS1: 0xffdf9
PS2: 0
PS3: 44003f4
When I press a button WIFI, PS3: 0x44003f4 was changed to PS3: 0x44001f4.
I do not know how to interpret these changes.
PS1 is the first word of physw_status, PS3 is the third. Bits corresponding to buttons are usually '1' when unpressed. In this case, 0x44003f4 - 0x44001f4 = 0x200. That's bit 9 of physw_status[2].
You can add it to keymap like this (2 means 3rd physw_status word, KEY_WIFI is the appropriate key constant from include/keyboard.h, the rest is obvious):
Code: [Select]
{ 2, KEY_WIFI        ,0x00000200 },If you add a button, you need to add its bit to the appropriate KEY_MASKx constant in platform_kbd.h. In this case,
Code: [Select]
#define KEYS_MASK2 (0x00000160)becomes
Code: [Select]
#define KEYS_MASK2 (0x00000360)I see 2 more buttons in the camera front, you can map those too if you want. Note that physw_status usually has a few bits that keep changing, independently of buttons.

edit:
You may need new button constants if you find a button kind that has not been used by CHDK.
« Last Edit: 24 / April / 2016, 18:29:05 by srsa_4c »

*

Offline reyalp

  • ******
  • 14128
Re: Porting a camera sx530hs
« Reply #131 on: 24 / April / 2016, 18:32:27 »
Yes, KEY_DISPLAY is probably unnecessary, it's the same key as the KEY_DOWN.
Yes, please only define keys for distinct physical keys on the keypad. The platform.h defines like CAM_HAS_ERASE_BUTTON should also only be set if the camera has a dedicated button for that action.

re KEY_WIFI:
According to the manual it looks like the wifi key is the UP arrow key (not a separate, dedicated key), so only KEY_UP should be defined. KEY_UP is already defined with a different value, but it could be wrong. It should be obvious when you try to move up or down in the CHDK menu.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Porting a camera sx530hs
« Reply #132 on: 24 / April / 2016, 18:48:17 »
CAM_HAS_ERASE_BUTTON should also only be set if the camera has a dedicated button for that action.
This cam has an "exposure compensation / erase" button where the erase function is secondary (icon is below the button). Does that qualify as dedicated button?
Quote
re KEY_WIFI:
According to the manual it looks like the wifi key is the UP arrow key (not a separate, dedicated key), so only KEY_UP should be defined. KEY_UP is already defined with a different value, but it could be wrong. It should be obvious when you try to move up or down in the CHDK menu.
IMHO he means the "mobile device connection" button, which is separate but we don't  have a constant for it yet. Note that I'm using the camera manual to view the buttons.

edit:
Just to note the difference, the "mobile device connection" button is labelled as "drive mode" button on the SX520HS which has no Wifi function.
« Last Edit: 24 / April / 2016, 18:58:41 by srsa_4c »

*

Offline reyalp

  • ******
  • 14128
Re: Porting a camera sx530hs
« Reply #133 on: 24 / April / 2016, 18:58:49 »
This cam has an "exposure compensation / erase" button where the erase function is secondary (icon is below the button). Does that qualify as dedicated button?
Yes. There is a KEY_EXPO_CORR, but it's preferable to use ERASE since it has functions assigned in CHDK. I did the same for g7x ring func.

I've been thinking about better ways to handle these situations in CHDK (one of the reasons for the keyboard rework in 1.4), but that's a separate project.

Quote
IMHO he means the "mobile device connection" button, which is separate but we don't  have a constant for it yet. Note that I'm using the camera manual to view the buttons.
Oh, that makes sense. I was also looking at the manual, but stopped when I saw the wifi icon on UP.  Calling it KEY_WIFI for now is fine. (g7x is actually the same way, maybe I should call it KEY_CONNECT or something)
Don't forget what the H stands for.

*

Offline blackhole

  • *****
  • 946
  • A590IS 101b
    • Planetary astrophotography
Re: Porting a camera sx530hs
« Reply #134 on: 28 / April / 2016, 13:07:18 »
Attached is a patch with changes in keyboard.h , kbd.c , lib.c , platform_camera.h , platform_kbd.h , shooting.c and stubs_min.S
I've added a new constant in keyboard.h,new constant I called the FRAMING_ASSIST.
With the new value of DEF (active_viewport_buffer, 0x000022d08), live view in chdkpt works well, the image is immediately updated.
I tried to update and notes.txt but diffing tool in CHDK Shell does not respond to changes in .txt files, so I gave up.
Camera passes without difficulty test scripts.
Edge overlay and Zebra also work well.
I currently do not see any problems if we ignore a problem with SD cards.
Attached is also CHDK for firmware 100c, if someone wants to try.

EDIT:
Test build removed.
New test build with solved SD card issue,attached in this post:
https://chdk.setepontos.com/index.php?topic=12418.msg128201#msg128201
« Last Edit: 03 / May / 2016, 17:58:27 by blackhole »

*

Offline reyalp

  • ******
  • 14128
Re: Porting a camera sx530hs
« Reply #135 on: 28 / April / 2016, 13:36:27 »
I tried to update and notes.txt but diffing tool in CHDK Shell does not respond to changes in .txt files, so I gave up.
Please just post the whole file, no need to diff. If you are using svn or tortoise, you can also generate diffs with them.

When you add a key, it should also be added to modules/script_key_funcs.c so script can detect and send it.

edit: There is already a zoom_assist, I'm not sure if this is different from framing assist. If it's a similar function, we should probably use that rather than adding a new one.

Thanks for all your work on this port :)
Don't forget what the H stands for.

*

Offline blackhole

  • *****
  • 946
  • A590IS 101b
    • Planetary astrophotography
Re: Porting a camera sx530hs
« Reply #136 on: 28 / April / 2016, 16:22:06 »
Quote
Please just post the whole file, no need to diff.
Attached is notes.txt file.
Quote
There is already a zoom_assist, I'm not sure if this is different from framing assist. If it's a similar function, we should probably use that rather than adding a new one.
The camera has two buttons on the left side of the lens barrel.
Upper button you can press and hold it to widen the field of view of the lens,classical zoom assist.
The lower button activates a focus lock system, which works in conjunction with the lens stabilization. If you're tracking a moving object, holding it down will shift lens elements to help keep it in frame. It's worth using, especially if you're trying to track birds in flight.
This key Canon called 'Framing Assist Lock'.
I do not see any great benefit of these keys in the script. It's your decision whether to keep it or not .If we will not add this key, no problem, I will make a new patch without it.
Quote
Thanks for all your work on this port
Thank you guys for your patience,for all my mistakes and endless questions.

*

Offline reyalp

  • ******
  • 14128
Re: Porting a camera sx530hs
« Reply #137 on: 28 / April / 2016, 16:42:35 »
The camera has two buttons on the left side of the lens barrel.
Upper button you can press and hold it to widen the field of view of the lens,classical zoom assist.
The lower button activates a focus lock system, which works in conjunction with the lens stabilization. If you're tracking a moving object, holding it down will shift lens elements to help keep it in frame. It's worth using, especially if you're trying to track birds in flight.
This key Canon called 'Framing Assist Lock'.
Thanks for the explanation, adding it as framing assist makes sense to me.

In general, I prefer to as many keys as we can in the keymap and available to script. Even if we don't think of a use for them now, someone might come up with one later.

I'll add the patch and notes update when I have a bit more time, if no one beats me to it.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Porting a camera sx530hs
« Reply #138 on: 28 / April / 2016, 19:50:50 »
FWIW, I'm still working on the SD card issue - trying to track back WriteSDCard and ReadSDCard calls.

In the meantime, some questions:
- is it possible to format the 'bad' card while CHDK is running?
- what happens if you comment out the task_InitFileModules replacement in CreateTask_my()? (probably nothing, but might be worth a try)

*

Offline reyalp

  • ******
  • 14128
Re: Porting a camera sx530hs
« Reply #139 on: 28 / April / 2016, 22:57:56 »
I'll add the patch and notes update when I have a bit more time, if no one beats me to it.
Checked in, trunk 4608-4609
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal