LeafSpy Pro Custom Screens

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Turbo3

Well-known member
Leaf Supporting Member
Joined
Jul 19, 2010
Messages
2,014
Location
San Jose, CA
The just released test version 0.40.104 of LeafSpy Pro for Android and test version 1.6.29 for iOS (and higher versions) now support user definable Custom Screens. This allows you to display only the information you really need . What gets displayed and its size and position are user defined. There is currently a list of 49 variables to choose from. If I have missed any let me know. The Custom Screen is accessed by swiping up or down on screen 3. There is a Load button in the lower right corner to select different screens so the number of Custom Screens is actually limited by you creativity.

Included with this release are two sample screens (1 portrait and 1 landscape), one screen displaying all available variables (landscape), and one special screen used to make adjustments (portrait) on the Settings/Options panel.

I used Excel to edit the csv definition files.

One goal is to allow people to share their screen definition files with other LeafSpy Pro users.

The definition file uses screen % for position and horizontal size. This way the definitions should be usable on different size screens by just making two adjustment on the Settings/Options panel (Screen Scale and Font Scale).

File names must end with "P.csv" for Portrait layout files and "L.csv" for Landscape layout files. When loading a layout file if one is also found for the other orientation it will also be loaded (i.e. only the letter P and L are different between the two names). If no matching layout is found the the current layout for the other orientation is left unchanged.

Here are the two sample screens showing a small number of variables in a large font with and without a preceding label. Note you can also have just text and no variable. At the bottom center is a status line showing the current Screen Scaling Factor, Font Scaling Factor and the screen layout as reported by Android.

4LFw0t.png

Here is the csv file used to create the above screen. Note how one variable was given a two line of label.
Code:
If needed adjust User scale factor on Settings/Option panel for better appearance
Type,Width, Offset, Label (comma ends label),font, justify, width(%),top(%),variable, font, justify, width(%),top(%)
L,    80,       0    ,SOC ,                  20,      r,     45,      12,    20,     55,     c,     45,       5 
L,    50,       0    ,SOH ,                  20,      r,     40,      33,    21,     35,     c,     50,      30 
L,    50,       0    ,HVBat ,                20,      r,     40,      50,    30,     35,     c,     50,      47 
L,   100,       0    ,Custom Screen (see files in LEAF_BT_CAN/CUSTOM SCREENS folder),10,     c,    100,       1      
L,    50,       0    ,Gids ,                 20,      r,     40,      67,    33,     35,     c,     50,      64
L,    50,      50    ,AHr,                   20,      c,     36,      29,    32,     35,     c,     54,      30
L,    50,      50    ,Remaining,             20,      c,     36,      36,      ,      0,      ,     54   
L,    50,      50    ,Time ,                 20,      r,     40,      50,    10,     35,     c,     50,      47 
L,    50,      50    ,Ambient ,              20,      r,     40,      66,     3,     35,     c,     50,      64

n3SbJd.png

Here is the csv file used to create the above screen.
Code:
If needed adjust User scale factor on Settings/Option panel for better appearance
Type,Width,Offset, Label (comma ends label), font,justify, width(%),top(%),variable, font,justify, width(%),top(%)
L,100,0,Custom Screen (files in LEAF_BT_CAN/CUSTOM SCREENS),10,c,100,1      
L,100,0,SOC = , 50,r, 45,  5, 20, 50,C, 45, 5
L,100,0,SOH = , 50,r, 45, 20, 21, 50,c, 45, 20
L,100,0,,        0,r,  0, 35, 30, 80,C, 90, 35
L,100,0,Gids = ,50,r, 45, 57, 33, 50,c, 45, 57 
L,100,0,Ah = ,  50,r, 45, 72, 32, 50,c, 45, 72

The below screen was created to debug my display code to be sure all the variables could be displayed correctly. It makes a nice reference screen but not one you would actually use while driving. It demonstrates control over adding the units to the end of the variable. This is controlled in the csv file by placing a negative sign in front of the variable index number. Doing so suppresses appending the units to the end of the variable.

dpbwwY.png


To know what variables are available and their index number just hold down the menu area in the upper right corner and this screen will appear.

i5lBLF.png


The below screen is just used to adjust the two scaling factors for the best appearance on different screen sizes/resolutions. It is device dependent. The Screen Scaling Factor controls the height of the box the label and variable are placed in. You only see this for the variable as the grey background. If the background is too small the lower part of the text/number will be clipped. You can find tune this value by looking to see if the bottom of the "pp" is clipped on in the note at the bottom in the word 'appearance". If clipped increase the scaling factor.

The factor is the Font Scaling Factor which as its name implies refers to the font used. Since the definition file might be created on a device with a small screen the font might be too small on a larger screen. Use this factor to increase or decrease all fonts. The fonts should be adjusted first before making the Screen Scaling Factor adjustment.

3NeljG.png
 
Here are the details for the .csv file that defines a custom screen. The file should be opened and edited with Excel.

The first two lines should not be changed. They are a comment line and a line defining the columns. When LeafSpy reads the file in it always skips the first two lines so if you put definitions on those lines they will be ignored.

In the current implementation there are up to 13 parameters per line. When defining only a label with no variable only eight are used.

Column A: Type - This column is used to specify the format of the following parameters and is for future expansion as only "L" for Lable/Variable is currently supported.

Column B: Width - This floating point value defines in horizontal percentage the amount of space allocated to the field defined by this line. Use 100 if all the space is to be used by this field. If you are making a two column layout then you might use 50 or 33 for a third field layout.

Column C: Offset - This floating point value defines in horizontal percentage the starting location of the field defined by this line. If there is only one field then you would typically use an offset of 0.

Column D: Label - Defines the text string of the label. I add a single space at the end of the text if using right justification to keep the text from coming right up against the following variable.

Column E: font - The font size of the text string. You will need to experiment to see what font looks good on your screen.

Column F: justify - Defines the justification of the text label. "L" for Left, "R" for Right, and "C" for center.

Column G: width - This floating point value defines the width of the label box in terms of percentage of the space defined by column A.

Column H: top - This floating point value defines the top of the box the label is written into in terms of vertical percentage of the screen.

(The following are only used if you want a variable displayed to the right of the label. )

Column I: variable - This integer value defines the variable to be displayed to the right of the label. Making this value negative suppresses displaying any units (V,A, Ahr, PSI...) to the right of the variable.

Column J: font -The font size of the variable. You will need to experiment to see what font looks good on your screen.

Column K: justify - Defines the justification of the variable. "L" for Left, "R" for Right, and "C" for center.

Column L: width - This floating point value defines the width of the variable box in terms of percentage of the space defined by column A.

Column M: top - This floating point value defines the top of the box the variable is written into in terms of vertical percentage of the screen.

If Columns G and L do not add up to 100% then the label/variable fields will be centered in the area defined by Columns B and C.
 
I'm finding the development cycle for a custom screen to take too long. I write something (in Google Sheets), save it to a CSV, upload it to Google Drive, download it to my phone, move it from the Download directory to Leaf Spy's Custom Screen Directly, start up Leaf Spy, navigate to the 3rd screen, swipe up or down until I find my new page.

Any suggestions for shortening that? I guess I'll try to find a program that can edit a CSV in-place on the phone.
 
garsh said:
I'm finding the development cycle for a custom screen to take too long. I write something (in Google Sheets), save it to a CSV, upload it to Google Drive, download it to my phone, move it from the Download directory to Leaf Spy's Custom Screen Directly, start up Leaf Spy, navigate to the 3rd screen, swipe up or down until I find my new page.

Any suggestions for shortening that? I guess I'll try to find a program that can edit a CSV in-place on the phone.
I have my phone connected to my PC with a USB cable so after editing/saving the Excel I just drag and drop the file over to the folder on the phone. Then just hold down the upper right menu button until the Help overlay appears then release to load the updated file.

I would think there should be an Excel app you can run to do it locally. For minor changes like font and position you can just use a text editor locally.

------------------
Just tested making changes on the phone with ES File Explorer. Used the built in text editor. Make change, press save then switch back to LeafSpy to immediately see the change.

------------------
You can use the app "CSV Editor" with the layout files. One issue is it seems to add an extra line of all commas at the end which will give you a warning message when the file is processed. I will handle that better in the next release by ignore such lines.
 
Hi Turbo3

Your custom screens are a great addition , and I'll be using LeafSpy much more regularly while driving, now that I can easily read my cell display. Your sample files are fairly intuitive, as I built my first custom screens before I ever got around to reading this thread...

I have a few queries:

The variable Battery kWh has a negative sign before the identifier (-34), but the output is in the form "6,122". This puzzled me at first, but now appears to me to be an expression of Wh not kWh, which explains the comma after the "6" when I was expecting a decimal point.

The variable Trip displays as an integer value, on screen 4 also. Can this be expressed to 1 decimal place?

On screen 4, Trip is accompanied by km/kWh. Is a variable for km/kWh a possibility?

The main screens display labels and data in black text on a white background, which gives good contrast, important when font sizes are small. The custom screens default to black text on a grey background, which has reduced contrast - could you consider an optional white background, or colour settings for both data and background, so I could use something like white on royal blue or vice versa?

Thanks...
 
hieronymous said:
Hi Turbo3

Your custom screens are a great addition , and I'll be using LeafSpy much more regularly while driving, now that I can easily read my cell display. Your sample files are fairly intuitive, as I built my first custom screens before I ever got around to reading this thread...

I have a few queries:

The variable Battery kWh has a negative sign before the identifier (-34), but the output is in the form "6,122". This puzzled me at first, but now appears to me to be an expression of Wh not kWh, which explains the comma after the "6" when I was expecting a decimal point.

The variable Trip displays as an integer value, on screen 4 also. Can this be expressed to 1 decimal place?

On screen 4, Trip is accompanied by km/kWh. Is a variable for km/kWh a possibility?

The main screens display labels and data in black text on a white background, which gives good contrast, important when font sizes are small. The custom screens default to black text on a grey background, which has reduced contrast - could you consider an optional white background, or colour settings for both data and background, so I could use something like white on royal blue or vice versa?

Thanks...
I am currently working on getting an update of TM-Spy for iOS out which should happen in the next few days.

Once that is done I will have a look at the Custom code and see what is going on.

Keep the suggestions and bugs coming in.
 
In addition to Type "L" the next release will support three additional types to control colors ("CP","CL","CV") . Color should be in 4 byte hex ARGB format, 0xAARRGGBB where

AA = Alpha 0x00=transparent and 0xFF = solid color
RR = Red
GG = Green
BB = Blue

Solid white would be 0xFFFFFFFF, black would be 0xFF000000, and transparent would be 0x00123456 (does not matter want values you place in 123456).

Each element's color needs a day color and a night color. For labels and variables you need to specify the Text color and the Background color. Backgrounds can be transparent by setting Alpha to 0.

Default colors are used until overridden by a Cx type.

CP, DayPanelColor, NightPanelColor (note that Alpha is always forced to 0xFF as the panel color must be a solid color)

CL,LabelDayTextColor, LabelNightTextColor, LabelDayBackgroundColor, LabelNightBackgroundColor

CV,VarDayTextColor, VarNightTextColor, VarDayBackgroundColor, VarNightBackgroundColor

The CP type can be placed anywhere in the file start or end.

The CL and CV types can be single lines placed at the start and then all lines following will use that color scheme. Or you can place one set or just one of them before some or all of the L Types to have every field have a different color.

You can search the Internet for "Hex Colors" to get the values to use and see what the colors look like. Just don't forget to add the Alpha byte at the start or there will be no color. The current labels all use a transparent background and the variables use a solid color background of light gray.
 
Added two more parameters to "CV" that, if present, allow you to control the boarder around the variable (border width and corner radius). A radius of 0 makes it a rectangle.

This screen was created by adding this line at the top. Also fixed the label bug for Battery Wh (was kWh).
Code:
CV,0xFF000000,0xFFFFFFFF,0x0,0x0,1,0,,,,,,
lkP93j.png
 
hieronymous said:
Hi Turbo3
I have a few queries:

The variable Battery kWh has a negative sign before the identifier (-34), but the output is in the form "6,122". This puzzled me at first, but now appears to me to be an expression of Wh not kWh, which explains the comma after the "6" when I was expecting a decimal point.

The variable Trip displays as an integer value, on screen 4 also. Can this be expressed to 1 decimal place?
You understand the function of the negative sign right? It suppresses displaying the units to the right of the variable.

The label "Battery kWh" was a typo The label should be "Battery Wh". The help overlay also has it wrong. If you removed the minus sign you would have seen the correct units "Wh" displayed to the right of the value.

The Trip distance is displayed as an integer when km units is selected. It is an integer from the Leaf so adding a decimal place is of no value as it would always be 0.
 
Turbo3 said:
hieronymous said:
Hi Turbo3
I have a few queries:

The variable Battery kWh has a negative sign before the identifier (-34), but the output is in the form "6,122". This puzzled me at first, but now appears to me to be an expression of Wh not kWh, which explains the comma after the "6" when I was expecting a decimal point.

The variable Trip displays as an integer value, on screen 4 also. Can this be expressed to 1 decimal place?
You understand the function of the negative sign right? It suppresses displaying the units to the right of the variable.

The label "Battery kWh" was a typo The label should be "Battery Wh". The help overlay also has it wrong. If you removed the minus sign you would have seen the correct units "Wh" displayed to the right of the value.

The Trip distance is displayed as an integer when km units is selected. It is an integer from the Leaf so adding a decimal place is of no value as it would always be 0.

Yes, I was clear about the minus sign function, but with the incorrect label I couldn't see why it was there at all. Thanks for the clarification....
 
hieronymous said:
Turbo3 said:
hieronymous said:
Hi Turbo3
I have a few queries:

The variable Battery kWh has a negative sign before the identifier (-34), but the output is in the form "6,122". This puzzled me at first, but now appears to me to be an expression of Wh not kWh, which explains the comma after the "6" when I was expecting a decimal point.

The variable Trip displays as an integer value, on screen 4 also. Can this be expressed to 1 decimal place?
You understand the function of the negative sign right? It suppresses displaying the units to the right of the variable.

The label "Battery kWh" was a typo The label should be "Battery Wh". The help overlay also has it wrong. If you removed the minus sign you would have seen the correct units "Wh" displayed to the right of the value.

The Trip distance is displayed as an integer when km units is selected. It is an integer from the Leaf so adding a decimal place is of no value as it would always be 0.

Yes, I was clear about the minus sign function, but with the incorrect label I couldn't see why it was there at all. Thanks for the clarification....
Again, there is no connection between what the label says and the minus sign. The label can be anything you type in be it correct or not.

The minus sign only controls what is added to the variable field which is always to the right of the label.

But if you use a minus sign and still want to show units you would need to add units to the label. But that is up to you to decide.

I added the minus on power because power in Wh can be a 5 digit number and I did not want the variable field to be any larger by adding in "Wh" so I suppressed it with a minus sign and added units (incorrectly) to the label.
 
Back
Top