Skip to content

Commit

Permalink
bugfix in reverse function
Browse files Browse the repository at this point in the history
  • Loading branch information
stancecoke committed Nov 10, 2024
1 parent ac14915 commit d6f7c9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
#define FRAC_HIGH 30
#define FRAC_LOW 15
#define TS_COEF 1200 //12 for Kclamber Sensor
#define RIDEMODE RIDEMODE_BB_TORQUESENSOR
#define RIDEMODE RIDEMODE_PAS
//#define TQONAD1

//------------------------------Throttle settings
#define THROTTLE_OFFSET 900
#define THROTTLE_MAX 2600
//#define THROTTLE_OVERRIDE
#define THROTTLE_OVERRIDE

//-------------------------------Speed settings
#define WHEEL_CIRCUMFERENCE 2200
Expand All @@ -84,7 +84,7 @@
#define PULSES_PER_REVOLUTION 1
#define REVERSE -1
#define SPEEDFILTER 1
#define SPEEDSOURCE EXTERNAL
#define SPEEDSOURCE INTERNAL



Expand All @@ -96,7 +96,7 @@
#define REGEN_CURRENT 0
#define REGEN_CURRENT_MAX 10000
#define PUSHASSIST_CURRENT 30
#define VOLTAGE_MIN 1
#define VOLTAGE_MIN 1200

//----------------------------- Display setting

Expand Down
13 changes: 7 additions & 6 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,8 @@ void kingmeter_update(void)
{
ui8_Push_Assist_flag=0;
}
i8_direction = KM.Settings.Reverse;
if( KM.Settings.Reverse)i8_direction = -1;
else i8_direction = 1;
// MP.speedLimit=KM.Rx.SPEEDMAX_Limit;
// MP.battery_current_max = KM.Rx.CUR_Limit_mA;

Expand Down Expand Up @@ -2174,11 +2175,11 @@ void autodetect() {
for (i = 0; i < 1080; i++) {
q31_rotorposition_absolute += 11930465; //drive motor in open loop with steps of 1 deg
HAL_Delay(5);
printf_("%d, %d, %d, %d\n",
switchtime[0],
switchtime[1],
i16_ph1_current,
i16_ph2_current);
// printf_("%d, %d, %d, %d\n",
// switchtime[0],
// switchtime[1],
// i16_ph1_current,
// i16_ph2_current);

if (ui8_hall_state_old != ui8_hall_state) {
printf_("angle: %d, hallstate: %d, hallcase %d \n",
Expand Down

0 comments on commit d6f7c9e

Please sign in to comment.