To circumvent the double compile problem (I have experienced it as well), use a different name for each version. You should do this anyways, but just tag it with a version number and it will update correctly.
One solution to the other problem is to use a parabolic system, demonstrated by the code below.
Code:
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
void initializeRobot()
{
return;
}
void scaleMotor(char motorname, int joyVal)
{
int sign = joyVal / abs(joyVal); //Returns a 1 or -1
float ratio = ((joyVal * joyVal) / (16129)); //Gets a ratio from a parabolic curve
int scaledVal = (sign * 100) * ratio;
motor[motorname] = scaledVal;
}
task main()
{
initializeRobot();
waitForStart(); // wait for start of tele-op phase
while (true)
{
getJoystickSettings(joystick);
scaleMotor(DriveL, joystick.joy1_y1);
scaleMotor(DriveR, joystick.joy1_y2);
}
}
You add if statements to that to limit when it will scale the motors, I.E. below 75%.