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

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

  • 175 Replies
  • 65020 Views
Re: Calculation of remaining shots with RAW - done :D
« Reply #90 on: 14 / February / 2008, 15:50:07 »
Advertisements
Phox,
I normally use Winmerge to get other build features into my code, but with diff I go manually and that is not so funny all times. A lot of lines and at my age and eyes :blink:  ...Guess I am just getting old :)

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Calculation of remaining shots with RAW - done :D
« Reply #91 on: 14 / February / 2008, 19:38:26 »
during debugging that annoying bug in video mode i found that my function doesnt work as intended:

Code: (c) [Select]
                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, "RAW: DISK FULL!");
the function only shows disk full when jpeg_count is zero, but i want it to show full disk when there aint enough space for one raw. luckily it wasnt me who wrote this, this must have happened as whim cleaned my code, blame him :D
and also blame me, for i didnt check it thoroughly :D the correct code is in this thread somewhere, by the time i wrote it i didnt have my svn yet :(
the movie bug happens because when u start cam in movie record mode, the camera_jpeg_count is 0, if you switch to another shooting mode and back again to movie the counter is working the right way.
in order to avoid this bug i either have to find out if the cam is in movie_mode (atm i only can find out if its in record or playmode... any hints?) or by making a check ala "if jpeg_count = 0 AND remainingfilespace <=sizeofraw". hm, time to sleep.

*

Offline vit40

  • ****
  • 276
Re: Calculation of remaining shots with RAW - done :D
« Reply #92 on: 15 / February / 2008, 01:59:11 »
Well, I think it would be ok for most of us to show RAW: 0 in both cases ... but in red, of course

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Calculation of remaining shots with RAW - done :D
« Reply #93 on: 15 / February / 2008, 02:16:33 »
... "if jpeg_count = 0 AND remainingfilespace <=sizeofraw"...
OR

in order to avoid this bug i either have to find out if the cam is in movie_mode (atm i only can find out if its in record or playmode... any hints?)
The same function - mode_get(). See "MODE_VIDEO_*" constants in "platform.h".
CHDK Developer.


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Calculation of remaining shots with RAW - done :D
« Reply #94 on: 15 / February / 2008, 03:37:38 »
yeah i noticed these mode_video constants, but i thought i'd have to manually check for EACH of them, as there are more mode_video thingies. i'll test it :D

vit40: well yes, maybe you are right, but i need the warning function, as it happens too often that i take a raw and it cant be saved :) small change of code. i even have an idea on how to distinguish the filespace icon from the battery icon.

by the way GrAnd, i think it's easy for you to answer me that: why is it sometimes neccessary to do a "gmake clean" before compiling? i thought "gmake fir" takes care of stuff automatically, at least the files that have been changed in source code.
because it happens all the time that i forget to clean, and then my camera shows the behaviour i once mentioned in this thread: it boots, it shows osd, but i cant enter alt mode or it freezes when i take a raw picture and so on. makes debugging VERY hard when you dont know to clean first, because i always end up thinking that my code is the culprit :D
thanks for your input, much appreciated.
« Last Edit: 15 / February / 2008, 04:10:25 by PhyrePhoX »

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Calculation of remaining shots with RAW - done :D
« Reply #95 on: 15 / February / 2008, 05:36:54 »
by the way GrAnd, i think it's easy for you to answer me that: why is it sometimes necessary to do a "gmake clean" before compiling? i thought "gmake fir" takes care of stuff automatically, at least the files that have been changed in source code.

It is necessary only if you do build for different cameras/firmwares. If you compile the code only for single one it is not needed.
It's due to some common files depend on camera model (using #ifdef statements), but for the compiler that files looks unchanged, so it does not recompile them as required.
CHDK Developer.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: Calculation of remaining shots with RAW - done :D
« Reply #96 on: 15 / February / 2008, 05:43:40 »
by the way GrAnd, i think it's easy for you to answer me that: why is it sometimes necessary to do a "gmake clean" before compiling? i thought "gmake fir" takes care of stuff automatically, at least the files that have been changed in source code.

It is necessary only if you do build for different cameras/firmwares. If you compile the code only for single one it is not needed.
It's due to some common files depend on camera model (using #ifdef statements), but for the compiler that files looks unchanged, so it does not recompile them as required.

well, i only compile for my a620 at the moment, and sure as hell have to gmake clean in between, or else i get those strange lockups. mostly when i change things in the gui. maybe it happens when i forget to clear the chdk.conf? hm, we'll see.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Calculation of remaining shots with RAW - done :D
« Reply #97 on: 15 / February / 2008, 06:44:20 »
Quote
this must have happened as whim cleaned my code, blame him Big Grin

Blame accepted  :haha Next try, this is only first part of function, i lost overview a bit
cause i haven't applied your diffs yet, and i'm not sure if i'm testing for too many
video modes here ...

Code: (c) [Select]
void gui_osd_draw_state()
    {
    int a, camera_jpeg_count,jpeg_size,raw_and_jpeg_count,raw_size;
    int gui_mode=gui_get_mode(), o=mode_get(),m=(mode_get()&MODE_SHOOTING_MASK);
    long t;     
    static int b;
    n=0;  // relative vertical position
 
    if (conf.save_raw || gui_mode==GUI_MODE_OSD)
        {
        if (     (o&MODE_MASK) == MODE_REC )  &&    //  if in recording mode .... 
              !( (o&MODE_SHOOTING_MASK) == MODE_VIDEO_STD ||       // ... but not in video mode
  (o&MODE_SHOOTING_MASK) == MODE_VIDEO_SPEED || 
  (o&MODE_SHOOTING_MASK) == MODE_VIDEO_COMPACT ||
          (o&MODE_SHOOTING_MASK) == MODE_VIDEO_MY_COLORS ||
          (o&MODE_SHOOTING_MASK) == MODE_VIDEO_COLOR_ACCENT ||
                  (o&MODE_SHOOTING_MASK) == MODE_VIDEO_TIME_LAPSE  )   )             
            {
            raw_size = hook_raw_size()/1024;
            camera_jpeg_count=atoi(camera_jpeg_count_str());
            if (camera_jpeg_count)   // must check first or division will error out
                {
                jpeg_size=GetFreeCardSpaceKb() / camera_jpeg_count;
                raw_and_jpeg_count=GetFreeCardSpaceKb() / (raw_size+jpeg_size);
                if(raw_and_jpeg_count)
                    {
                    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);
                    }
                }
            // can't use else on the  'if(raw_and_jpeg_count)'  otherwise we miss
            // the case where camera_jpeg_count = 0
            if ( !camera_jpegcount || !raw_and_jpeg_count )
                {
                sprintf(osd_buf, "RAW: DISK FULL!");
                // flash frequency slowdown
                if (b > 6)
                    {
                    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color_warn);
                    b = (b>12) ? 0 : b+1;
                    }
                else
                    {
                    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color);
                    b = b+1;
                    }
                }
            n+=FONT_HEIGHT;
            }                   
// =========== snip ============           


Off to apply the diffs now ...

wim


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
hold it, steady, ready, yes, there is a new build
« Reply #98 on: 15 / February / 2008, 07:03:37 »
DLs deleted

funny, before you posted this, i worked out a new function and everything works as intended.
Code: (c) [Select]
void gui_osd_draw_raw() {
    int camera_jpeg_count,jpeg_size,raw_and_jpeg_count,raw_size, o=mode_get(),m=(mode_get()&MODE_SHOOTING_MASK);
    static int b;
    if (conf.save_raw & conf.show_remaining_raw)
      {
     if (((o&MODE_MASK) == MODE_REC) & ((m&MODE_SHOOTING_MASK)!=MODE_VIDEO_STD))

 {

raw_size = hook_raw_size()/1024;
camera_jpeg_count=atoi(camera_jpeg_count_str());        
    if (camera_jpeg_count>0)
    {
    jpeg_size=GetFreeCardSpaceKb()/camera_jpeg_count;
    raw_and_jpeg_count=GetFreeCardSpaceKb()/(raw_size+jpeg_size);
    }
    else
    {
                raw_and_jpeg_count=0;
    }
 
    if (raw_and_jpeg_count>0)
    {
    sprintf(osd_buf, "RAW:%3d%", raw_and_jpeg_count);
    draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color);
  }
  else
  {
                       sprintf(osd_buf, "DISK FULL!");
                          if (b > 6)
                         {
                               draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color_warn);
                                if (b>12)
                                {   
                                        b = 0;
                                }
                                else
                                {
                                        b=b+1;
                                }
                        }
                        else
                        {
                                draw_string(conf.mode_raw_pos.x, conf.mode_raw_pos.y, osd_buf, conf.osd_color);
                                b = b+1;
                         }
                }


}}}

this is ugly as hell again, but it works. strange thing is, i first wanted to include all the checks for VIDEO_MODEs too, but then i found out that no matter what video_mode you are in, it's always MODE_VIDEO_STD thats in effect (by that i mean this is fetched by mode_get).i dont know if that is a a620 behaviour though. but since i have all these shooting modes (speed, compact, colors, etc) too on my cam, it shouldnt matter. Maybe GrAnd has an explanation to this?
i made the new function by the way to make it possible to a) have an own icon and not to rely on RAW/EXP and b) make it toggable and c) you can shove this new one in the right bottom corner of your screen, which was impossible with the RAW/EXP thing.

edit: i attached my whole exported sourcetree. you can see all the changes (and crapcode) i made :D
dls deleted

edit: attached barneys s3is zip and the link to zshare with all bins.

to whom it may concern: the remaining raw feature now works fully as intended. please tes tit, especially when you power on cam in movie mode - it should NOT give the warning.
you now have in OSD menu a new entry: Remaining Raw. This toggles the Remaing Raw calculator. It is independent from the "Show RAW/EXP state" toggle. It is depending on "show osd" and "Save RAW" (in RAW parameter menu) of course.
it's default position is in the right corner right above the canon counter (on my a620 it fits perfectly).
when there isnt enough space to write a jpeg and a raw, it will give a blinking warning.

now to the remainingfilespace stuff: works as intended, although i will change it's icon soon.

dls deleted

latest edit: modified 1st post. for the gaziilionst time (at least it feels this way :D). hopefully this project will be over soon :D
icon, code cleaning, -> official trunk.
« Last Edit: 19 / February / 2008, 17:45:12 by PhyrePhoX »

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: Calculation of remaining shots with RAW - done :D
« Reply #99 on: 15 / February / 2008, 09:51:25 »
I'll give it a shot with the icon. I guess it's only a matter of changing some x,y coordinates?

I think it is not as useful as the counter or the percentage, but if you leave the battery shape people could get confused.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal