I recently went through a nasty divorce with custody battle. Here is my suggestions for coming out on top. Get rid of all plants and weed and stop smoking and clean everything up. Either stash the equipment somewhere or grow some vegetables with it. Get a lawyer ASAP. Keep a log of everything, and I mean everything that makes you look good and her look bad. Strengthen your relationship with your children and seek counseling for them.
I know everyone is saying he will be fine but to be honest he may not be when it comes to kids. All it takes is DHS or child services to be called and do an investigation. I had DHS actually visit my home and want to see my space where I was growing. I had tomato and pepper plants going because I anticipated that would happen and the wife that said I was illegally growing had no idea I had vegetable plants. I cooperated with DHS and every authority and she didn't. I stopped doing everything, drinking, smoking weed, pills, shrooms all of it and cleaned my system. I got called to take piss tests and nail bed tests. it was a long lengthy process but about $80,000 later I am divorced and fought and won sole physical and legal custody of my daughter.
So I wouldn't be really listening to everyone on rollitup.org that says you will be fine. unless you are fine with possibly getting supervised visitation.
ETA: also don't argue, yell, scream, cuss or send any messages that can make you look like a bad person and her a victim. stay off social media. Close joint accounts but don't leave her high and dry to what she's entitled to. Take computers and devices or anything with pictures or information and stash them at a relative or friends house, and also anything else of value. Don't move out of house, don't give up your kids.