@@ -37,6 +37,7 @@ typedef enum {
3737static uint8_t drive_lock_map = 0 ;
3838
3939static _Atomic bool brake_pressed = false;
40+ static _Atomic bool accel_pressed = false;
4041static _Atomic bool launch_control_enabled = false;
4142static float torque_limit_percentage = 1.0f ;
4243
@@ -71,15 +72,15 @@ static pedal_data_t pedal_data = { 0 };
7172
7273/* Pedal Tuning */
7374#define MAX_APPS1_VOLTS 3.50 // (Volts). Upper bound on APPS1 voltage range.
74- #define MIN_APPS1_VOLTS 2.00 // (Volts). Lower bound on APPS1 voltage range.
75+ #define MIN_APPS1_VOLTS 2.15 // (Volts). Lower bound on APPS1 voltage range.
7576#define MAX_APPS2_VOLTS 2.50 // (Volts). Upper bound on APPS2 voltage range.
76- #define MIN_APPS2_VOLTS 1.00 // (Volts). Lower bound on APPS2 voltage range.
77- #define PEDAL_BRAKE_THRESH 0.20 // (Percantage). Pedal position above which the system registers the brake pedal as "pressed".
78- #define PEDAL_HARD_BRAKE_THRESH 0.50 // (Percentage). Pedal position above which a "hard brake" is detected.
77+ #define MIN_APPS2_VOLTS 1.15 // (Volts). Lower bound on APPS2 voltage range.
78+ #define PEDAL_BRAKE_THRESH 0.15 // (Percantage). Pedal position above which the system registers the brake pedal as "pressed".
79+ #define PEDAL_HARD_BRAKE_THRESH 0.22 // (Percentage). Pedal position above which a "hard brake" is detected.
7980
8081/* Performance Limits */
8182#define PIT_MAX_SPEED 5.0 // (mph). Speed limit in pit mode.
82- #define MAX_TORQUE 220 // (Nm). Maximum torque output
83+ #define MAX_TORQUE 40 // (Nm). Maximum torque output
8384#define TORQUE_ACCUMULATOR_SIZE 10 // (Number). Size of the moving average filter for torque stuff.
8485#define MAX_REGEN_CURRENT 250 // (AC Amps). Maximum regenerative braking current.
8586
@@ -539,9 +540,11 @@ int pedals_init(void) {
539540/* Returns the brake state (true=brake pressed, false=brake not pressed). */
540541bool pedals_getBrakeState (void ) {
541542 return brake_pressed ;
543+ }
542544
543- /* TEMPORARY OVERRIDE FOR TSMS! should be commented out normally! */
544- //return true;
545+ /* Returns the accel state (true=accel pressed, false= accel not pressed)*/
546+ bool pedals_getAccelState (void ) {
547+ return accel_pressed ;
545548}
546549
547550/* Returns the torque limit percentgae. */
@@ -693,6 +696,12 @@ void pedals_process(void) {
693696 }
694697 }
695698
699+ if (pedal_data .percentage_accel >= 0.05 ) {
700+ accel_pressed = true;
701+ } else {
702+ accel_pressed = false;
703+ }
704+
696705 uint16_t dc_current = dti_get_dc_current ();
697706 float mph = dti_get_mph ();
698707
0 commit comments