Skip to content

Commit

Permalink
update pedal cals again BRUH
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbrook committed Jun 9, 2024
1 parent 19a197e commit 4acf860
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions include/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ const float FINAL_DRIVE = FRONT_SPROCKET_TEETH/REAR_SPROCKET_TEETH;
#define MAX_BRAKE_PEDAL 3850

#define MIN_ACCELERATOR_PEDAL_1 50 // Low accelerator implausibility threshold
#define START_ACCELERATOR_PEDAL_1 1410 // Position to start acceleration
#define END_ACCELERATOR_PEDAL_1 3250 // Position to max out acceleration
#define START_ACCELERATOR_PEDAL_1 1277 // Position to start acceleration
#define END_ACCELERATOR_PEDAL_1 3560 // Position to max out acceleration
#define MAX_ACCELERATOR_PEDAL_1 4000 // High accelerator implausibility threshold

#define MIN_ACCELERATOR_PEDAL_2 80 // Low accelerator implausibility threshold
#define START_ACCELERATOR_PEDAL_2 970 // Position to start acceleration
#define END_ACCELERATOR_PEDAL_2 2170 // Position to max out acceleration
#define START_ACCELERATOR_PEDAL_2 880 // Position to start acceleration
#define END_ACCELERATOR_PEDAL_2 2620 // Position to max out acceleration
#define MAX_ACCELERATOR_PEDAL_2 3000 // High accelerator implausibility threshold

#define APPS_ALLOWABLE_TRAVEL_DEVIATION 75 // % (percentage) allowable deviation of APPS1 and APPS2 travel readings
#define APPS_ALLOWABLE_TRAVEL_DEVIATION 150 // % (percentage) allowable deviation of APPS1 and APPS2 travel readings

#define REGEN_NM 60
#define BSPD_OK_HIGH_THRESHOLD 500 // ADC reading when BSPD is Latched (OK state)
Expand Down
2 changes: 1 addition & 1 deletion src/inverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ bool Inverter::calc_and_send_current_limit(uint16_t pack_voltage, uint32_t disch
}
#endif
uint16_t charge_current_limit = min((charge_power_limit / pack_voltage), accumulator_max_charge_current);
if (timer_current_limit->check())
if (timer_current_limit->check() && (discharge_power_limit<80000))
{
#if DEBUG
Serial.printf("discharge current limit: %d charge current limit: %d\n", discharge_current_limit, charge_current_limit);
Expand Down
10 changes: 5 additions & 5 deletions src/pedal_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ void PedalHandler::print_cal_values()
a1 = accel1_>a1 ? accel1_:a1;
a2 = accel2_>a2 ? accel2_:a2;
b1 = brake1_>b1 ? brake1_:b1;
Serial.printf("maxes APPS1: %d APPS2: %d BSE1: %d\n",a1,a2,b1);
ma1 = accel1_<ma1 ? accel1_:ma1;
ma2 = accel2_<ma2 ? accel2_:ma2;
mb1 = brake1_<mb1 ? brake1_:mb1;
Serial.printf("mins APPS1: %d APPS2: %d BSE1: %d\n",ma1,ma2,mb1);
Serial.printf("maxes APPS1: %d APPS2: %d BSE1: %d\n",accel1_,accel2_,brake1_);
// ma1 = accel1_<ma1 ? accel1_:ma1;
// ma2 = accel2_<ma2 ? accel2_:ma2;
// mb1 = brake1_<mb1 ? brake1_:mb1;
// Serial.printf("mins APPS1: %d APPS2: %d BSE1: %d\n",ma1,ma2,mb1);
}
}
8 changes: 4 additions & 4 deletions src/state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void StateMachine::handle_state_machine(MCU_status &mcu_status)
static_cast<uint16_t>(distance_tracker_motor.capacity_ah * 100),
static_cast<uint16_t>(distance_tracker_vectornav.capacity_ah * 100)},
ID_VCU_COULOMB_COUNT);
if ((millis() - vectornav_data.last_update_time) <= 100)
if (false)
{
float vn_mock_ws = vectornav_data.mock_ws_rpm(); // Divide meters per second by circumference to get Revs per Second
wheelSpeedData = {vn_mock_ws, vn_mock_ws, pm100->getmcMotorRPM() * FINAL_DRIVE, pm100->getmcMotorRPM() * FINAL_DRIVE};
Expand Down Expand Up @@ -501,7 +501,7 @@ void StateMachine::handle_state_machine(MCU_status &mcu_status)
{
dash_->set_button_last_pressed_time(0, 6);
}
if (_20hz_send)
if (_100hz_send)
{
lc_countdown_t countdown_t;
countdown_t.release_countdown = dash_->get_button_last_pressed_time(6);
Expand All @@ -517,7 +517,7 @@ void StateMachine::handle_state_machine(MCU_status &mcu_status)
lcSystem->getController()->setState(launchState::FINISHED, millis());
break;
}
if ((millis() - vectornav_data.last_update_time) <= 100)
if (false)
{
float vn_mock_ws = vectornav_data.mock_ws_rpm(); // Divide meters per second by circumference to get Revs per Second
wheelSpeedData = {vn_mock_ws, vn_mock_ws, pm100->getmcMotorRPM() * FINAL_DRIVE, pm100->getmcMotorRPM() * FINAL_DRIVE};
Expand All @@ -543,7 +543,7 @@ void StateMachine::handle_state_machine(MCU_status &mcu_status)
}
}
}
if ((millis() - vectornav_data.last_update_time) <= 100)
if (false)
{
float vn_mock_ws = vectornav_data.mock_ws_rpm(); // Divide meters per second by circumference to get Revs per Second
wheelSpeedData = {vn_mock_ws, vn_mock_ws, pm100->getmcMotorRPM() * FINAL_DRIVE, pm100->getmcMotorRPM() * FINAL_DRIVE};
Expand Down

0 comments on commit 4acf860

Please sign in to comment.