Skip to content

Commit

Permalink
use MB for memory sizes less than 1GB
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisruk committed Oct 1, 2020
1 parent bc6f70c commit 340355e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gpiozero/pins/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,11 +1305,15 @@ def __format__(self, format_spec):
return self.board.format(style=style, **kw)
elif content == 'specs':
specs = self._asdict()
specs['memory'] /= 1024
if specs['memory'] < 1024:
specs['memory_unit'] = "MB"
else:
specs['memory'] /= 1024
specs['memory_unit'] = "GB"
return dedent("""\
{style:bold}Revision {style:reset}: {revision}
{style:bold}SoC {style:reset}: {soc}
{style:bold}RAM {style:reset}: {memory}GB
{style:bold}RAM {style:reset}: {memory}{memory_unit}
{style:bold}Storage {style:reset}: {storage}
{style:bold}USB ports {style:reset}: {usb} {style:yellow}(excluding power){style:reset}
{style:bold}Ethernet ports {style:reset}: {ethernet}
Expand Down

0 comments on commit 340355e

Please sign in to comment.