This devlog took longer than usual (I’ll try to make sure this doesn’t become the norm, even though the last one was already delayed), but at least it had a reason; this was the most technically demanding part of the project so far, especially because of the multimeter.
I made several corrections and refinements, such as the multimeter probes, which previously looked rather unsightly floating and disconnected from the multimeter, but now have a visual wire that always connects them to the instrument body, even when it’s moved across the screen. I also added the ability to invert/mirror components with polarity, LEDs, and batteries; by pressing F while the component is selected, the component flips. This is useful for assembling circuits in a more natural and organized way, without being stuck with a single orientation (and it was annoying me having to have one cable crossing over another). I thought I would do this quickly and easily, but after some attempts, I still had a subtle bug: the electrical logic continued to assume the same orientation, ignoring the visual inversion. That is, even if, after inverting, the + appeared as -, the code still assumed that the polarities were in their original place and therefore did not correspond (I hope that makes sense). So, I had to correct it so that the pins were physically fixed and the… The logic “asking” if the component is reversed, instead of trying to move the pins.
Now, the part that took the longest and also the last thing I did in the code, a multimeter with two modes. The multimeter was very “basic” and I wasn’t liking it very much, so I changed its appearance and decided to change its behavior as well. Now the multimeter has V mode (voltage, measured between two points without interfering with the circuit) and A mode (current, alternating with the M key). The A mode was the biggest challenge, since the two probes could now be part of the electrical circuit itself, that is, I cut a wire, connect each end to one side of the cut, and the multimeter measures the current that passes exactly there, just like a real ammeter. This forced me to rewrite the algorithm that traverses the circuit to know how to “pass through” the multimeter when it is in A mode, but ignore it (not interfere) when it is in V mode.
This involved a lot of experimentation and some positioning bugs along the way. (The probes were placed in the wrong spot, inheriting the position of the palette instead of the position where they were dropped), but now everything is working as you would expect from a real multimeter.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.