diff --git a/app b/app index efe3816..756a27a 100644 Binary files a/app and b/app differ diff --git a/app.cpp b/app.cpp index 89e238b..69aeaae 100644 --- a/app.cpp +++ b/app.cpp @@ -105,8 +105,8 @@ bool run_short_side(ev3cxx::MotorTank motors, MPWRS idealMPWRS, ev3cxx::GyroSens { const int LEFT_THRESHOLD = -2; const int RIGHT_THRESHOLD = 2; - const int CORRECTION_MULTIPLIER = 2; - const int CYCLE_LIMIT = 95; + const int CORRECTION_MULTIPLIER = 20; + const int CYCLE_LIMIT = 90; gyro.resetHard(); ev3cxx::BrickButton btnEnter(ev3cxx::BrickButtons::ENTER); // Middle button @@ -147,10 +147,11 @@ bool run_short_side(ev3cxx::MotorTank motors, MPWRS idealMPWRS, ev3cxx::GyroSens if (angle < LEFT_THRESHOLD) { //ev3_speaker_play_tone(NOTE_A5, 250); int correction = angle - LEFT_THRESHOLD; - motor_powers.lMotorPWR += correction * CORRECTION_MULTIPLIER;//(int)pow(CORRECTION_MULTIPLIER, correction); - ev3_speaker_play_tone(correction*1000,50); + motor_powers.lMotorPWR = motor_powers.lMotorPWR + ((int)pow(CORRECTION_MULTIPLIER, correction));//(int)pow(CORRECTION_MULTIPLIER, correction); + ev3_speaker_play_tone(correction*1000,30); // Check if the motor is stuck if(lPower == 0){ + ev3cxx::statusLight.setColor(ev3cxx::StatusLightColor::RED); ev3_speaker_play_tone(NOTE_A5,250); } @@ -158,10 +159,11 @@ bool run_short_side(ev3cxx::MotorTank motors, MPWRS idealMPWRS, ev3cxx::GyroSens } else if (angle > RIGHT_THRESHOLD) { //ev3_speaker_play_tone(NOTE_A4, 250); int correction = angle - RIGHT_THRESHOLD; - motor_powers.rMotorPWR += correction * CORRECTION_MULTIPLIER;//(int)pow(CORRECTION_MULTIPLIER, correction);//correction * CORRECTION_MULTIPLIER; - ev3_speaker_play_tone(correction*1000,50); + motor_powers.rMotorPWR = motor_powers.rMotorPWR + ((int)pow(CORRECTION_MULTIPLIER, correction));//(int)pow(CORRECTION_MULTIPLIER, correction);//correction * CORRECTION_MULTIPLIER; + ev3_speaker_play_tone(correction*1000,30); // Check if the motor is stuck if(rPower == 0){ + ev3cxx::statusLight.setColor(ev3cxx::StatusLightColor::ORANGE); ev3_speaker_play_tone(NOTE_A4,250); } } @@ -181,7 +183,7 @@ void main_task(intptr_t unused) // Create version info // version createVersion(int versionID, const char *codename, int major, int minor, int patch, int day, int month, int year, int hour, int minute) - const version VERSION = createVersion(54, "HELGA", 0, 4, 1, 10, 11, 2023, 12, 10); + const version VERSION = createVersion(58, "HELGA", 0, 4, 1, 10, 11, 2023, 12, 10); // Set-up screen ev3cxx::display.resetScreen();