Remaining RAW+JPG shots + filespace icon/text- done :D - page 6 - General Discussion and Assistance - CHDK Forum supplierdeeply

Remaining RAW+JPG shots + filespace icon/text- done :D

  • 175 Replies
  • 68093 Views
*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Advertisements
before this code will be added to trunk of course it will be beautified and looked after by one of the gurus (at least i hope so :D).
lib.c (remember to add it to each platform with different address)
Code: [Select]
char *camera_jpeg_count_str()
{
    return (char*)0x7F6F8;
}
hm, raw off when disk full? hm, should be switchable. but then the script still is running even when disk really is too full to write jpegs. i thought about this because this might be a way to prevent energy from draining when you execute scripts for a long time (if disk is full, script still will run) if you dont check on the camera every once in a while.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Thanks, now I can update the lib.c 's

I don't understand what you said about scripts though, I did'nt mean
switching it OFF in the configuration, but somehow passing a message
to the raw save function which makes it temporarily suspend RAW
saving, because it can't anyway.

Nice brainstorming  :D

btw: Can anybody recommend a good sourcecode cross-referencing util ?
« Last Edit: 11 / February / 2008, 04:59:26 by whim »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
DL removed get it while it's hot.
okay, after a night of coding (well, debugging :D) i finally have to go to work :D
will explain the script thingy later
« Last Edit: 19 / February / 2008, 17:40:43 by PhyrePhoX »

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
@grand #45:
... or even  ;)
Code: [Select]
draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, (b=!b)?conf.osd_color:0x24);
That the exactly what I meant saying "it will be too weird". I prefer not using assignments in condition statements.

Is the draw gui function executed too fast per second?
~ 12 times per second (actually, it can depend on draw heaviness; for ex, with zebra drawing it can be slower):
Code: [Select]
void core_spytask()
{
...
    while (1){
...
if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) {
    [color=green]if (((cnt++) & 3) == 0)   // Each 4th call[/color]
        gui_redraw();

    histogram_process();
}
...
[color=green]msleep(20);[/color]
    }
}
« Last Edit: 11 / February / 2008, 05:41:37 by GrAnd »
CHDK Developer.


*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
:lol more instant ideas: how about simply switching RAW mode OFF automatically
        if no space left ? THat would at least allow you to maybe shoot another JPEG

If the space left is not enough to save RAW, there will be zero-size file saved. But it will not prevent of JPEG saving.
CHDK Developer.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
@GrAnd

Thanks !
Have you checked phyrephox's last code ? I think it is a waste of 32 bytes to
declare os_buf2, see my post #46:

Quote
"static char osd_buf[32];" is already defined as
"static char osd_buf[64];" at line 37 of "gui_osd.c"

can't we just reuse that one ?

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Quote
"static char osd_buf[32];" is already defined as
"static char osd_buf[64];" at line 37 of "gui_osd.c"

can't we just reuse that one ?
Sure. That buffer is specially defined globally for using with sprintf() procedures.
CHDK Developer.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
OK, did some code cleanup & testing; this is what I (just a hobby programmer)
have ended up with in my local CHDK (compiled under Windows, codebase: trunk296)

for the core/gui_osd.c code insert:
Code: [Select]
void gui_osd_draw_state() {
    int a, camera_jpeg_count,jpeg_size,raw_and_jpeg_count,raw_size, gui_mode=gui_get_mode(), m=(mode_get()&MODE_SHOOTING_MASK);
    long t;
    static int b;
    n=0;
 
    if (conf.save_raw || gui_mode==GUI_MODE_OSD)
      {
      raw_size = hook_raw_size()/1024;
      camera_jpeg_count=atoi(camera_jpeg_count_str());
      if (camera_jpeg_count)
        {
        jpeg_size=GetFreeCardSpaceKb() / camera_jpeg_count;
        raw_and_jpeg_count=GetFreeCardSpaceKb() / (raw_size+jpeg_size);
        sprintf(osd_buf, "RAW:%3d", raw_and_jpeg_count);
        draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color);
        }
      else
        {
        sprintf(osd_buf, "DISK FULL!");
        draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, (b)?conf.osd_color:0x24);
        b = !b;
        }
     n+=FONT_HEIGHT;
     }

added this to include/conf.h:
Code: [Select]
extern char * camera_jpeg_count_str();

... and this to platform/a620/lib.c
Code: [Select]
char *camera_jpeg_count_str()
  {
  return (char*)0x7F6F8;
  }


will continue testing for any side effects

wim

« Last Edit: 11 / February / 2008, 15:00:28 by whim »


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
picky guys here :D
Quote
Is the draw gui function executed too fast per second?
~ 12 times per second (actually, it can depend on draw heaviness; for ex, with zebra drawing it can be slower):
so by using a non bool-variable i can make the blinking less "frenzier", like blink only every 1/2 second. thanks for the info!

and about the osd_buf - i introduced static char osd_buf2[32]; you have to read my sources more in detail ;)
but i guess ur right, we can use the same buffer. the buffer isnt needed at all (in the long run) because you can just write directly with draw_string.

about the script thingy:

imagine you have your camera somewhere and have it in MD script mode (or you're havin a timelapse script), and you leave the camera there and cannot check on it every once in a while. if the script works as intended, it will definitly take some pictures. What does it do when the Disk is full? It still is active, preventing the screen from going blank (thus saving more energy) and of course preventing the camera from shutting down (what use is the cam when you cannot take pics anymore?). So when you finally come back to your camera, it's already shutdown because of low energy, so you cant even check the new pics. with my idea you'd have the cam automatically shutdown and save energy. know i mean?

edit: ah ok you posted something new. will test this evening, but i guess it must be working. after all i think you have more knowledge of C than me. i just had the idea :D
« Last Edit: 11 / February / 2008, 07:40:43 by phyrephox »

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
@phyrephox

Thanks, I get it now. Haven't run a single script yet, so hadn't thought of that.
Am looking forward to using a nice macro focus bracketing script as soon as
I'm in France again for mushroom photography, one of my other hobbies.

@GrAnd:

Quote
That the exactly what I meant saying "it will be too weird". I prefer not using assignments in condition statements.

Sorry, missed that post somehow. I'll change it back, to conform with other code
As you can tell, I've little experience with cooperative coding (and none with Trac
and svn so I'll stay away from those for the moment  :haha)

wim

edit: rolled back code in #57
« Last Edit: 11 / February / 2008, 08:02:50 by whim »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal