Retrowatch, i got some errors

I got this error im using this file retrowatch/RetroWatch_Arduino/RetroWatchArduino_u8glib_no_button at master · godstale/retrowatch · GitHub

narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]

The error message told you exactly where the problem is, but you didn't share that.

A char can be negative, so just cast the -1 to char.

how can i do that?
#define TIME_BUFFER_MAX 6
char timeParsingIndex = 0;
char timeBuffer[6] = {- 1, -1, -1, -1, -1, -1};
PROGMEM const char* weekString[] = {"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
PROGMEM const char* ampmString[] = {"AM", "PM"};
///////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////

Just copy the error message, and post it here in code tags.

RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
char timeBuffer[6] = {-1, -1, -1, -1, -1, -1};
^
RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
RetroWatchArduino_u8glib_no_button:122:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]

I use esp32 btw

char timeBuffer[6] = {(char)-1, (char)-1, (char)-1, (char)-1, (char)-1, (char)-1};

(No guarantees)

char is unsigned on ESP8266. Use signed char or int8_t.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.