When compiling my chassis factory code, I encounter this warning:
warning: narrowing conversion of ‘-(int)driveFR_port’ from ‘int’ to ‘int8_t {aka signed char}’
inside { } [-Wnarrowing]
{driveFL_port, driveBL_port}, {(-driveFR_port), (-driveBR_port)}
I have tried defining my port number as both an int and an int8_t. I need to leave them positive for other elements of my code, but my understanding is that okapilib wants reversed ports to be negative, so I am trying to negate them here. Any help is appreciated.
It’s most likely just a useless warning that you can safely ignore.
Just don’t do anything special, don’t manually cast, just use int.
Maybe show us your code, but its probably not an issue.
Here is the relevant coding segment:
const int driveFR_port = 1;
const int driveFL_port = 2;
const int driveBR_port = 3;
const int driveBL_port = 4;
const int tray_port = 5;
const int lift_port = 6;
const int intakeR_port = 7;
const int intakeL_port = 8;
auto driveController = ChassisControllerFactory::create(
{driveFL_port, driveBL_port}, {(-driveFR_port), (-driveBR_port)},
AbstractMotor::gearset::green,
{4_in, 10.5_in}
);
I may just let it be until okapilib 4 comes out; I will just have to deal with the madness of always having a warning 
Have you tried casting to int8_t
instead of int
here?
Yes, and it returns the same error for the negative numbers.
Edit: nevermind, this worked great, just messed up the casting