Closed mathoudebine closed 6 months ago
hi @mathoudebine
Thx for integrating my work. Really pleased
I quickly looked your PR on my Steam Deck, as i'm not at home. So i could not test it futher until next weekend.
Seems good, but i have one major request. Please make the size of history definable by a line graph attribute. It will be more customizable, and you'll save memory if you don't use plot graph on a stat. (actually you save 10 elements of each stat, even if we are not using it). In my use case, my FPS graph is 100 plots long, and this may vary along use cases.
for example you can define a LINE_GRAPH.HISTORY_SIZE with a default value to 10. Change that to an empty initialization
class CPU:
last_values_cpu_percentage = last_values_list(size=10)
last_values_cpu_temperature = last_values_list(size=10)
last_values_cpu_fan_speed = last_values_list(size=10)
Group this two lines under an IF statement. And initialize the list if LINE_GRAPH is activated. Like
if not theme_data['LINE_GRAPH'].get("SHOW", False):
if list is not initialized: # will be played only first time
<method to initialize list to theme_data['LINE_GRAPH']['HISTORY_SIZE'] or default value 10>
save_last_value(cpu_percentage, cls.last_values_cpu_ percentage)
display_themed_line_graph(theme_data['LINE_GRAPH'], cls.last_values_cpu_percentage)
Don't really know the dynamic list allocation in python, but there might be a malloc equivalent, or just loop append() method HISTORY_SIZE time...
(sorry for bad style/formatting/exact code, but it's hard on the Steam Deck :D )
What do you think about this ?
Anyway i'll will test if more deeply saturday or sunday.
Thanks for reviewing it! Did you really type Python code on a Steam Deck ? 😄 I've added a way to set the history size from the theme for line graphs, thanks to what you suggested
Hi @hicwic I've reworked a bit your PR in this branch. I've moved most of the code from sensors_custom.py to other sensor classes (LHM, Python) and added line graphs on most CPU/GPU sensors I've also slightly edited your theme to reflect on these changes Don't hesitate to have a look and tell me what you think before I merge this branch!