-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I keep getting this warning and do not know how to fix it. I don't believe it is due to anything I may have done as I reused the code as-is.
In file included from src/main.cpp:107:
src/ld2410_uart.h: In member function 'void LD2410::setConfigMode(bool)':
src/ld2410_uart.h:217:27: warning: narrowing conversion of '(enable ? 255 : 254)' from 'int' to 'char' inside { } [-Wnarrowing]
char cmd[2] = {enable ? 0xFF : 0xFE, 0x00};
~~~~~~~^~~~~~~~~~~~~
src/ld2410_uart.h: In member function 'void LD2410::setEngineeringMode(bool)':
src/ld2410_uart.h:245:27: warning: narrowing conversion of '(enable ? 98 : 99)' from 'int' to 'char' inside { } [-Wnarrowing]
char cmd[2] = {enable ? 0x62 : 0x63, 0x00};
~~~~~~~^~~~~~~~~~~~~
In file included from src/main.cpp:107:
src/ld2410_uart.h: In member function 'void LD2410::setBaudrate(int)':
src/ld2410_uart.h:273:33: warning: narrowing conversion of 'index' from 'int' to 'char' inside { } [-Wnarrowing]
char value[2] = {index, 0x00};
^
The warning above happens when leaving the framework to the default arduino. Since the code appears to crash my ESP32, I tried IDF and it is now causing the compiler to fail:
In file included from src/main.cpp:93:
src/ld2410_uart.h: In member function 'void LD2410::sendCommand(char*, char*, int)':
src/ld2410_uart.h:46:16: error: 'lowByte' was not declared in this scope
write_byte(lowByte(len));
^~~~~~~
src/ld2410_uart.h:47:16: error: 'highByte' was not declared in this scope
write_byte(highByte(len));
^~~~~~~~
src/ld2410_uart.h: In member function 'void LD2410::setConfigMode(bool)':
src/ld2410_uart.h:217:27: error: narrowing conversion of '(enable ? 255 : 254)' from 'int' to 'char' inside { } [-Werror=narrowing]
char cmd[2] = {enable ? 0xFF : 0xFE, 0x00};
~~~~~~~^~~~~~~~~~~~~
src/ld2410_uart.h: In member function 'void LD2410::setEngineeringMode(bool)':
src/ld2410_uart.h:245:27: error: narrowing conversion of '(enable ? 98 : 99)' from 'int' to 'char' inside { } [-Werror=narrowing]
char cmd[2] = {enable ? 0x62 : 0x63, 0x00};
~~~~~~~^~~~~~~~~~~~~
src/ld2410_uart.h: In member function 'void LD2410::setMaxDistancesAndNoneDuration(int, int, int)':
src/ld2410_uart.h:252:35: error: 'lowByte' was not declared in this scope
char value[18] = {0x00, 0x00, lowByte(maxMovingDistanceRange), highByte(maxMovingDistanceRange), 0x00, 0x00, 0x01, 0x00, lowByte(maxStillDistanceRange), highByte(maxStillDistanceRange), 0x00, 0x00, 0x02, 0x00, lowByte(noneDuration), highByte(noneDuration), 0x00, 0x00};
^~~~~~~
src/ld2410_uart.h:252:68: error: 'highByte' was not declared in this scope
char value[18] = {0x00, 0x00, lowByte(maxMovingDistanceRange), highByte(maxMovingDistanceRange), 0x00, 0x00, 0x01, 0x00, lowByte(maxStillDistanceRange), highByte(maxStillDistanceRange), 0x00, 0x00, 0x02, 0x00, lowByte(noneDuration), highByte(noneDuration), 0x00, 0x00};
^~~~~~~~
In file included from src/main.cpp:93:
src/ld2410_uart.h: In member function 'void LD2410::setBaudrate(int)':
src/ld2410_uart.h:273:33: error: narrowing conversion of 'index' from 'int' to 'char' inside { } [-Werror=narrowing]
char value[2] = {index, 0x00};
^
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels