Denk proof backup #4
This commit is contained in:
parent
b065369fac
commit
f26155ba17
16
app.cpp
16
app.cpp
@ -105,8 +105,8 @@ bool run_short_side(ev3cxx::MotorTank motors, MPWRS idealMPWRS, ev3cxx::GyroSens
|
|||||||
{
|
{
|
||||||
const int LEFT_THRESHOLD = -2;
|
const int LEFT_THRESHOLD = -2;
|
||||||
const int RIGHT_THRESHOLD = 2;
|
const int RIGHT_THRESHOLD = 2;
|
||||||
const int CORRECTION_MULTIPLIER = 2;
|
const int CORRECTION_MULTIPLIER = 20;
|
||||||
const int CYCLE_LIMIT = 95;
|
const int CYCLE_LIMIT = 90;
|
||||||
|
|
||||||
gyro.resetHard();
|
gyro.resetHard();
|
||||||
ev3cxx::BrickButton btnEnter(ev3cxx::BrickButtons::ENTER); // Middle button
|
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) {
|
if (angle < LEFT_THRESHOLD) {
|
||||||
//ev3_speaker_play_tone(NOTE_A5, 250);
|
//ev3_speaker_play_tone(NOTE_A5, 250);
|
||||||
int correction = angle - LEFT_THRESHOLD;
|
int correction = angle - LEFT_THRESHOLD;
|
||||||
motor_powers.lMotorPWR += correction * CORRECTION_MULTIPLIER;//(int)pow(CORRECTION_MULTIPLIER, correction);
|
motor_powers.lMotorPWR = motor_powers.lMotorPWR + ((int)pow(CORRECTION_MULTIPLIER, correction));//(int)pow(CORRECTION_MULTIPLIER, correction);
|
||||||
ev3_speaker_play_tone(correction*1000,50);
|
ev3_speaker_play_tone(correction*1000,30);
|
||||||
// Check if the motor is stuck
|
// Check if the motor is stuck
|
||||||
if(lPower == 0){
|
if(lPower == 0){
|
||||||
|
ev3cxx::statusLight.setColor(ev3cxx::StatusLightColor::RED);
|
||||||
ev3_speaker_play_tone(NOTE_A5,250);
|
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) {
|
} else if (angle > RIGHT_THRESHOLD) {
|
||||||
//ev3_speaker_play_tone(NOTE_A4, 250);
|
//ev3_speaker_play_tone(NOTE_A4, 250);
|
||||||
int correction = angle - RIGHT_THRESHOLD;
|
int correction = angle - RIGHT_THRESHOLD;
|
||||||
motor_powers.rMotorPWR += correction * CORRECTION_MULTIPLIER;//(int)pow(CORRECTION_MULTIPLIER, correction);//correction * CORRECTION_MULTIPLIER;
|
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,50);
|
ev3_speaker_play_tone(correction*1000,30);
|
||||||
// Check if the motor is stuck
|
// Check if the motor is stuck
|
||||||
if(rPower == 0){
|
if(rPower == 0){
|
||||||
|
ev3cxx::statusLight.setColor(ev3cxx::StatusLightColor::ORANGE);
|
||||||
ev3_speaker_play_tone(NOTE_A4,250);
|
ev3_speaker_play_tone(NOTE_A4,250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +183,7 @@ void main_task(intptr_t unused)
|
|||||||
|
|
||||||
// Create version info
|
// 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)
|
// 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
|
// Set-up screen
|
||||||
ev3cxx::display.resetScreen();
|
ev3cxx::display.resetScreen();
|
||||||
|
Reference in New Issue
Block a user