Skip to content

Add makefile#63

Open
mpictor wants to merge 2 commits intoTwilight-Logic:masterfrom
mpictor:add-makefile
Open

Add makefile#63
mpictor wants to merge 2 commits intoTwilight-Logic:masterfrom
mpictor:add-makefile

Conversation

@mpictor
Copy link
Copy Markdown

@mpictor mpictor commented May 27, 2025

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
Copy link
Copy Markdown
Author

mpictor commented May 27, 2025

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 mpictor mentioned this pull request May 28, 2025
@Twilight-Logic
Copy link
Copy Markdown
Owner

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.

@mpictor
Copy link
Copy Markdown
Author

mpictor commented May 30, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants