THC on off problem

i have a problem with the THC.

The THC does not turn off.
the code is M38 THC on an M39 THC off.
Could it be that I have to insert this command into the post processor for it to work?

and this is my postprocessor.

function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText(“START post processor\n”)
ctrl:AppendText(“\n”)
ctrl:AppendText(“Non modal G-codes\n”)
ctrl:AppendText(“Modal coordinates\n”)
ctrl:AppendText(“No comments\n”)
ctrl:AppendText(“Incremental\n”)
end

function OnInit()
post.Text(“%\n”)
if(scale == metric) then
post.Text (“G71\n”) --metric mode
else
post.Text (“G70\n”) --inch mode
end
post.Text (“G91\nG40\nG92X0Y0\n”)
bigarcs = 1 --stitch arc segments together
minArcSize = 0.2 --arcs smaller than this are converted to moves
curx =0
cury =0
firstmove = 1
end

function OnFinish()
OnPenUp()
endX = 0
endY = 0
OnRapid()
post.Text (“M30\n”)
end

function OnRapid()
if(firstmove == 1) then
firstmove=0
return
end
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G0”);
doxy()
post.Eol()
end

function OnMove()
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G1”);
doxy()
– post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
end

function doxy()
tmp = (endX * scale) - curx
tmp = math.toint(tmp * 1000)/1000
curx = curx + tmp
if(tmp ~=0) then
post.NonModalNumber(“X”,tmp,“0.0##”)
end

tmp = (endY * scale) - cury
tmp = math.toint(tmp * 1000)/1000
cury = cury + tmp
if(tmp ~=0) then
post.NonModalNumber(“Y”,tmp,“0.0##”)
end
end

function OnArc()
if(arcAngle <0) then
post.Text (“G03”)
else
post.Text (“G02”)
end
doxy()
if((arcCentreX - currentX) ~=0) then
post.NonModalNumber (“I”, (arcCentreX - currentX) * scale, “0.0##”)
end
if((arcCentreY - currentY) ~=0) then
post.NonModalNumber (“J”, (arcCentreY - currentY) * scale, “0.0##”)
end
–post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
end

function OnPenDown()
post.Text(“M50\n”)
end

function OnPenUp()
post.Text (" M08\n")
end

function OnNewOperation()
post.Text (" (Operation: ", operationName, “)\n”)
end

function OnComment()
post.Text(" (“,commentText,”)\n")
end

function OnNewPart()
post.Text(" (Part: “,partName,”)\n");
end

Is this right?
function OnFinish()
OnPenUp()
endX = 0
endY = 0
OnRapid()
post.Text(“M39\n”) – THC OFF
post.Text (“M30\n”)
end

function OnRapid()
if(firstmove == 1) then
firstmove=0
return
end
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“G0”);
doxy()
post.Eol()
end

function OnMove()
if (math.hypot(endX - currentX, endY - currentY) < 0.01) then return end
post.Text(“M38\n”) – THC ON
post.Text(“G1”);
doxy()
– post.ModalNumber(“F”, feedRate * scale, “0”)
post.NonModalNumber(“F”, feedRate * scale, “0”)
post.Eol()
post.Text(“M39\n”) – THC OFF
end

where did you get this post processor ?
It has numerous questionable modifications that I’ve noticed after just a very brief browse of the code. I’m not sure where to start re. advice.
On the other hand, given the extent of unusual/deviation from the norm, all of it could very well be purposeful and result in controlling your machine just fine.

Does this pp produce valid gcode for your machine, that is, do the cutting results meet your expectations ?
other than the THC On/Off management ?

den post processor habe ich für die Starfire im Netz gefunden die Änderung für THC on und THC off habe ich mir selbst durch Informationen selbst zusammengestellt. deshalb meine Frage ist das so möglich oder habe ich hierzu einen Denkfehler.

translation from @brabirl - “I found the post processor for the Starfire on the net, the change for THC on and THC off I put together myself through information. that’s why my question is that possible or do I have a mistake in thinking about this.”

I’d like to have a link to the original Starfire post processor that you found.
Or, tell me which of the three Starfire post processors in the sheetcam installed library you can use-

Given the unmodified pp, I can likely make a recommendation to modify.