in this part of the code, if SSW=0, the redport will be on for a very narrow time frame. I doubt that you will be able to see it. And then it will loop for ever in the main1.

whatever redport is , might be a bit var that could never be seen

the snippet is useless , so many things undefined