chore: pålæsnings-diagnose viser AD's hele beslutningskæde — 1.62.164

This commit is contained in:
2026-10-10 06:44:36 +02:00
parent a2b78829c7
commit 1daa3ec0b7
3 changed files with 21 additions and 3 deletions
+19 -2
View File
@@ -76,8 +76,9 @@ local function adGates(adEnv, vehicle, trailer, trigger, fillType)
local allows = trailer.getFillUnitAllowsFillType == nil or trailer:getFillUnitAllowsFillType(i, fillType)
local okM, match = pcall(autoDrive.fillTypesMatch, vehicle, trigger, trailer, selected, i)
local okL, inList = pcall(autoDrive.trailerIsInTriggerList, trailer, trigger, i)
table.insert(parts, string.format("enhed%d: understøtter=%s tillader=%s fri=%.0f varevalg=%s iListe=%s", i, tostring(supports), tostring(allows),
trailer:getFillUnitFreeCapacity(i) or -1, okM and tostring(match) or "fejl", okL and tostring(inList) or "fejl"))
local okT, viaTrigger = pcall(function() return ToolType ~= nil and trailer.getFillUnitSupportsToolType ~= nil and trailer:getFillUnitSupportsToolType(i, ToolType.TRIGGER) end)
table.insert(parts, string.format("enhed%d: understøtter=%s tillader=%s fri=%.0f varevalg=%s iListe=%s trigger-værktøj=%s", i, tostring(supports), tostring(allows),
trailer:getFillUnitFreeCapacity(i) or -1, okM and tostring(match) or "fejl", okL and tostring(inList) or "fejl", okT and tostring(viaTrigger) or "fejl"))
end
local tm = vehicle.ad.trailerModule
if tm ~= nil then
@@ -89,6 +90,22 @@ local function adGates(adEnv, vehicle, trailer, trigger, fillType)
local okC, continueEmpty = pcall(autoDrive.getSetting, "continueOnEmptySilo", vehicle)
local okW, wait = pcall(function() return ADSmartPickup ~= nil and ADSmartPickup.shouldWaitForLoading ~= nil and ADSmartPickup.shouldWaitForLoading(vehicle) end)
table.insert(parts, string.format("rotér=%s fortsætTom=%s smartHolder=%s", okR and tostring(rotate) or "?", okC and tostring(continueEmpty) or "?", okW and tostring(wait) or "?"))
-- AD's egen beslutningskæde: autoload-gren (aldrig trigger), "giv videre til CP", og hvad AD selv finder af par
local stateModule = vehicle.ad.stateModule
local okH, canRestart = pcall(function() return stateModule.getCanRestartHelper ~= nil and stateModule:getCanRestartHelper() end)
table.insert(parts, string.format("hasAL=%s cpOvertag=%s mode=%s", tostring(vehicle.ad.hasAL), okH and tostring(canRestart) or "?",
tostring(stateModule.getMode ~= nil and stateModule:getMode() or "?")))
local okP, pairs_ = pcall(autoDrive.getTriggerAndTrailerPairs, vehicle, 1000)
if okP and type(pairs_) == "table" then
local found = {}
for _, pair in pairs(pairs_) do
table.insert(found, string.format("%s/enhed%s fyld=%s", tostring(pair.trailer ~= nil and pair.trailer.getName ~= nil and pair.trailer:getName() or "?"),
tostring(pair.fillUnitIndex), tostring(pair.hasFill)))
end
table.insert(parts, "ADpar=" .. (#found > 0 and table.concat(found, ",") or "ingen"))
else
table.insert(parts, "ADpar=fejl: " .. tostring(pairs_))
end
return table.concat(parts, " ")
end
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.62.163.0</version>
<version>1.62.164.0</version>
<title>
<en>AD Smart Pickup</en>
</title>