From 466983819c9c8a97229f89e9e3cfb3d36ad57e05 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 18 Nov 2013 21:05:55 +0100 Subject: [gugus] cleanup --- scripts/gugus/controls.lua | 2 +- scripts/gugus/sliproDigits.lua | 53 +++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/scripts/gugus/controls.lua b/scripts/gugus/controls.lua index fc4aa7e..ff11bf5 100644 --- a/scripts/gugus/controls.lua +++ b/scripts/gugus/controls.lua @@ -1,7 +1,7 @@ --- mLCDup = 10 -mLCDdown = 9 +mLCDdown = 9 mKeyDelay = 100 -- diff --git a/scripts/gugus/sliproDigits.lua b/scripts/gugus/sliproDigits.lua index a8c1c07..f9c6321 100644 --- a/scripts/gugus/sliproDigits.lua +++ b/scripts/gugus/sliproDigits.lua @@ -75,7 +75,7 @@ function leftDigitsEvent(swFunction) end elseif swValue == 4 then -- laps completed:speed - inf = GetContextInfo("laps") + local inf = GetContextInfo("laps") if inf ~= nil then -- if more than 99 laps if inf >= 100 then @@ -90,32 +90,31 @@ function leftDigitsEvent(swFunction) if inf ~= nil then -- check if sector > 9 if inf >9 then - lPanel = string.format("S%02d:%3.0f", inf, spd) + lPanel = string.format(",%02d:%3.0f", inf, spd) else - lPanel = string.format("S%01d :%3.0f", inf, spd) + lPanel = string.format(",%01d :%3.0f", inf, spd) end end elseif swValue == 6 then -- laps completed:total laps if available - inf = GetContextInfo("laps") - if inf ~= nil then - local tl = GetContextInfo("lapscount") - if tl < 1 then tl = 0 end - -- if more than 99 laps - local laps - local total - if inf >= 100 then - laps = string.format("%03d", inf ) - else - laps = string.format("L%02d", inf) - end - if tl >= 100 then - total = string.format("%03d", tl) - else - total = string.format("t%02d", tl) - end - lPanel = laps .. ":" .. total + local inf = GetContextInfo("laps") + local tl = GetContextInfo("lapscount") + if tl < 1 then tl = 0 end + if inf == nil then inf = 0 end + local laps = "L--" + local total = "t--" + -- if more than 99 laps + if inf >= 100 then + laps = string.format("%03d", inf ) + else + laps = string.format("L%02d", inf) + end + if tl >= 100 then + total = string.format("%03d", tl) + else + total = string.format("t%02d", tl) end + lPanel = laps .. ":" .. total elseif swValue == 7 then -- water temp inf = GetCarInfo("watertemp") @@ -276,12 +275,12 @@ function leftDigitsEvent(swFunction) end local sSector = " " - local sectors = GetCarInfo("sector") - if sectors ~= nil then + local sector = GetCarInfo("sector") + if sector ~= nil then if sector > 9 then - sSector = string.format("S%2d", sect) + sSector = string.format("S%02d", sector) else - sSector = string.format(" S%1d", sect) + sSector = string.format(" S:%1d", sector) end end @@ -298,9 +297,9 @@ function leftDigitsEvent(swFunction) local sect = GetCarInfo("sector") -- check if sector > 9 if sect >9 then - lPanel = string.format(" S%02d ", sect) + lPanel = string.format(" S:%02d ", sect) else - lPanel = string.format(" S%01d ", sect) + lPanel = string.format(" S:%1d ", sect) end elseif swValue == 30 then -- cgit v1.2.3