You probably have a connection going loose, or getting corroded. If yours is like my 28.5 was chances are you have a panel like the pix here. Check your connections at the back of the panel. If you cannot get at it from inside the boat, then unscrew the panel and pull it out gently. Wires should be long enough to allow you to do that. Do the other connections while there. After you have cleaned all connections behind the panel, go to the engine room and check them there. Yanmar tacks are running off a pick-up point set near the transmission. There is a plastic connector with pins inside. Split it open carefully and clean it. Then re-install, making sure you have good solid contact of both ends. If needed, tape it tightly. Doing that on both my former 28.5 and current 34 has saved the day and avoided buying an expensive new tack.
Good luck