Turbo3
Gold Member
Posts: 1985
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

Tue May 01, 2018 2:02 pm

(Updated Help to match the released apps. Any new variables added will be available in the next release.)

Custom Screen

The csv file format is as follows and can be edited with a text editor but is much easier to edit using Excel or compatible program. It is best to start with one of the sample files in order to keep the required first two lines.

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.

The first parameter on each line defines the type of element to be drawn or defines the colors to be used when drawing an element. There are currently nine supported types as follows.

L - Label/Variable (ex SOC 45%)
DL - Draw Line
DR - Draw Rectangle
DT - Draw Text (can be rotated)
CP - Color of Panel (screen background)
CL - Color of Label
CV - Color of Variable
CD - Color of Drawing elements (lines/rectangles)
CT - Color of Text (drawn text)

Label/Variable (L)

The Label/Variable type defines a label followed by an optional variable. It is possible to define a variable with a blank label or a label with no variable.

The default label colors are Black / LightGray (Day / Night) with a transparent background. The default variable colors are Black / Black (Day / Night) with a LightGray background . These colors/backgrounds can be changed using the Color of Label (CL) and Color of Variable (CV) elements.

Example: "L,25,0,SOC ,11,r,50,48,20,12,c,40,48" Display SOC label and variable.

Example: "L,100,0,,0,r,0,35,-30, 80,C, 90,35" Display HV voltage, no label, no units.

Example: "L,10,45, Wh,20,L,100,42" Label, no variable.

Column A: type - "L"

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. It is recommended to 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: attributes - Defines the justification and bold attributes of the text label. "L" for Left, "R" for Right, "C" for center and "B" for bold. (ex CB = center bold)

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

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: attributes - Defines the justification and bold attributes of the variable. "L" for Left, "R" for Right, "C" for center and "B" for bold. (ex CB = center bold)

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

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.

Here is the list of currently available variables that can be displayed and their index number (used in Column I).

0 = VIN
1 = Battery Serial Number
2 = Odometer
3 = Ambient Temperature
4 = Speed
10 = Trip Time
11 = Distance
12 = Range
13 = Energy Used
14 = Starting Gids
15 = Trip Gids
16 = Distance Remaining
20 = SOC
21 = SOH
22 = Battery Health
23 = Bat Temperature
24 = AHr Capacity
30 = HV Volts
31 = HV Battery Amps
32 = AHr Remaining
33 = Gids
34 = Battery Wh
35 = Gids %
36 = Wh Counter
40 = HV Voltage min
41 = HV Voltage max
42 = HV Voltage avg
43 = HV Voltage delta
44 = Bat Temp Rear Center
45 = Bat Temp Front Right
46 = Bat Temp Middle Left
47 = Bat Temp Middle Right
50 = Motor Power
51 = Battery Power W
52 = Aux Power
53 = PTC Heater Power
54 = A/C Power
55 = A/C+PTC Power
56 = Motor Power kW
60 = Motor Temperature
61 = Motor RPM
62 = Command Torque
70 = L1/L2
71 = Quick Charges
72 = Plug State
73 = Charge Mode
74 = Charge Power
75 = EVSE Voltage
76 = EVSE Max Amps
80 = Front Left tire
81 = Front Right tire
82 = Rear Right tire
83 = Rear Left tire
84 = Tire delta
90 = Power Switch
91 = Gear Position
92 = Head Lamp status
93 = Front Wiper Status
94 = Wheel Angle
100 = Cycle Time
101 = Good Response
102 = Bad Response
103 = Missing Frames
104 = Retries
105 = Frame Delay Time

Draw Line(DL)

Use this element to draw a line from point x1,y1 to x2,y2 with a specified width. The default line colors of Black/LightGray can be changed with the Color of Drawing (CD) element.

Example: "DL,0,50,100,50,3" Draw horizontal line in middle of screen, width of 3.

Column A: type - "DL"

Column B: x1 - This floating point value defines, in horizontal percentage of width, the starting point of the line.

Column C: y1 - This floating point value defines, in vertical percentage of height, the starting point of the line.

Column D: x2 - This floating point value defines, in horizontal percentage of width, the ending point of the line.

Column D: y2 - This floating point value defines, in vertical percentage of height, the ending point of the line.

Column F: width - Line Width

Draw Rectangle (DR)

Use this element to draw a rectangle from point x1,y1 to x2,y2 with a specified width. The default rectangle colors of Black/LightGray can be changed with the Color of Drawing (CD) element.

Example: "DR, 20, 10, 40, #0.5, 0,5" Draw rectangle, thick line.

Example: "DR, 30, 20, 40, #, 0, 3" Draw square, thin line.

Column A: type - "DR"

Column B: x1 - This floating point value defines, in horizontal percentage of width, the top starting point of the rectangle.

Column C: y1 - This floating point value defines, in vertical percentage of height, the top starting point of the rectangle.

Column D: x2 - This floating point value defines, in horizontal percentage of width, the bottom ending point of the rectangle.

Column E: y2 or # or #n.n - This floating point value, "#" or "#n.n" defines the bottom ending point of the rectangle. There are three options for this value.

Absolute: y2 = % screen height (ex 23)
Square: y2 = # (ex #)
Rectangle: y2 = #aspect (ex #0.5)

Setting the aspect to 0.5 will draw a rectangle half as high as wide.

Column F: fill - 1=Fill rectangle, 0=no fill

Column G: width - Rectangle Line Width

Draw Text (DT)

Draws text around specified location (anchor point). Text can be rotated around anchor point. The color of the text can be changed with the Color of Text (CT) element.

Example: "DT ,Sample Text, 55, 18, d, 14, c"

Example: "DT ,Sample Text, 55, 18, d, 14, l, 90" rotate 90 degrees CW.

Column A: type - "DT"

Column B: text - Text to be drawn. Any leading and trailing spaces are kept.

Column C: x - This floating point value defines, in horizontal percentage of width, the anchor point of the text.

Column D: y - This floating point value defines, in vertical percentage of height, the anchor point of the text.

Column E: font - Defines font used.

D : Default font
B : Bold default font

Column F: size - Defines font size in points. A typical size would be 14.

Column G: justification - Defines the justification around the anchor point. Values are:

L : Text is drawn with the first character to the right of the anchor point
C : Text is drawn centered around the anchor point
R : Text is drawn with the last character to the left of the anchor point

Column H: degrees - This optional parameter defines the clockwise rotation of the text around the anchor point.

Colors
Colors are defined in pairs. The first color is used in day mode and the second is used when in night mode.

Color numbers should be specified in four byte hexadecimal ARGB format, 0xAARRGGBB where

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

Examples
0xFF000000 = Black
0xFF87CEFA = Light Sky Blue
0xFFFFFFFF = White
0 = Transparent (used for a background color)

Color of Panel (CP)

Use this element to change the background color of the screen. The screen colors must be a solid color so the Alpha byte is internally forced to 0xFF independent of what is actually specified.

The default background colors are White / Black (Day / Night).

Example: "CP, 0xFF87CEFA, 0xFF000000" sets the background to light sky blue and black.

Column A: type - "CP"

Column B: day - Day time background color.

Column C: night - Night time background color.

Color of Line (CL)

Use this element to change the color of the label in any Label (L) element that follows this line. Typically the background colors are set to transparent by setting the Alpha byte to zero.

The default label colors are Black / Light Gray (Day / Night).

Example: "CL, 0xFF87CEFA, 0xFF000000, 0, 0"

Column A: type - "CL"

Column B: text day color - Label text color during day.

Column C: text night color - Label text color at night.

Column D: background day color - Label background color during day.

Column E: background night color - Label background color during night.

Color of Variable (CV)

Use this element to change the color of the variable in any Label (L) element that follows this line. Optionally add a border around the variable.

Example: "CV, 0xFFFF0000, 0xFFFF0000, 0x0, 0x0" Display variable in Red.

Example: "CV, 0xFF000000, 0xFF808080, 0x0, 0x0, 1, 0" Place border around variable.

The default variable colors are Black / Light Gray (Day / Night).

Column A: type - "CV"

Column B: text day color - Variable text color during day.

Column C: text night color - Variable text color at night.

Column D: background day color - Variable background color during day.

Column E: background night color - Variable background color during night.

Column F: border width - Optional border width around variable. Default is no border. The border color will be the same as the text color.

Column G: border radius - Radius of optional border around variable. A zero radius will result in square corners.

Color of Drawing (CD)

The default color for drawings (lines and rectangles) is Black for day and LightGray for night. Use this element to change the color used for any drawings following this line or to restore the previous colors.

Example: "CD, 0xFFFF0000, 0xFFFF0000" Draw lines and rectangles in Red

Example: "CD, POP" Restore previous drawing colors

Column A: type - "CD"

Column B: day color or restore - Drawing day color or "POP" to restore the previous colors

Column C: night color - Drawing night color

Color of Text (CT)

The default color for drawn text is Black for day and LightGray for night. Use this element to change the colors used to draw text or restore the previous colors.

Example: "CT, 0xFFFF0000, 0xFFFF0000" Draw text in Red

Example: "CT, POP" Restore previous drawn text colors

Column A: Type - "CT"

Column B: day color or restore - Drawn Text day color or "POP" to restore the previous colors

Column C: night color - Drawn Text night color

LeftieBiker
Posts: 9592
Joined: Wed May 22, 2013 3:17 am
Delivery Date: 31 May 2013
Location: Upstate New York, US

Re: LeafSpy Pro Custom Screens

Tue May 01, 2018 2:44 pm

Hey, Turbo: would it be possible for you to use a LeafSpy screen to duplicate / improve upon the "eyebrow display" from the earlier Leafs? It would be great to have a large digital speed readout, along with time, outside temps,and whatever else would be useful. We could clip a smartphone wherever it best suited our preference, instead of having to gaze into the instrument well and interpret the analog display..
Scarlet Ember 2018 Leaf SL W/ Pro Pilot
2009 Vectrix VX-1 W/18 Leaf modules, & 3 EZIP E-bicycles.
PLEASE don't PM me with Leaf questions. Just post in the topic that seems most appropriate.

Turbo3
Gold Member
Posts: 1985
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

Tue May 01, 2018 4:06 pm

LeftieBiker wrote:Hey, Turbo: would it be possible for you to use a LeafSpy screen to duplicate / improve upon the "eyebrow display" from the earlier Leafs? It would be great to have a large digital speed readout, along with time, outside temps,and whatever else would be useful. We could clip a smartphone wherever it best suited our preference, instead of having to gaze into the instrument well and interpret the analog display..

Yes, something like that could be created on the custom screen.

In the next release, I have just added Speed as one of the new variables that can be display.

At some point I will be redesigning the core function that reads data from the Leaf. The new core will have the option to only read data that is being displayed. This will greatly improve the refresh time when a limited selection of information is being displayed on a custom screen.

But I leave it to users to create new custom screens. If some parameter is not currently available just ask for and I will see what I can do.

LeftieBiker
Posts: 9592
Joined: Wed May 22, 2013 3:17 am
Delivery Date: 31 May 2013
Location: Upstate New York, US

Re: LeafSpy Pro Custom Screens

Tue May 01, 2018 9:41 pm

So you think it's possible now to create a screen to do what I suggested above? That would be great! I haven't done much with LeafSpy beyond reading stats, but I'll definitely try to make myself a high mounted, digital display. And yes, the "read only what's displayed" sounds like a good idea.

Can someone point me to a good ODBII extension cable with an on-off switch?
Scarlet Ember 2018 Leaf SL W/ Pro Pilot
2009 Vectrix VX-1 W/18 Leaf modules, & 3 EZIP E-bicycles.
PLEASE don't PM me with Leaf questions. Just post in the topic that seems most appropriate.

Turbo3
Gold Member
Posts: 1985
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

Sun Jun 10, 2018 4:35 pm

Gauges are coming. (Updated 7/21/2018)
This screen shows real time data with a refresh rate of about 5 times per second.
Image
Here is the file that defined that screen.

Code: Select all

CP,0xFF87CEFA, 0xFF000000
GEM
' SOC Graph
CGR0, 20,100
CGR1, 5,20
CGR2, 0,5
GA, 12.5,25, 25, 20, "SOC", 1 ,0 ,100, 2.5, 4

' HV Battery Voltage
CGR0, 365,394
CGR1, 340,365
CGR2, 300,340
GEM
GA, 21.5,72.5, 25, 30, "HV Bat", 1, 310, 400, 5,4 ,2
CG

' HV Battery Current
CGR0,-100,0
CGR1,50,100
CGR2,100,280
GA, 55,50, 98, 31, "HV Bat", 2, -100, 280, 10,5

' HV Battery Power
CGR0,-50,0
CGR1,25,50
CGR2,50,100
GA, 88,21, 21, 57, "HV Bat", 2, -50, 100, 5,5
CGR

'GEM
' 12v Battery Voltage
CGR0,12,14.5
CGR1,10.5,12
CGR2,0,10.5
GA, 88,63, 21, 110, "12v Bat", 2, 8,15, 0.2,5
CGR

You can also see the new Left/Right tap areas to make it easier to move between screens. The normal swipe left/right is hard to use with so many active areas on the screen so I added these tap area (available on all screens not just the custom screen.

Tapping the lower half of the gauge cycles through displaying the current value, min or max value. A long tap brings up a dialog to clear the min/max markers for this gauge or all gauges.

The meaning of the bottom right two gauges is not yet known.
Image
Last edited by Turbo3 on Sat Jul 21, 2018 12:05 pm, edited 5 times in total.

mischl
Posts: 6
Joined: Thu Oct 19, 2017 2:42 am
Delivery Date: 19 Sep 2017
Leaf Number: 012781

Re: LeafSpy Pro Custom Screens

Sat Jul 21, 2018 4:51 am

Thanks for this feature, very handy.

some points:
- the update interval from battery Wh (#34) and Wh counter (#36) seems not to be the same
- even when the setting is °C, the ambient temperature (#3) seems to be in °F: 68 °C (68 °F are about 20 °C, all the other Temps are correct and about 19.7 °C, also the ambient on screen 3) [how to attach a picture here?]
- probably the same problem with the range (#12): xy km but the Leaf display shows anything else
- isn't there a more precise resolution than km for the Trip distance (#11)?
- an expression kWh/km would be handy
- courier as font would be nice as every sign has a fix width and therefore the value strings wouldn't jump anymore horizontally
- Gauges are nice, but charts (line/bar) would be the bummer!

Cheers

Turbo3
Gold Member
Posts: 1985
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

Sat Jul 21, 2018 11:33 am

mischl wrote:Thanks for this feature, very handy.

some points:
- the update interval from battery Wh (#34) and Wh counter (#36) seems not to be the same
- even when the setting is °C, the ambient temperature (#3) seems to be in °F: 68 °C (68 °F are about 20 °C, all the other Temps are correct and about 19.7 °C, also the ambient on screen 3) [how to attach a picture here?]
- probably the same problem with the range (#12): xy km but the Leaf display shows anything else
- isn't there a more precise resolution than km for the Trip distance (#11)?
- an expression kWh/km would be handy
- courier as font would be nice as every sign has a fix width and therefore the value strings wouldn't jump anymore horizontally
- Gauges are nice, but charts (line/bar) would be the bummer!

Cheers

- For the Wh counter I need to know which one you are using (there are four). Go into Settings/Battery to find the type listed for "Config Wh Counter".
- Ambient temperature has its own control in Settings/Units. If the value for ambient temperature is not correct toggle the "Convert Outside Temperature" option.
- Don't understand your comment about range #12. What does "Leaf display shows anything else".
- No, Leaf is limited to 1 km steps.
- What does "an expression kWh/km" refer to? Are you asking for an efficiency number? If you are that is hard to do given a 1 km distance interval.
- I have added "M" as an option to the attribute field to select a monospace. Note that the "L" Label/Variable type is being replaced with several new types that automatically selects the correct font based on the new Height and Width parameters. This will eliminate the need to manually adjust the font scale for different screen sizes.
- "would be the bummer!" is that good or bad? "bummer by itself is bad but your usage is unclear to me. I have updated the above screenshot to show an example of the latest version of gauges running on LeafSpy Pro. Note the max/min markers.

mischl
Posts: 6
Joined: Thu Oct 19, 2017 2:42 am
Delivery Date: 19 Sep 2017
Leaf Number: 012781

Re: LeafSpy Pro Custom Screens

Sat Jul 21, 2018 12:38 pm

thank you for the detailed answers

- Wh counter: App Start & 1st Connect, D+C. If the value of #36 decreases, the value of #34 does not at the same time what looks a bit unusual.
- ambient: the option made it, thx
- range: it shows me 50.2 km on the custom screen but the guess-o-meter of the leaf says 68 km. shouldn't it be the same?
- trip: thx for the explanation
- kWh/km: thought as an efficiency indicator, but for sure it is useless with a only a resolution of km's. (btw: also a trigger for the logging would be nicer with a distance (e.g. 100m) instead of a time delay, but that's also not possible with this resolution. wouldn't it be possible to trigger it from the app itself as the gps is monitored continually?)
- monospace: ups, that slipped through, sorry
- line chart: sorry, I used a wrong word, it would be fantastic! with gauges, even with min/max the progress over time is not visible (as the time needs an own axis - x). the best would be like Image

Turbo3
Gold Member
Posts: 1985
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

Sat Jul 21, 2018 1:50 pm

mischl wrote:thank you for the detailed answers

- Wh counter: App Start & 1st Connect, D+C. If the value of #36 decreases, the value of #34 does not at the same time what looks a bit unusual.
- ambient: the option made it, thx
- range: it shows me 50.2 km on the custom screen but the guess-o-meter of the leaf says 68 km. shouldn't it be the same?
- trip: thx for the explanation
- kWh/km: thought as an efficiency indicator, but for sure it is useless with a only a resolution of km's. (btw: also a trigger for the logging would be nicer with a distance (e.g. 100m) instead of a time delay, but that's also not possible with this resolution. wouldn't it be possible to trigger it from the app itself as the gps is monitored continually?)
- monospace: ups, that slipped through, sorry
- line chart: sorry, I used a wrong word, it would be fantastic! with gauges, even with min/max the progress over time is not visible (as the time needs an own axis - x).

- #36 and #34 are looking at different parameters from the Leaf and will not precisely track. One is based on Gids (#34) and the other (#36) on SOC and AHr which have a much higher level of precision. #34 being based on Gids is going to change very slowly whereas #36 is going to change every time it is sampled although the change might be so small it does not change a digit being displayed.
- Range shown by LeafSpy has nothing to do with the range shown on the Leaf dash. The LeafSpy range is based on settings you have made on screen 4.
- Monospace is being added to a future release. It is not available now.

Turbo3
Gold Member
Posts: 1985
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

Sun Jul 22, 2018 2:05 pm

Here is the current list of Custom Types that will be supported in the next release.

Note that Label "L" in Red is being dropped. Replaced with Label "LBL", Label then Variable "LV" and Variable then Label "VL". The key difference is that "font" is replaced with "height" and "template". Template is a sample of the text to be displayed which is used to automatically select the largest font size that will fit in the defined width & height. This way the font is automatically adjust based on screen size.

For Labels why don't I just use the actual Label text to set the font size. Why do I need to give a template? If the actual text was used then if you have many labels each one could be in a different font size which looks strange. By supplying the same template (ex. "XXXXXXXXX") then the same font will be selected for each one given the width and height for the label/variable is the same.

Some types have optional parameters as defined in the # Parms column.

X and Y locations default to being the center of the item. A negative or 0 value uses the left/top as the anchor point instead of the center. So a Gauge defined at 50,50 would be located with its center in the center of the screen

As you can see more than half of the types are used by Gauges. Basically everything about a gauge can be controlled. The Pack Size and Units types allow you to define different gauges for different Pack Sizes and Units to support different ranges. Just surround the gauge definition types with the Pack or Units types. First one starts and second one ends. If the current pack size or units does not match the tag then the surround lines are skipped.

Gauge ranges have default colors of Green, Yellow, Red but these can be changed by adding a third parameter.

A gauge can have from one to four pointers. This allows all four tire pressures or battery temperatures to be displayed on a single gauge. To do this instead of providing a single index like "xx" you use "[xx yy zz aa]".

Image

Return to “LEAF CANBus”