Ok, I need some hunk of code to detect the peek not the zero crossing. ( this is the solution).
Problem: Toroid based power supply have inrush current problems. As when you turn on the power switch,
it is a random chance where on the sine wave it will be.
You can not start this a zero crossing as that is the Imax and will blow your fuse.
This solution must be only a primary side problem. I was thinking of a relay but a small triac is much faster.
Thanks
Cris