Add configuration options to memtemp.py (fields, position, vertical line spacing) #918
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Memtemp
Added CPU frequency
I believe this is useful data to have as an option. It's not enabled by default but users can configure it through settings as one of the three fields shown in the plugin (see below).
Made field types and order configurable (max 3 fields)
The field types and order of the fields has been made configurable through
main.plugins.memtemp.fields
. If a user prefers to use"cpu,temp,freq"
or"mem,freq,cpu"
then they can configure this accordingly in the settings. Thefields
config setting takes a comma separate list of field names. Whitespace is stripped in the code. Default value is"mem,cpu,temp"
.Made line spacing and position configurable
Some users might prefer to slightly tweak the position or the vertical line spacing of the UI element for their specific screen. This can now be set using
main.plugins.memtemp.position
andmain.plugins.memtemp.linespacing
, respectively. Default values are the position as is currently defined for each display, but the vertical line spacing has been reduced to 10 pixels to align with the GPS module.position
is a comma separated string of an x and y position (white space is again stripped).linespacing
is an integer value. Some examples (horizontal layout settings example exaggerated to show effect oflinespacing
andposition
config settings) :Updated the code to dynamically generate UI elements
To support the configurable fields, position, and vertical line spacing, the UI elements are now dynamically generated as needed. If the user configures the plugin with 2 fields, then 2
LabeledValue
objects are created (for vertical alignment). Horizontal UI elements are nowText
objects (since they have no label anyway) and are split in a header and data UI element (of which the latter is the updated with current values).Changed horizontal UI elements to Text
See the previous section.
Updated to version 1.0.2
Given the number of changes I felt an version bump was in order.
### GPSHandled in #919There were some redundant spaces and incorrect coordinates which have now been fixed.Motivation and Context
Fixes #920
Making the plugin more configurable and dynamic by adding settings for position, vertical line spacing, and field types and their order ensures that the plugin output can be configured to more user's personal tastes and requirements (some people want to know the CPU load, some want to see frequency. Some like small vertical spacing and have it align with the GPS module's output, some like a wider layout and slight shift in position).
How Has This Been Tested?
This has been tested on a pi zero and pi 3b running 1.5.3. Default values for screen positioning have not been altered from the previous version (but individual line positioning variables have been reduced to a single horizontal and vertical coordinate as the position for each line is now automatically calculated). Vertical line spacing was reduced to 10 to align with the output of the GPS module and now configurable vs the static line spacing a
newline
character resulted in. Any incorrect position on screen for other displays than the WaveShare v2 (which has been tested), can be quickly adjusted via a configuration setting until the default is updated in the code.Types of changes
Checklist:
git commit -s