Go Down

Topic: Another contribution that folks might find convenient. (Read 283 times) previous topic - next topic

boylesg

There is a debug class that makes debugging a little more convenient.
And a timer class for recurrent events over tens of seconds, minutes and hours - you have to call the function poll() inside the loop function.

manor_royal

If I was good enough at C to have the foggiest idea how to use that Debug, I would have been able to write it myself ;)

I'm sure it's very good, but how does one use it?

If this was a Civil Engineering forum would there be posts like "I need to build a bridge. Someone send me drawings."

boylesg

If I was good enough at C to have the foggiest idea how to use that Debug, I would have been able to write it myself ;)

I'm sure it's very good, but how does one use it?


When I get around to it i will do these properly on Github but for now....

void dump(const __FlashStringHelper* strVarName, const uint32_t nVal, const bool bNewLine = true);

debug.dump(F("XXXXXnI"), nI); outputs "XXXXXnI = 1"

If you do this:

debug.dump(F("XXXXXnI"), nI, false);
dump(F(", XXXXXnJ", nJ)

Then you get this "XXXXXnI = 1, XXXXXnJ = 1".

debug.log(F("XXXX", false) is shortcut for Serial.print(F("XXXXX"));
debug.log(F("XXXX") is shortcut for Serial.println(F("XXXXX"));

I suppose you could shorten 'debug' to 'dbg' or something.

void logRuntimeError(const char* strFileName, const int16_t nLineNum) allows you to do this:
logRuntimeError(F("filename.ext"), __LINE__ ); which will output "RUNTIME ERROR: filename.ext, line 35"

Again you could shorten that function name but I have not bothered.

boylesg

The idea is to save me from having to type all of this sort of thing:

Code: [Select]
      Serial.print(F("RUNTIME ERROR: "));
      Serial.print(strFileName);
      Serial.print(F(" line number "));
      Serial.println(nLineNum); 

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy