Skip to content

Conversation

@Alejandro-Casanova
Copy link

@Alejandro-Casanova Alejandro-Casanova commented Jan 28, 2026

When trying to use the ArduinoLog library to print a MAC address, I used the following implementation:

   // Address stored in bd_addr is in little-endian, so should be printed 
   // backwards
   for (size_t i = 0; i < sizeof(bd_addr); i++)
   {
      size_t access_idx = sizeof(bd_addr) - 1 - i;
      if (addr.addr[access_idx] < 16)
      {
         Log.info('0');
      }
      Log.info("%x", addr.addr[access_idx]);
      if (i < sizeof(bd_addr) - 1)
      {
         Log.info(':');
      }
   }

Where the line Log.info('0'); yielded the following error:

In file included from *ommited*.cpp:12:
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h: In instantiation of 'void Logging::printLevel(int, bool, T, ...) [with T = char]':
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:270:14:   required from 'void Logging::info(T, Args ...) [with T = char; Args = {}]'
*ommited*.cpp:748:18:   required from here
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:366:22: error: no matching function for call to 'print(char&, va_list&)'
  366 |                 print(msg, args);
      |                 ~~~~~^~~~~~~~~~~
*ommited*s\Arduino\libraries\ArduinoLog/ArduinoLog.h:329:14: note: candidate: 'void Logging::print(const arduino::__FlashStringHelper*, va_list)' (near match)
  329 |         void print(const __FlashStringHelper *format, va_list args);
      |              ^~~~~
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:329:14: note:   conversion of argument 1 would be ill-formed: 
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:366:23: error: invalid conversion from 'char' to 'const arduino::__FlashStringHelper*' [-fpermissive]
  366 |                 print(msg, args);
      |                       ^~~
      |                       |
      |                       char
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:325:14: note: candidate: 'void Logging::print(const char*, va_list)' (near match)
  325 |         void print(const char *format, va_list args);
      |              ^~~~~
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:325:14: note:   conversion of argument 1 would be ill-formed: 
*ommited*\Arduino\libraries\ArduinoLog/ArduinoLog.h:366:23: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
  366 |                 print(msg, args);
      |                       ^~~
      |                       |
      |                       char

It seems the library was missing the overloaded version of print to accept a single character. This is what I implemented.

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.

1 participant