Get free RAM on SD? - Script Writing - CHDK Forum

Get free RAM on SD?

  • 2 Replies
  • 1351 Views
*

Offline Davo

  • ***
  • 176
Get free RAM on SD?
« on: 04 / February / 2013, 07:28:40 »
Advertisements
Hi,

I want to find the free RAM (MB) on my card so I can shut down my script when it gets full.

I tried this in Lua

function get_free_ram()
  meminfo=get_meminfo()
  return(meminfo.free_size)
end

but I get a value of 760,000 (bytes?) on an empty 32GB card.

Any ideas on how to get the same value that CHDK shows on the LCD?

many thanks
Dave

*

Offline philmoz

  • *****
  • 3175
    • Photos
Re: Get free RAM on SD?
« Reply #1 on: 04 / February / 2013, 07:32:09 »
Hi,

I want to find the free RAM (MB) on my card so I can shut down my script when it gets full.

I tried this in Lua

function get_free_ram()
  meminfo=get_meminfo()
  return(meminfo.free_size)
end

but I get a value of 760,000 (bytes?) on an empty 32GB card.

Any ideas on how to get the same value that CHDK shows on the LCD?

many thanks
Dave

RAM is not the same as SD storage.

You need to use the get_free_disk_space() function.

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)

*

Offline Davo

  • ***
  • 176
Re: Get free RAM on SD?
« Reply #2 on: 04 / February / 2013, 08:20:55 »
Thanks - it works like a charm. I guess I really need to RTM  ;)

Dave

 

Related Topics