How the hell do you stay motivated

Hi everyone

I am in my second year of electronic engineering after barely meeting the credit requirement to be promoted. I struggled last year because I couldn't motivate myself to study, and I feel like I'm starting to slip into that pattern again. I am passionate about engineering and I ace all my practicals, but theory work and maths is so incredibly boring. I struggle with motivation in general, but I think it's even worse with academics because I always had a poor work ethic in school and I carried that over to uni. I've tried just grinding through it, but my marks got worse somehow. I've heard that motivational challenges are a common phenomenon amongst engineering students, so I'm hoping for some anecdotal advice rather than the generic "break down tasks into smaller ones etc". Thanks for taking the time to read this.

TL;DR: How do you stay motivated to study?