Arduino, understanding invalid conversion warning, unsigned char to char*

817 views Asked by At

Edit:

Resolved, can't accept my answer for two days


I'm using PlatformIO to program a Arduino Nano to write a message to an OLED display.

I'm calling a function printWeight:

void printWeight(
        float weight,
        uint8_t scale=3,
        uint8_t numbd=3,
        uint8_t numad=2,
        bool kg=false,
        const char* description_text_line="Weight:",
        uint8_t width_per_character=5+1,
        uint8_t height_per_line=7+3
        ){
    ...

The function is centering the text by calculating the leading space leading_space and calls itself with a smaller scale (scale-1) if the message doesn't fit on the screen:

if(leading_space < 0){
        printWeight(weight, scale-1, numbd, numad, description_text_line,
                width_per_character, height_per_line);
        return;
    }

The code compiles and runs fine. However I'm getting the following warning that I don't know how to resolve:

src/main.cpp: In function 'void printWeight(float, uint8_t, uint8_t, uint8_t, bool, const char*, uint8_t, uint8_t)':
src/main.cpp:138:53: warning: invalid conversion from 'uint8_t {aka unsigned char}' to 'const char*' [-fpermissive]
                 width_per_character, height_per_line);
                                                     ^
src/main.cpp:93:6: note:   initializing argument 6 of 'void printWeight(float, uint8_t, uint8_t, uint8_t, bool, const char*, uint8_t, uint8_t)'
 void printWeight(
      ^

How do I get rid of this warning?

1

There are 1 answers

0
id -un On BEST ANSWER

Missing parameter... Thanks to the ones commenting.