Refactoring is HARD!

Writing code isn’t always as easy as you want it to be. During the time since my last update about the soldering pen FW I’ve been trying to figure out how to do it best. I really miss the debug feature with a ‘real’ MCU. using the Arduino IDE is easy and fast but it has some serious drawbacks – debugging in place being one of the really big ones! I know that the simplicity comes at a cost and I really miss working on a full-fledged IDE that uses a big-ass programmer with hardware breakpoints and all the bells and whistles.

So what Have I done so far?

I’ve started splitting the project into seperate files. LED functions in LED.c (and LED.h) and so on. Luckily the IDe allows for multiple files. I stille remember the days when it didn’t. Code was even more cluttered back then and that was also one of my big issues with the Arduino environment as a whole.
Anyway I’ve been working on getting the code split-up so I can rework the whole logic. the functions are all there but they can be better in terms of readability. I haven’t had that much time to sit down and focus on that coding so bear with me. Suffice it to say that I hope to make the code more stable, more logicliy placed and thus simpler to read.

The important thing when splitting into multiple files is that the usual C header file basics still apply. Include the .h files that you need in order to scope functions and variables accordingly.
What really surprised me was that you don’t automatically get the Arduino built-in functions with you. You need to specifically include “Arduino.h”. At least I would have thought it to be an inline library which would be <Arduino.h>  but that doesn’t seem to work properly. Besides that little curiosity I am good to go on the multiple-files project.

Stay tuned! we’re getting there (slowly)

4 Comments:

  1. Good to see you have picked up your pace on developing this cool tool! Have you looked into the PlatformIO IDE? It is compatible with Arduino as well and might provide a bit more of a professional feel.

    • Yeah, I’m happy that I have the project back on my table and visible again.
      I haven’t seen PlatformIO before it looks really nice! I had a brief encounter with VScode but I found it really confusing and never made a single project in the IDE.
      The PlatformIO syntax highlighting really looks nice! Maybe I should give that a go! Thanks 😀

  2. Thomas Apczynski

    Are you selling any of these solder pens?

    • Hi Thomas, thanks for writing me!
      I plan to I really do! but I must have the code in working order before I will ship anything out. I know it’s been quite some time since my last post but real life seems to get in the way of my projects right now. I can assure you that I’m still working on it!

Leave a Reply