Skip to content

Commit

Permalink
Merge pull request #452 from jdlcdl/ram_indicator
Browse files Browse the repository at this point in the history
draw_ram_indicator() easier numbers to read, includes RAM just collected
  • Loading branch information
odudex authored Sep 7, 2024
2 parents 8166a9e + 51b13a2 commit 6ceb7e8
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/krux/pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,36 @@ def draw_status_bar(self):
# self.draw_ram_indicator()

# def draw_ram_indicator(self):
# """Draws the amount of free RAM in the status bar"""
# """Draws the amount of free RAM in the status bar +recently-collected"""
# def strnum(_in):
# large_units = ("","K","M")

# value = _in
# for i in range(len(large_units)):
# unit = large_units[i]
# if value < 2**10:
# break
# if i+1 < len(large_units):
# value /= 2**10

# if value == int(value):
# fmt = "%d" + unit
# else:
# if value < 1:
# fmt = "%0.3f" + unit
# elif value < 10:
# fmt = "%.2f" + unit
# elif value < 100:
# fmt = "%.1f" + unit
# else:
# fmt = "%d" + unit

# return fmt % value

# pre_collect = gc.mem_free()
# gc.collect()
# ram_text = "RAM: " + str(gc.mem_free())
# post_collect = gc.mem_free()
# ram_text = "RAM: " + strnum(post_collect) + " +" + strnum(post_collect - pre_collect)
# self.ctx.display.draw_string(12, 0, ram_text, GREEN)

def draw_battery_indicator(self):
Expand Down

0 comments on commit 6ceb7e8

Please sign in to comment.