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

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

  • 1685 Replies
  • 832795 Views
*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #970 on: 20 / January / 2013, 07:03:38 »
Advertisements
The gps patch from Konrad127123 is fine. I add this correct size definition for tGPS. The wrong century chars in DNGs dateStamp is the result of wrong tGPS.status size. tGPS size is always 0x110 and unknown2[] only 160 chars. For compare library gpsLib.lua for SX230, SX260 at here.
Another thing, we should be use rounded pi-values in imath.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #971 on: 22 / January / 2013, 04:02:18 »
When CHDK gets a GPS fix from gps_get_data(), it doesn't check whether the latitude coordinates are North or South or if the longitude coordinates are East or West. The attached patch fixes this behaviour by making the latitude/longitude negative if it is South/West respectively, which is what the rest of the code expects.

I've tested the patch on my SX230HS when I was somewhere with coordinates which were North and West and it worked correctly.

The gps patch from Konrad127123 is fine. I add this correct size definition for tGPS. The wrong century chars in DNGs dateStamp is the result of wrong tGPS.status size. tGPS size is always 0x110 and unknown2[] only 160 chars. For compare library gpsLib.lua for SX230, SX260 at here.
Another thing, we should be use rounded pi-values in imath.

Added in revision 2507 (trunk) and 2508 (release-1.1).

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #972 on: 25 / January / 2013, 00:08:15 »
I'll move this to its own thread - I came up with a couple of other ideas overnight that are probably worth a seperate discussion.

A small patch to the motion detection code to display on the camera's LCD in real time the changes in luminescence that CHDK measures.  It displays when the "show grid" option is used with md_detect_motion().   The calculated change value for each zone is drawn as text in the center of each zone rectangle.

This change should be pretty useful for users trying to tune an MD script as they will actually be able to see the measured value that CHDK compares to their passed threshold-value parameter.  A lot simpler that playing the "tweak the parameter until it appears to work"  game that people play now.

Note : I've also implement this as just a Lua script using the md_get_cell_diff() function and Lua drawing functions.  However,  the output is not as pretty and as it has not been done in any of the published scripts yet, it is not really available to the average CHDK user.  Adding it to the MD code makes it available to all.

« Last Edit: 25 / January / 2013, 08:15:02 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #973 on: 25 / January / 2013, 22:55:27 »
I'd like to ask for permission to do the following changes in core:
Code: [Select]
Index: core/ptp.c
===================================================================
--- core/ptp.c (revision 2515)
+++ core/ptp.c (working copy)
@@ -650,7 +650,7 @@
   }
 
   // send response
-  data->send_resp( data->handle, &ptp );
+  data->send_resp( data->handle, &ptp, 0 );
   
   return 1;
 }
Index: core/ptp_chdk.h
===================================================================
--- core/ptp_chdk.h (revision 2515)
+++ core/ptp_chdk.h (working copy)
@@ -30,7 +30,7 @@
     int handle;
     int (*send_data)(int handle, const char *buf, int part_size, int total_size, int, int, int); // (0xFF9F525C), total_size should be 0 except for the first call
     int (*recv_data)(int handle, char *buf, int size, int, int); // (0xFF9F5500)
-    int (*send_resp)(int handle, PTPContainer *resp); // (0xFF9F5688)
+    int (*send_resp)(int handle, PTPContainer *resp, int zero); // (0xFF9F5688), ixus30/40 needs a third argument, which is always 0
     int (*get_data_size)(int handle); // (0xFF9F5830)
     int (*send_err_resp)(int handle, PTPContainer *resp); // (0xFF9F5784)
     int unknown1; // ???
and
Code: [Select]
Index: platform/generic/wrappers.c
===================================================================
--- platform/generic/wrappers.c (revision 2515)
+++ platform/generic/wrappers.c (working copy)
@@ -109,7 +109,7 @@
     char    unk6;
 } flashParam;
 
-short get_parameter_size(long id)
+short __attribute__((weak)) get_parameter_size(long id)
 {
     extern flashParam* FlashParamsTable[];
 
I believe that both are harmless.
I'd like to integrate my ixus30/sd200 port, the above changes are needed for correct operation. I plan to fix some issues on the ixus40/sd300 port too.


*

Offline reyalp

  • ******
  • 14117
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #974 on: 26 / January / 2013, 01:02:08 »
I'd like to ask for permission to do the following changes in core:
Both seem fine to me. I think we discussed the send_resp one before in the ptp thread.
« Last Edit: 26 / January / 2013, 01:04:33 by reyalp »
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #975 on: 26 / January / 2013, 10:40:53 »
Both seem fine to me. I think we discussed the send_resp one before in the ptp thread.
Yes. I repeated it as that talk was months ago.

I have another question about changeset 2516. I can't simply merge it back into release-1_1 because of structural changes. Should I make an independent commit (without svn mergeinfo), or port the changeset back with mergeinfo?

And finally: should I use this thread for questions like this? I feel a bit off-topic here...

*

Offline nafraf

  • *****
  • 1308
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #976 on: 26 / January / 2013, 16:16:06 »
patch to fix palette in a810.
Bug was reported here

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #977 on: 27 / January / 2013, 01:57:13 »
Code: [Select]
Index: platform/generic/wrappers.c
===================================================================
--- platform/generic/wrappers.c (revision 2515)
+++ platform/generic/wrappers.c (working copy)
@@ -109,7 +109,7 @@
     char    unk6;
 } flashParam;
 
-short get_parameter_size(long id)
+short __attribute__((weak)) get_parameter_size(long id)
 {
     extern flashParam* FlashParamsTable[];
 
I believe that both are harmless.
I'd like to integrate my ixus30/sd200 port, the above changes are needed for correct operation. I plan to fix some issues on the ixus40/sd300 port too.

Sorry I didn't reply earlier, I'm away for the long weekend holiday here.

For the FlashParamsTable fix I think it would be better to add a #define for this table version to camera.h and set the correct structure definition in wrappers.c based on the #define. This probably affects other cameras.

I added the get_parameter_size function in my recent reorg to remove the hard wired logic elsewhere. Unless I got this all wrong the current release version will also not work properly. See the code in luascript.c that gets the size value from the table. If this the case then get_parameter_size should be added to the release version.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


*

Offline srsa_4c

  • ******
  • 4451
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #978 on: 27 / January / 2013, 08:22:34 »
For the FlashParamsTable fix I think it would be better to add a #define for this table version to camera.h and set the correct structure definition in wrappers.c based on the #define. This probably affects other cameras.
To my knowledge the only cameras with this structure variant are the Ixus30 and 40, and the third exception would be the S1IS with yet another variant.
Quote
I added the get_parameter_size function in my recent reorg to remove the hard wired logic elsewhere. Unless I got this all wrong the current release version will also not work properly. See the code in luascript.c that gets the size value from the table. If this the case then get_parameter_size should be added to the release version.
There's nothing wrong with your code, the Ixus40 style flash params table was never supported. The port used a workaround to not crash on regular camera use.

*

Offline nafraf

  • *****
  • 1308
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #979 on: 27 / January / 2013, 10:31:20 »
a2300 100e port - alpha
Reports here

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal