constuint16_tfailsafe_throttle_min_A=4900;//if adc value falls below this failsafe is triggered.
constuint16_tfailsafe_throttle_max_A=14500;//if adc value goes above this failsafe is triggered.
constuint16_tfailsafe_throttle_min_B=3900;//if adc value falls below this failsafe is triggered.
constuint16_tfailsafe_throttle_max_B=12500;//if adc value goes above this failsafe is triggered.
constuint16_tfailsafe_throttle_maxDiff=200;//maximum adc value difference between both sensors A and B. value range 0-1000. choose value at least 2x higher than maximum difference when moving throttle slowly
//const uint16_t throttleCurvePerMM[] = {414,460,490,511,527,539,548,555,561,567,573,578,584,590,599,611,630,657,697,754,789,795}; //adc values for every unit (mm) of linear travel
//const uint16_t throttleCurvePerMM[] = {8485,8904,9177,9368,9513,9623,9705,9768,9823,9877,9932,9978,10032,10087,10169,10278,10451,10697,11061,11579,11898,11952}; //adc values for every unit (mm) of linear travel. config used until 20230826
constuint16_tthrottleCurvePerMM_A[]={11800,11130,10300,9990,9650,9470,9370,9240,9130,9030,8950,8850,8700,8560,8350,8040,7750,7150,6520};//adc values for every unit (mm) of linear travel
constboolthrottleCurvePerMM_A_Descending=true;//set true if corresponding array is descending
constuint16_tthrottleCurvePerMM_B[]={6200,6700,7420,7710,8030,8200,8310,8440,8560,8640,8740,8840,8990,9130,9330,9630,9900,10440,10990};//adc values for every unit (mm) of linear travel
constboolthrottleCurvePerMM_B_Descending=false;//set true if corresponding array is descending
int16_tmax_acceleration_rate=NORMAL_MAX_ACCELERATION_RATE;//maximum cmd send increase per second
//Driving parameters
int16_tminimum_constant_cmd_reduce=1;//reduce cmd every loop by this constant amount when freewheeling/braking
int16_tbrake_cmdreduce_proportional=500;//cmd gets reduced by an amount proportional to brake position (ignores freewheeling). cmd_new-=brake_cmdreduce_proportional / second @ full brake. with BREAK_CMDREDUCE_CONSTANT=1000 car would stop with full brake at least after a second (ignoring influence of brake current control/freewheeling)
floatstartbrakecurrent=2;//Ampere. "targeted brake current @full brake". at what point to start apply brake proportional to brake_pos. for everything above that cmd is reduced by freewheel_break_factor
floatstartbrakecurrent_offset=0.13;//offset start point for breaking, because of reading fluctuations around 0A. set this slightly above idle current reading
#define CURRENT_FILTER_SIZE 60 //latency is about CURRENT_FILTER_SIZE/2*MEASURE_INTERVAL (measure interval is defined by hoverboard controller)
#define CURRENT_MEANVALUECOUNT 20 //0<= meanvaluecount < CURRENT_FILTER_SIZE/2. how many values will be used from sorted weight array from the center region. abour double this values reading are used