Work on your mental health first. Changing careers itself is stressful. Your code doesn't have to be pretty, you can use it as fuel for a hobby you actually enjoy doing after work/weekends. It could be photography, plastic model building, racing cars at track days, tennis, golf, etc.
The key there is also to join the communities to engage and learn, along with getting outside.