Turbo3
Gold Member
Posts: 1835
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

LeafSpy Pro Custom Screens

Mon Oct 23, 2017 9:04 pm

The just released test version 0.40.104 of LeafSpy Pro for Android now supports 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.

Image
Here is the csv file used to create the above screen. Note how one variable was given a two line of label.

Code: Select all

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


Image
Here is the csv file used to create the above screen.

Code: Select all

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.

Image

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.

Image

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.

Image

Turbo3
Gold Member
Posts: 1835
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Re: LeafSpy Pro Custom Screens

Thu Oct 26, 2017 11:42 am

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.

garsh
Posts: 1076
Joined: Sat Feb 12, 2011 5:27 am
Delivery Date: 05 Apr 2012
Location: Pittsburgh PA

Re: LeafSpy Pro Custom Screens

Fri Oct 27, 2017 1:26 am

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.
2012 Black SV w. G35 wheels, 8 bars, 86,000 miles

DaveinOlyWA
Gold Member
Posts: 12213
Joined: Sat Apr 24, 2010 7:43 pm
Delivery Date: 10 Nov 2016
Leaf Number: 314199
Location: Olympia, WA
Contact: Website

Re: LeafSpy Pro Custom Screens

Fri Oct 27, 2017 6:41 am

following
2011 SL; 44,598 miles. 2013 S; 44,840 miles.2016 S30 (build 10/2016)"low water marks" 26,100.2 miles.363GID Ahr 79.55Hx95.35%kwh28.1QCs227,L2's 237
My Blog; http://daveinolywa.blogspot.com" onclick="window.open(this.href);return false;

Turbo3
Gold Member
Posts: 1835
Joined: Mon Jul 19, 2010 8:34 pm
Delivery Date: 12 May 2011
Leaf Number: 002191
Location: San Jose, CA

Re: LeafSpy Pro Custom Screens

Fri Oct 27, 2017 1:39 pm

garsh wrote: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.

Return to “LEAF CANBus”