Skip to content

Commit

Permalink
Add systemactive signal and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwardell committed Oct 25, 2020
1 parent 32d6e9e commit 338772d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions user-data/displays/2.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
if (CANServer_getAnalysisVar("DisplayOn") < 1) then
return "1m t0b1000r"
-- Display speed, with blindspot overlay arrows

-- Turn display off if car center display is off
if ((CANServer_getAnalysisVar("DisplayOn") == 0) and (CANServer_getAnalysisVar("UI_systemActive") == 1)) then
return "1m t0b1000r"
end

-- Calculate battery power for bargraph
local battPowerKW = (CANServer_getAnalysisVar("BattVolts") * CANServer_getAnalysisVar("BattAmps") / 1000.0)
local graphBattPower = math.floor(math.min(math.max((24) * (battPowerKW) / (300), -24), 24))

-- Decode right and left blindspot signals to send to display
local bsr = CANServer_getAnalysisVar("BSR");
local bsl = CANServer_getAnalysisVar("BSL");
local bsd = 0;

if (bsl == 1 or bsl == 2) then
bsd = 1;
end
Expand All @@ -20,7 +24,7 @@ if (bsd > 0) then
else
local speedUnitText = "HMK"
local displaySpeed = CANServer_getAnalysisVar("VehSpeed")
if (CANServer_getAnalysisVar("DistanceUnitMiles") == 1) then
if (CANServer_getAnalysisVar("DistanceUnitMiles") == 1) then -- convert to MPH
speedUnitText = "HPM"
displaySpeed = displaySpeed * 0.6213712;
end
Expand Down

0 comments on commit 338772d

Please sign in to comment.