When I first got my M1 mac, optimized charging worked OK. Eventually it would settle at 80%. But since macOS 14.6-15.0, it's always charging to 100% and staying there no matter what.
Luckily, I gave 'battery toolkit' a try, and it has been working great:
Additionally, AlDente is even better than the native battery management.