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

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

  • 175 Replies
  • 68094 Views
*

Offline whim

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

After playing with your latest build a bit more, I got an idea for giving
the battery icon back it's (rightfull) place, by trying to integrate the
raw available code into "core/gui_osd.c", in the function void gui_osd_draw_state(),
which is where - among other things - "RAW" is drawn on the display
to which I think it could be appended, it would show like "RAW:125"
I'm gonna try it tomorrow, need sleep now ...

wim

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX

Deleted
« Last Edit: 22 / April / 2008, 11:06:44 by Barney Fife »
[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
couldnt sleep :D

Code: [Select]
void gui_osd_draw_state() {
    int a,b, 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 char osd_buf[32];
    n=0;
 
    if (conf.save_raw || gui_mode==GUI_MODE_OSD){
b=0;
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);
    osd_buf[8]=0;
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color);
        //     draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, "RAW", conf.osd_color);
        n+=FONT_HEIGHT;
  }
  else
  {
    sprintf(osd_buf, "RAW:NONE!");
    osd_buf[9]=0;
if (b==0)
{   
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, 0x24);
    b=1;
    }
    else
    {
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color);
    b=0;
    }
    //     draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, "RAW", conf.osd_color);
        n+=FONT_HEIGHT;
    }
   
   
           
    }
...snip
this ugly piece of code will do the trick.

the if (b==0) was planned to result in a nice blinking effect (red-white) when there is no space for raw left, but somehow this doesnt work :D
and again, ugly code, but it compiles ;)

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
the if (b==0) was planned to result in a nice blinking effect (red-white) when there is no space for raw left, but somehow this doesnt work :D

The 'b' should be 'static', shouldn't it? :)
And the code:
Code: [Select]
if (b==0)
{   
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, 0x24);
    b=1;
    }
    else
    {
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, conf.osd_color);
    b=0;
    }
can be replaced by this shorter one:
Code: [Select]
draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf, (b)?conf.osd_color:0x24);
b=!b;
The second line also can be implanted into the first, but it will be too weird. :)
« Last Edit: 11 / February / 2008, 02:21:33 by GrAnd »
CHDK Developer.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Good Morning ! (I'm at GMT+1) Looks like the fairies have been at it while I slept  :lol

Have just taken a look at the code and noticed the following:

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

Code: [Select]
sprintf(osd_buf, "RAW:%3d%", raw_and_jpeg_count);
osd_buf[8]=0;
could be
Code: [Select]
// trimmed trailing '%'
sprintf(osd_buf, "RAW:%3d", raw_and_jpeg_count);
// osd_buf[8]=0;
(same for osd_buf[9] = 0)

@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);
+ the b=0 initialisation should go too (will keep it from flashing properly)
« Last Edit: 11 / February / 2008, 04:24:02 by whim »

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
ur both right (too bad i already admitted that its ugly code, huh? :D). but when i make b static, the desired functionality (blinking red and white) still is not achieved. is the draw gui function executed too fast per second?

edit: ah, the b=0 thing was blocking it from flashing, ur totally right! thanks :)
now it works.do u think this actually is a good idea? the flashing i mean? but if you are in record mode, have raw enabled, and no space left, chances are high you actually want to take a picture, but saving raw will fail. so a warning maybe should be shown. because canon does not write disk full (because for jps there still is space left).
the text "RAW: NONE!" maybe is not the right one. maybe alternate it between "Warning" and "Disk Full"?
and then i already thought of a next feature: detect if raw enabled, detect if script is running, detect if disk is full -> shutdown either script or the cam.
« Last Edit: 11 / February / 2008, 04:26:07 by phyrephox »


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Code: (c) [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;
    static char osd_buf2[32];
    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>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_buf2, "RAW:%3d%", raw_and_jpeg_count);
    osd_buf[10]=0;
    draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf2, conf.osd_color);
        //     draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, "RAW", conf.osd_color);
        n+=FONT_HEIGHT;
  }
  else
  {
    sprintf(osd_buf2, "DISK FULL!");
    osd_buf2[10]=0;
draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, osd_buf2, (b)?conf.osd_color:0x24);
b=!b;
    //     draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, "RAW", conf.osd_color);
        n+=FONT_HEIGHT;
    }
   
   
           
    }
after all, this is the code that works.
mind you, my code is ugly and deeply nested for simplicity and to understand faster (for noobs like me) :)

edit: the alternating text looked weird, so i left "DISK FULL!" in there.
« Last Edit: 11 / February / 2008, 20:59:40 by PhyrePhoX »

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Yes, that must be it ! I was already thinking it might be a good idea
to not refresh the value at every display. Are all these OSD functions
called every 10 ms, as I have someone (Barney) state somewhere ?

btw, working code is never ugly, no need to put yourself down  ;)

btw2, what I missed out on is the lib.c implementation, IIRC there
were 2 ways to implement camera_jpeg_count_str() ?

 :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
« Last Edit: 11 / February / 2008, 04:46:05 by whim »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal