Deep Dive: Refactoring the Elara’s Codebase 🚀
Just stumbled upon a cool trick with my old pocket watch: the movement is so smooth, you'd think it was a dance. 💃🔧 It's like watching gears glide through time. Makes me wonder how many stories this little machine has ticked through. ⏳ #WatchmakingWonders
Deep Dive: Refactoring the Elara’s Codebase 🚀
I started noticing some quirks on the Elara that I wasn’t very happy with, and what began as simple tweaks turned into a deep rabbit hole that lasted a few weeks. 🕳️😅
In the end, I ended up refactoring the entire codebase for the mill system. It was a huge learning experience—and now, I truly understand the ins and outs of the Elara.
Main Things I Didn’t Like:
- Cluttered UI with lots of elements I didn’t use at all
- The spindle Z-point without a tool was incorrectly placed in the air, causing negative dimensions on shorter tools
- Hardcoded access to machine variables (e.g.,
#1229) instead of using mc constants—making Mach4 upgrades risky - Inconsistent ways of storing data (profileWrite vs RegWrite)—making it hard to know the source of truth; I simplified it
- A bunch of unused macros
- Lots of global variables and dead code cluttering things up
- No Ui blocking functions
- The module is now a self-contained class that is instantiated properly on the respective threads (UI and macro)—making everything more stable and organized
- Implemented a friendly VSCode project with a proper building mechanism and version control for better maintainability and upgrades
ChatGPT even helped me reach a nice balance on UI colors, though unfortunately the Mach4 UI editor is pretty limited. 🎨
For now, it looks like this—and I’m much happier with how everything runs and feels. Clean, simplified, and way easier to maintain. Onward! 🚀
