CANserver Development

  • SUPPORT THE SITE AND ENJOY A PREMIUM EXPERIENCE!
    Welcome to Tesla Owners Online, five years young! For a low subscription fee, you will receive access to more features on the site. We now offer yearly memberships too! For more information visit this page:
    https://teslaownersonline.com/account/upgrades

    SUBSCRIBE TO OUR YOUTUBE CHANNEL!
    Did you know we have a YouTube channel that's all about Tesla? Lots of Tesla information, fun, vlogs, product reviews, and a weekly Tesla Owners Online Podcast as well!

amund7

Active member
Joined
Dec 17, 2018
Messages
130
Location
Drammen
Country
Country
Tesla Owner
Model 3
Don't get me wrong, I'm also for WIFI instead of BT. But I think @amund7 has now other priorities (like bringing iOS version functionality Android version level).
That's why I'm saying it make sense to use BT at this moment.

True, but when pyjamasman is contributing, this can be implemented without affecting the other stuff I'm working on too much.
 
  • Like
Reactions: 1 person

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
My hope, as always, was to bring the brilliant minds together to help each other out, and to have everything work together as an ecosystem. The more all the software and products work together, the more powerful and easy to use they all are...and they also lend customers to each other. Mine are certainly a long way off from a product for the genera consumer (could get there some day), but to have something more powerful to offer to the geeks and data nerds. And the more the merrier.
 

Eugenius

Active member
Joined
Jun 27, 2019
Messages
32
Location
Nuremberg
Country
Country
Tesla Owner
Model 3
@JWardell any ideas how to get Chassis Bus on post 2019 cars?
We already seen here third party displays with CAN connector to right bord computer. Maybe this were a good way to get both busses for CANServer?
Another place is somewere in right B-pillar, but you have to disassemble alot :/
 

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
@JWardell any ideas how to get Chassis Bus on post 2019 cars?
We already seen here third party displays with CAN connector to right bord computer. Maybe this were a good way to get both busses for CANServer?
Another place is somewere in right B-pillar, but you have to disassemble alot :/

I'm still trying to figure out what cars are missing the passenger seat module/harness. Only 1 or 2 people in europe apparently are missing it. It's there for most.
You can certainly tap the connector off the computer for all three busses, as Igninext does.
 
  • Like
Reactions: 1 person

Eugenius

Active member
Joined
Jun 27, 2019
Messages
32
Location
Nuremberg
Country
Country
Tesla Owner
Model 3
I tried to find Chassis Bus connector under passanger seat in my 2019 EU Model 3, but I don't know what to looking for :D
 

Randy Spencer

Member
Joined
Jul 9, 2016
Messages
18
Location
Alameda, CA
It seems from the above posts that not all the cars have it, but you are looked for the loop of cable under the seat. From there look up and toward the front of the car, you should see two plugs attached under the lip of the seat. The yellow one unplugs like a phone or ethernet plug. Same color as the port on the CanServer. Then plug that plug into the CanServer's port and plug the short wire into the lip of the seat where the other plug was.

If you don't see it send a photo of what you DO see. It may be obvious, but you can adjust the seat to it's highest high to make all this easier
 

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
I tried to find Chassis Bus connector under passanger seat in my 2019 EU Model 3, but I don't know what to looking for :D

Shown at the beginning of this video. If it's not there, then yes I would appreciate an under-seat picture, I would like to see where the wires to the seating occupancy pad go to instead.

 

Xxtreme

Member
Joined
Jun 24, 2020
Messages
8
Location
Germany / Braunschweig
Country
Country
Tesla Owner
Model 3
20210117_111306.jpg

This is my LR 08.2020 EU
20210117_111133.jpg
Screenshot_20210117-115058_Video Player.jpg
 
Last edited:

Eugenius

Active member
Joined
Jun 27, 2019
Messages
32
Location
Nuremberg
Country
Country
Tesla Owner
Model 3
I looked today under the passenger seat. Box with yellow socket is there, but without yellow plug :D
That means, no chassis bus here, right?
MF date: 04/19/2019 EU Version Model 3 LR AWD
P.S. Thanks for CANServer installation video. It helped!
 

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
I looked today under the passenger seat. Box with yellow socket is there, but without yellow plug :D
That means, no chassis bus here, right?
MF date: 04/19/2019 EU Version Model 3 LR AWD
P.S. Thanks for CANServer installation video. It helped!

Never seen that before! Strange factory build. You sure there isn't an unplugged black 4-pin connector under there somewhere?
 

Madmolecule

Top-Contributor
Green Level Supporter
Joined
Oct 7, 2018
Messages
603
Location
Duluth, GA
Country
Country
Tesla Owner
Model 3
Dual Display Script Functionality
I have tried to create a script to add additional information for a dual display set-up. I find it really provides a lot of additional information that provides more situational awareness. I have just used it for a couple of days so I would certainly like your feedback on functionality as well as how to program the same functionality more elegantly as I am not much of a programmer.

Features:
Display Mode

  • Turn displays off if car center display is off
  • If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
  • If Vehicle Speed is below 5 Mph and not 0 Mph (stopped), display Parking Mode
  • If Vehicle Speed is above 5 Mph display, Speed Limit Mode
Modes

Stoplight Mode

If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
Alternate between four, 4, different displays while the vehicle is stopped. Displays alternate every 5 seconds.
Also disables turn signal indicator when stopped

Display 1
Time and Temperature
UTC Time converted to EST

IMG_4607.jpeg


Display 2
Front Left and Right Tire Pressure (PSI)

IMG_4616.jpeg


Display 3
Rear Left and Right Tire Pressure (PSI)

IMG_4611.jpeg


Display 4
Time and Range (Miles)


IMG_4604.jpeg


Parking Mode
When Vehicle is in Drive display Front Sensors
When Vehicle is in Reverse display Rear Sensors
IMG_4564.jpeg


Display Front Middle Left and Front Middle Right sensors on the digital display
Display Left and Right-Side Sensors on Bar Graph in Red, each LED is 2 Inches



Speed Limit Mode

If Vehicle Speed is above 5 Mph display, Speed Limit Mode

Displays Speed and Speed Limit

Displays Left and Right Blindspot Arrow Overlays

IMG_4574.jpeg

Displays on the bar graph One Red LED per 5 MPH above speed limit

Displays on the bar graph One Green LED per 5 MPH below speed limit

Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit
IMG_4587.jpeg

Threshold changes from 15 to 20 Mph at Speed Limits above 55

Flashes Orange LEDs when in Construction Zone

(Currently signal is not working properly)

Display Left and Right Turn Signals on Bar Graph

I am also interfacing to the canserver with Teslax

Josh has done an amazing job with this product but as always, I have a wish list for future products
  • Larger TFT display that is fully programmable as messages or graphics
  • CAN message link to and audio player for internal and external messages. Would be nice for us older non boom box folks. Text to speech would be great to add real time info such as construction zone, school zone, tire pressure, range etc. Also, some fun sentry mode comments would be great.
  • Adjustable screen brightness
  • Trending and some basic machine learning functions such as predicting when you should add air in the tires. Difference in inflation between the tires, and lost efficiency per PSI difference from optimum.
  • It would be nice if Elon would add a power user or hobbiest screen on the display with user configurable buttons and sliders. Very easy to add and would make for some great interface options.

C++:
-- Turn displays off if car center display is off

if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then

for i = 0,1

do

CANServer_setDisplayString(i, "1m t0b1000r")

end

return

end



-- If Vehicle Speed is = 0 Mph (stopped) then display Stoplight Mode



local displaysd = CANServer_getAnalysisVar("VehSpeed")

displaysd = math.floor(displaysd * 0.6213712)



if (displaysd == 0) then



-- Stoplight Mode

-- If Speed is less 0 Mph (stopped) aleternate between these displays

-- Display switch time is set at 5 seconds



local currentMills = CANServer_millis()

local lastSwitchTime = CANServer_getVar('lastSwitchTime')

local displayNumber = CANServer_getVar('displayNumber')



if (currentMills - lastSwitchTime > 5000) then

displayNumber = displayNumber + 1



if (displayNumber > 4) then

displayNumber = 0

end

CANServer_setVar('displayNumber', displayNumber)

CANServer_setVar('lastSwitchTime', currentMills)

end



if (displayNumber == 0) then



local hrs = CANServer_getAnalysisVar("Hours")

local min = CANServer_getAnalysisVar("Minutes")



-- converts UTC to Eastern Standard Time 12 Hr format

-- 24 - 5 for EST



hrs = hrs + 19;

local zone = "AM";

if (hrs > 24) and (hrs < 37) then

hrs = hrs - 12;

zone = "AM";

else if (hrs < 25) then

hrs = hrs - 24;

zone = "PM";

else if (hrs > 36) then

hrs = hrs - 36;

zone = "PM";

end

end

end



-- Display Time and Temperature

CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -TIME- " .. " " .. math.floor(hrs) .. ":" .. math.floor(min) .. zone .."t" .. "b1m1o100r")



else if (displayNumber == 1) then



-- Display Front Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontLeft") * 14.5038)) * 10) .. "vTNORFu" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontRight") * 14.5038)) * 10) .. "vTNORFu" .. "b0m1o100r");



else if (displayNumber == 2) then



-- Display Rear Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearLeft") * 14.5038)) * 10) .. "vRAER u" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearRight") * 14.5038)) * 10) .. "vRAER u" .. "b0m1o100r");



else if (displayNumber == 3) then



-- Displays Temperature and Mile Range



CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -RANGE- ".. CANServer_getAnalysisVar("Range") .. "MI " .. "t" .. "b1m1o100r");

end

end

end

end

end



local displayspd = CANServer_getAnalysisVar("VehSpeed")

displayspd = math.floor(displaysd * 0.6213712)



if (displayspd > 5) then



-- Speed Limit Script

-- Left and Right Blindspot Arrow Overlay

-- Sets Left Blindspot Arrow Overlay Variable

local bsl = CANServer_getAnalysisVar("BSL");

local bld = 0;

local r0time = 100;

-- Sets Right Blindspot Arrow Overlay Variable

local bsr = CANServer_getAnalysisVar("BSR");

local brd = 0;

local r1time = 100;



-- Value of 1 will Display Left Arrow Ovlerlay

if (bsl == l or bsl == 2) then

bld = 1;

r0time = 800;

end

-- Value of 2 will Display Right Arrow Ovlerlay

if (bsr == l or bsr == 2) then

brd = 2;

r1time = 800;

end

-- If bld value > 0 display the Left Blindspot overlay on Display 0

if (bld > 0) then

CANServer_setDisplayString(0, bld .. "v63488c6m1000r")

end

-- If brd value > 0 display the Right Blindspot overlay on Display 1

if (brd > 0) then

CANServer_setDisplayString(1, brd .. "v63488c6m1000r")

end



-- Calculates vehicle speed in Miles per Hour

local displayspeed = CANServer_getAnalysisVar("VehSpeed")

displayspeed = displayspeed * 0.6213712

-- Calculates difference between Vehicle Speed and Speed Limit for Display 1

local spl = CANServer_getAnalysisVar("SPL")

local dif = (displayspeed - spl)

local disp0bar = 0;

local disp1bar = 0



-- Displays One Red LED per 5 MPH above speed limit

if (dif > 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Displays One Green LED per 5 MPH below speed limit

if (dif < 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit

-- Threshold changes from 15 to 20 Mph at speed limits above 55

if ((spl < 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

if ((spl > 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

-- Flashes Orange LEDs when in Construction Zone

local cnz = CANServer_getAnalysisVar("ConstZone")

if (cnz > 1) then

disp0bar = 40;

end



-- Display Turn Signals on Bar Graph



-- Left turn signal on bargraph 14 green LEDs



if (CANServer_getAnalysisVar("VCFRONT_indicatorLef") == 2) then -- Lef blinker on bargraph

disp0bar = -14;

end



-- Right turn signal on bargraph 14 green LEDs



if (CANServer_getAnalysisVar("VCFRONT_indicatorRig") == 2) then -- right blinker on bargraph

disp1bar = -14;

end



-- Sets Displays

local displaySped = CANServer_getAnalysisVar("VehSpeed")

displaySped = displaySped * 0.6213712

CANServer_setDisplayString(0, "65535c" .. math.floor(displaySped * 10) .. "vHPM u" .. disp0bar .. "b" .. r0time .. "r0m0o")

CANServer_setDisplayString(1, "65535c" .. math.floor(dif * 10) .. "vHPM u" .. disp1bar .. "b" .. r1time .. "r0m1o")



end



-- If Vehicle Speed is below 5 Mph display Parking Mode



local displaySpeed = CANServer_getAnalysisVar("VehSpeed")

displaySpeed = displaySpeed * 0.6213712



if ((displaySpeed > 0 and displaySpeed < 5) or (displaySpeed < 0)) then



-- Parking Sensor Script

-- When in Drive displays display front parking sensors and when in reverse display rear sensors

local disp0bar = 0;

local disp1bar = 0;

local dgs = 0;

-- Front Sensor Variables

-- Converted from CM to inches

local dgs = CANServer_getAnalysisVar("DriveGearStat");

local fls = CANServer_getAnalysisVar("ParkFrontLeft");

fls = fls * 0.39370;

local flm = CANServer_getAnalysisVar("ParkFrontLeftMid");

flm = flm * 0.39370;

local frm = CANServer_getAnalysisVar("ParkFrontRightMid");

frm = frm * 0.39370;

local frs = CANServer_getAnalysisVar("ParkFrontRight")

frs = frs * 0.39370;

-- Rear Sensor Variables

-- Converted from CM to inches

local rls = CANServer_getAnalysisVar("ParkRearLeft");

rls = rls * 0.39370;

local rlm = CANServer_getAnalysisVar("ParkRearLeftMid");

rlm = rlm * 0.39370;

local rrm = CANServer_getAnalysisVar("ParkRearRightMid");

rrm = rrm * 0.39370;

local rrs = CANServer_getAnalysisVar("ParkRearRight")

rrs = rrs * 0.39370;



-- If Vehicle is in Drive display Front Sensors

if (dgs == 4) then

-- Display Left and Right Sensors on Bar Graph in Red, each LED is 2 Inches

disp0bar = fls / (-2);

disp1bar = frs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(flm * 10) .. "vTNORFu" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(frm * 10) .. "vTNORFu" .. disp1bar .. "b100r0m1o");

end



-- If Vehicle is in Reverse display Rear Sensors

if (dgs == 2) then

disp0bar = rls / (-2);

disp1bar = rrs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(rlm * 10) .. "vRAER u" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(rrs * 10) .. "vRAER u" .. disp1bar .. "b100r0m1o");

end

end

return

{

"n": "ConstZone",

"bid": "1",

"fid": 583,

"sb": 24,

"bl": 1,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Hours",

"bid": "-1",

"fid": 792,

"sb": 24,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Minutes",

"bid": "-1",

"fid": 792,

"sb": 40,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "OutsideTemp",

"bid": "-1",

"fid": 801,

"sb": 40,

"bl": 8,

"f": 0.5,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontLeft",

"bid": "1",

"fid": 526,

"sb": 18,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontLeftMid",

"bid": "1",

"fid": 526,

"sb": 27,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontLeftRaw",

"bid": "1",

"fid": 526,

"sb": 9,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 0,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Range",

"bid": "-1",

"fid": 826,

"sb": 0,

"bl": 10,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "SPL",

"bid": "1",

"fid": 921,

"sb": 8,

"bl": 5,

"f": 5,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "Seconds",

"bid": "-1",

"fid": 792,

"sb": 16,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontLeft",

"bid": "-1",

"fid": 799,

"sb": 0,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontRight",

"bid": "-1",

"fid": 799,

"sb": 16,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearLeft",

"bid": "-1",

"fid": 799,

"sb": 32,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearRight",

"bid": "-1",

"fid": 799,

"sb": 48,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "VehSpeed",

"bid": "-1",

"fid": 599,

"sb": 12,

"bl": 12,

"f": 0.08,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

Mod edit: inserted code into code block for legibility
 
Last edited by a moderator:

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
Dual Display Script Functionality
I have tried to create a script to add additional information for a dual display set-up. I find it really provides a lot of additional information that provides more situational awareness. I have just used it for a couple of days so I would certainly like your feedback on functionality as well as how to program the same functionality more elegantly as I am not much of a programmer.

Features:
Display Mode

  • Turn displays off if car center display is off
  • If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
  • If Vehicle Speed is below 5 Mph and not 0 Mph (stopped), display Parking Mode
  • If Vehicle Speed is above 5 Mph display, Speed Limit Mode
Modes

Stoplight Mode

If Vehicle Speed is = 0 Mph (stopped), display Stoplight Mode
Alternate between four, 4, different displays while the vehicle is stopped. Displays alternate every 5 seconds.
Also disables turn signal indicator when stopped

Display 1
Time and Temperature
UTC Time converted to EST

View attachment 36937

Display 2
Front Left and Right Tire Pressure (PSI)

View attachment 36936

Display 3
Rear Left and Right Tire Pressure (PSI)

View attachment 36935

Display 4
Time and Range (Miles)


View attachment 36938

Parking Mode
When Vehicle is in Drive display Front Sensors
When Vehicle is in Reverse display Rear Sensors
View attachment 36943

Display Front Middle Left and Front Middle Right sensors on the digital display
Display Left and Right-Side Sensors on Bar Graph in Red, each LED is 2 Inches



Speed Limit Mode

If Vehicle Speed is above 5 Mph display, Speed Limit Mode

Displays Speed and Speed Limit

Displays Left and Right Blindspot Arrow Overlays

View attachment 36941
Displays on the bar graph One Red LED per 5 MPH above speed limit

Displays on the bar graph One Green LED per 5 MPH below speed limit

Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit
View attachment 36942
Threshold changes from 15 to 20 Mph at Speed Limits above 55

Flashes Orange LEDs when in Construction Zone

(Currently signal is not working properly)

Display Left and Right Turn Signals on Bar Graph

I am also interfacing to the canserver with Teslax

Josh has done an amazing job with this product but as always, I have a wish list for future products
  • Larger TFT display that is fully programmable as messages or graphics
  • CAN message link to and audio player for internal and external messages. Would be nice for us older non boom box folks. Text to speech would be great to add real time info such as construction zone, school zone, tire pressure, range etc. Also, some fun sentry mode comments would be great.
  • Adjustable screen brightness
  • Trending and some basic machine learning functions such as predicting when you should add air in the tires. Difference in inflation between the tires, and lost efficiency per PSI difference from optimum.
  • It would be nice if Elon would add a power user or hobbiest screen on the display with user configurable buttons and sliders. Very easy to add and would make for some great interface options.

C++:
-- Turn displays off if car center display is off

if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then

for i = 0,1

do

CANServer_setDisplayString(i, "1m t0b1000r")

end

return

end



-- If Vehicle Speed is = 0 Mph (stopped) then display Stoplight Mode



local displaysd = CANServer_getAnalysisVar("VehSpeed")

displaysd = math.floor(displaysd * 0.6213712)



if (displaysd == 0) then



-- Stoplight Mode

-- If Speed is less 0 Mph (stopped) aleternate between these displays

-- Display switch time is set at 5 seconds



local currentMills = CANServer_millis()

local lastSwitchTime = CANServer_getVar('lastSwitchTime')

local displayNumber = CANServer_getVar('displayNumber')



if (currentMills - lastSwitchTime > 5000) then

displayNumber = displayNumber + 1



if (displayNumber > 4) then

displayNumber = 0

end

CANServer_setVar('displayNumber', displayNumber)

CANServer_setVar('lastSwitchTime', currentMills)

end



if (displayNumber == 0) then



local hrs = CANServer_getAnalysisVar("Hours")

local min = CANServer_getAnalysisVar("Minutes")



-- converts UTC to Eastern Standard Time 12 Hr format

-- 24 - 5 for EST



hrs = hrs + 19;

local zone = "AM";

if (hrs > 24) and (hrs < 37) then

hrs = hrs - 12;

zone = "AM";

else if (hrs < 25) then

hrs = hrs - 24;

zone = "PM";

else if (hrs > 36) then

hrs = hrs - 36;

zone = "PM";

end

end

end



-- Display Time and Temperature

CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -TIME- " .. " " .. math.floor(hrs) .. ":" .. math.floor(min) .. zone .."t" .. "b1m1o100r")



else if (displayNumber == 1) then



-- Display Front Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontLeft") * 14.5038)) * 10) .. "vTNORFu" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSFrontRight") * 14.5038)) * 10) .. "vTNORFu" .. "b0m1o100r");



else if (displayNumber == 2) then



-- Display Rear Tire Pressure

-- Get Tire Pressures and convert fro Bar to PSI

CANServer_setDisplayString(0, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearLeft") * 14.5038)) * 10) .. "vRAER u" .. "b0m0o100r");

CANServer_setDisplayString(1, "65535c" .. (((CANServer_getAnalysisVar("TPMSRearRight") * 14.5038)) * 10) .. "vRAER u" .. "b0m1o100r");



else if (displayNumber == 3) then



-- Displays Temperature and Mile Range



CANServer_setDisplayString(0, "65535c" .. ((( CANServer_getAnalysisVar("OutsideTemp") * (9/5)) + 32) * 10) .. "vF u".. "100r0m0o")

CANServer_setDisplayString(1, "65535c2s -RANGE- ".. CANServer_getAnalysisVar("Range") .. "MI " .. "t" .. "b1m1o100r");

end

end

end

end

end



local displayspd = CANServer_getAnalysisVar("VehSpeed")

displayspd = math.floor(displaysd * 0.6213712)



if (displayspd > 5) then



-- Speed Limit Script

-- Left and Right Blindspot Arrow Overlay

-- Sets Left Blindspot Arrow Overlay Variable

local bsl = CANServer_getAnalysisVar("BSL");

local bld = 0;

local r0time = 100;

-- Sets Right Blindspot Arrow Overlay Variable

local bsr = CANServer_getAnalysisVar("BSR");

local brd = 0;

local r1time = 100;



-- Value of 1 will Display Left Arrow Ovlerlay

if (bsl == l or bsl == 2) then

bld = 1;

r0time = 800;

end

-- Value of 2 will Display Right Arrow Ovlerlay

if (bsr == l or bsr == 2) then

brd = 2;

r1time = 800;

end

-- If bld value > 0 display the Left Blindspot overlay on Display 0

if (bld > 0) then

CANServer_setDisplayString(0, bld .. "v63488c6m1000r")

end

-- If brd value > 0 display the Right Blindspot overlay on Display 1

if (brd > 0) then

CANServer_setDisplayString(1, brd .. "v63488c6m1000r")

end



-- Calculates vehicle speed in Miles per Hour

local displayspeed = CANServer_getAnalysisVar("VehSpeed")

displayspeed = displayspeed * 0.6213712

-- Calculates difference between Vehicle Speed and Speed Limit for Display 1

local spl = CANServer_getAnalysisVar("SPL")

local dif = (displayspeed - spl)

local disp0bar = 0;

local disp1bar = 0



-- Displays One Red LED per 5 MPH above speed limit

if (dif > 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Displays One Green LED per 5 MPH below speed limit

if (dif < 0) then

disp0bar = (dif / 5);

disp1bar = (dif / 5);

end

-- Flashes 18 Red LEDs when 15 or 20 MPH above Speed Limit

-- Threshold changes from 15 to 20 Mph at speed limits above 55

if ((spl < 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

if ((spl > 55) and(dif > 15)) then

disp0bar = 18;

disp1bar = 18;

end

-- Flashes Orange LEDs when in Construction Zone

local cnz = CANServer_getAnalysisVar("ConstZone")

if (cnz > 1) then

disp0bar = 40;

end



-- Display Turn Signals on Bar Graph



-- Left turn signal on bargraph 14 green LEDs



if (CANServer_getAnalysisVar("VCFRONT_indicatorLef") == 2) then -- Lef blinker on bargraph

disp0bar = -14;

end



-- Right turn signal on bargraph 14 green LEDs



if (CANServer_getAnalysisVar("VCFRONT_indicatorRig") == 2) then -- right blinker on bargraph

disp1bar = -14;

end



-- Sets Displays

local displaySped = CANServer_getAnalysisVar("VehSpeed")

displaySped = displaySped * 0.6213712

CANServer_setDisplayString(0, "65535c" .. math.floor(displaySped * 10) .. "vHPM u" .. disp0bar .. "b" .. r0time .. "r0m0o")

CANServer_setDisplayString(1, "65535c" .. math.floor(dif * 10) .. "vHPM u" .. disp1bar .. "b" .. r1time .. "r0m1o")



end



-- If Vehicle Speed is below 5 Mph display Parking Mode



local displaySpeed = CANServer_getAnalysisVar("VehSpeed")

displaySpeed = displaySpeed * 0.6213712



if ((displaySpeed > 0 and displaySpeed < 5) or (displaySpeed < 0)) then



-- Parking Sensor Script

-- When in Drive displays display front parking sensors and when in reverse display rear sensors

local disp0bar = 0;

local disp1bar = 0;

local dgs = 0;

-- Front Sensor Variables

-- Converted from CM to inches

local dgs = CANServer_getAnalysisVar("DriveGearStat");

local fls = CANServer_getAnalysisVar("ParkFrontLeft");

fls = fls * 0.39370;

local flm = CANServer_getAnalysisVar("ParkFrontLeftMid");

flm = flm * 0.39370;

local frm = CANServer_getAnalysisVar("ParkFrontRightMid");

frm = frm * 0.39370;

local frs = CANServer_getAnalysisVar("ParkFrontRight")

frs = frs * 0.39370;

-- Rear Sensor Variables

-- Converted from CM to inches

local rls = CANServer_getAnalysisVar("ParkRearLeft");

rls = rls * 0.39370;

local rlm = CANServer_getAnalysisVar("ParkRearLeftMid");

rlm = rlm * 0.39370;

local rrm = CANServer_getAnalysisVar("ParkRearRightMid");

rrm = rrm * 0.39370;

local rrs = CANServer_getAnalysisVar("ParkRearRight")

rrs = rrs * 0.39370;



-- If Vehicle is in Drive display Front Sensors

if (dgs == 4) then

-- Display Left and Right Sensors on Bar Graph in Red, each LED is 2 Inches

disp0bar = fls / (-2);

disp1bar = frs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(flm * 10) .. "vTNORFu" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(frm * 10) .. "vTNORFu" .. disp1bar .. "b100r0m1o");

end



-- If Vehicle is in Reverse display Rear Sensors

if (dgs == 2) then

disp0bar = rls / (-2);

disp1bar = rrs / (-2);

CANServer_setDisplayString(0, "65535c" .. math.floor(rlm * 10) .. "vRAER u" .. disp0bar .. "b100r0m0o");

CANServer_setDisplayString(1, "65535c" .. math.floor(rrs * 10) .. "vRAER u" .. disp1bar .. "b100r0m1o");

end

end

return

{

"n": "ConstZone",

"bid": "1",

"fid": 583,

"sb": 24,

"bl": 1,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Hours",

"bid": "-1",

"fid": 792,

"sb": 24,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Minutes",

"bid": "-1",

"fid": 792,

"sb": 40,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "OutsideTemp",

"bid": "-1",

"fid": 801,

"sb": 40,

"bl": 8,

"f": 0.5,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkFrontLeft",

"bid": "1",

"fid": 526,

"sb": 18,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontLeftMid",

"bid": "1",

"fid": 526,

"sb": 27,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontLeftRaw",

"bid": "1",

"fid": 526,

"sb": 9,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "ParkFrontRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRight",

"bid": "1",

"fid": 526,

"sb": 45,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightMid",

"bid": "1",

"fid": 526,

"sb": 36,

"bl": 0,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "ParkRearRightRaw",

"bid": "1",

"fid": 526,

"sb": 0,

"bl": 9,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "Range",

"bid": "-1",

"fid": 826,

"sb": 0,

"bl": 10,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "SPL",

"bid": "1",

"fid": 921,

"sb": 8,

"bl": 5,

"f": 5,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}



{

"n": "Seconds",

"bid": "-1",

"fid": 792,

"sb": 16,

"bl": 8,

"f": 1,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontLeft",

"bid": "-1",

"fid": 799,

"sb": 0,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSFrontRight",

"bid": "-1",

"fid": 799,

"sb": 16,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearLeft",

"bid": "-1",

"fid": 799,

"sb": 32,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "TPMSRearRight",

"bid": "-1",

"fid": 799,

"sb": 48,

"bl": 8,

"f": 0.025,

"so": 0,

"s": false,

"bo": true,

"log": false,

"v": 3

}

{

"n": "VehSpeed",

"bid": "-1",

"fid": 599,

"sb": 12,

"bl": 12,

"f": 0.08,

"so": -40,

"s": false,

"bo": true,

"log": false,

"v": 3

}

Mod edit: inserted code into code block for legibility

So impressive! I know you put a lot of time and effort into this and have achieved far more than everyone else!
Can you make a walkthrough video demonstrating every screen?
 
  • Agree
Reactions: TrevP

TrevP

TOO Founder / Technoking
Founder
Joined
Oct 20, 2015
Messages
7,644
Location
Toronto
Country
Country
Tesla Owner
Model 3
Should have a variable at the start of the code to set metric / imperial.
That way a non programmer can just select his preference and upload the code
 

Madmolecule

Top-Contributor
Green Level Supporter
Joined
Oct 7, 2018
Messages
603
Location
Duluth, GA
Country
Country
Tesla Owner
Model 3
That’ll be an easy thing to add. I tried the metric system, it’s just too exact for me, there’s no flavor or color. I prefer a system where a AAA battery is smaller than AA, but a DD bra is larger than a D. You just can’t do that in the metric system.
 
  • Funny
Reactions: JWardell

JWardell

TOO Master Member
TOO Sponsor Vendor
Joined
May 9, 2016
Messages
4,784
Location
Boston
Country
Country
Tesla Owner
Model 3
Should have a variable at the start of the code to set metric / imperial.
That way a non programmer can just select his preference and upload the code

At least for the speed limit display code, it will automatically display MPH or KPH as you have it set in the car. More than half of customers use non-freedom units :)
 

Madmolecule

Top-Contributor
Green Level Supporter
Joined
Oct 7, 2018
Messages
603
Location
Duluth, GA
Country
Country
Tesla Owner
Model 3
I am updating it to switch everything based on what you choose in the miles/kilometers selection. You will also be able to enter your time zone.
 
  • Like
Reactions: TrevP

About us

  • Tesla Owners Online © 2015-2021. All rights reserved.
    Tesla Owners Online (TOO) is an enthusiast forum and is not affiliated with Tesla Motors or Official Tesla Owners Clubs.
    All Tesla logos are trademarks or registered trademarks of Tesla Motors.