AR488 icon indicating copy to clipboard operation
AR488 copied to clipboard

Add makefile

Open mpictor opened this issue 9 months ago • 3 comments

This adds a Makefile for use with ArduinoMakefile, as well as a simple script to find usb-serial devices.

AR488.ino is updated with forward declarations, which are required for ArduinoMakefile.

mpictor avatar May 27 '25 23:05 mpictor

Almost forgot - the compiler spits out some warnings that are probably worth investigating. For example,

AR488.ino: In function 'void id_h(char*)':
AR488.ino:2408:11: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
           if (isVerb) dataPort.print(F("VerStr: "));dataPort.println(gpibBus.cfg.vstr);
           ^~
AR488.ino:2408:53: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
           if (isVerb) dataPort.print(F("VerStr: "));dataPort.println(gpibBus.cfg.vstr);
                                                     ^~~~~~~~

<rant> One of the many things that drives me nuts about C/C++ is how easy it is to write code that doesn't work as expected and causes undefined behavior or goto fail or the like. </rant>

mpictor avatar May 27 '25 23:05 mpictor

Mark,

That's a good spot. I am going through a refactoring exercise at the moment - the .ino has got rather big for one thing - and found that same problem. Your note has reminded me to fix it in the current code, which I have now done. Not sure how it ended up like that, but it did need fixing. Thanks for pointing it out.

I will also have a look at the PR. Thanks.

Not really come across a code pretty-printer before but will have a look.

Twilight-Logic avatar May 28 '25 19:05 Twilight-Logic

The only pretty-printer I've fiddled with much is astyle. A config like this tells it to produce compact formatting. The docs show the results of many (all?) style options, including java, k&r, etc).

It's been a decade since I last used astyle; I believe clang-format wasn't an option back then, and there are probably others as well.

mpictor avatar May 30 '25 05:05 mpictor