Arduino,理解无效转换警告,unsigned char 到 char*

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

编辑:

已解决,这两天不能接受我的回答


我正在使用 PlatformIO 对 Arduino Nano 进行编程以将消息写入 OLED 显示器。

我正在调用函数 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
        ){
    ...

该函数通过计算前导 space leading_space 使文本居中,如果消息不适合屏幕,则以较小的比例 (scale-1) 调用自身:

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

代码编译并运行良好。但是我收到以下警告,我不知道如何解决:

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(
      ^

如何摆脱这个警告?

缺少参数... 感谢评论的人。