JoaoLopesF / SerialDebugConverter

Converter for SerialDebug. Convert standard Serial.prints to SerialDebug library
MIT License
13 stars 2 forks source link

Serial.print and Serial.println with two arguments: Not handled/not replaced #1

Open wjwieland opened 5 years ago

wjwieland commented 5 years ago

When a Serial.print or Serial.println contain a second argument, the second argument is not handled by SerialDebugConverter. For example, this original line of code: Serial.print(address,HEX); Was changed to: printD(address,HEX); by SerialDebugConverter.

However, this leads to a compile error due to PrintD not handling the second argument. The Converter (in my opinion) should avoid leaving code in this state if at all possible. The two possible solutions I would offer would be to:

I prefer the first option as you are putting the new code in it's own directory anyway, making it easy to revert if one wants to and leaving the whole thing very transparent to the user of the tool.

The second option is not at all transparent, and now that I think about it, probably not a good idea... will leave it there anyway...

Great tool, by the way! And SerialDebug looks good too, though I have yet to really dig into it.

Thank You wjw

JoaoLopesF commented 5 years ago

Hi, @wjwieland

How about third option -> I will implement it in library the 2 arg (optional)

So your code will show debug in hexa.

It can be ?

I glad that you like this. Yes, I worked very hard to make this.

wjwieland commented 5 years ago

I think that third option would be excellent! Handling it that way is better than either of the options I offered up.
Thank you for taking the time to develop this. Both the Converter and the debug library are excellent tools. I like the implementation. It reminds me of some of the tools I am used to using when programming in Perl.

Also, thank you for the quick response!

JoaoLopesF commented 5 years ago

Hi, @wjwieland

Please download lastest version. Now print macros support second arg. e.g. printlnA(10, HEX);

Thanks for your colaboration.

Regards

Joao

wjwieland commented 5 years ago

Well done! Your solution to the two argument println and print statements seems to have been fully implemented.

I updated the library in my arduino as well as the Converter and all seems to now work as expected.

Thank you again for your work on these tools and certainly for your fast response! I consider this issue closed at this time.