Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Lower ARK ramp speed #124

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Inc/targets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,8 @@
#define NFAULT_PORT GPIOB
#define NFAULT_PIN LL_GPIO_PIN_5
#define TARGET_MIN_BEMF_COUNTS 3
#define RAMP_SPEED_LOW_RPM 1
#define RAMP_SPEED_HIGH_RPM 8
#endif

#ifdef RHINO80A_F051
Expand Down
31 changes: 9 additions & 22 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,10 @@ float consumed_current = 0;
int32_t smoothed_raw_current = 0;
int16_t actual_current = 0;

char lowkv = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR includes changes to other code, I presume by accident. It is a good idea to review the changes files in your PRs :-)


uint16_t min_startup_duty = 120;
uint16_t sin_mode_min_s_d = 120;
char bemf_timeout = 10;

char startup_boost = 50;
char reversing_dead_band = 1;

uint16_t low_pin_count = 0;
Expand Down Expand Up @@ -629,9 +626,15 @@ void loadEEpromSettings()
}

if (eepromBuffer.startup_power < 151 && eepromBuffer.startup_power > 49) {
min_startup_duty = (eepromBuffer.startup_power);
minimum_duty_cycle = (eepromBuffer.startup_power / 3);
stall_protect_minimum_duty = minimum_duty_cycle + 10;
if (!eepromBuffer.comp_pwm) { // higher startup power for non-complementary pwm
min_startup_duty = (eepromBuffer.startup_power) *2 ;
minimum_duty_cycle = (eepromBuffer.startup_power / 2);
stall_protect_minimum_duty = minimum_duty_cycle + 10;
} else {
min_startup_duty = (eepromBuffer.startup_power);
minimum_duty_cycle = (eepromBuffer.startup_power / 3);
stall_protect_minimum_duty = minimum_duty_cycle + 10;
}
} else {
min_startup_duty = 150;
minimum_duty_cycle = (min_startup_duty / 2) + 10;
Expand Down Expand Up @@ -748,10 +751,6 @@ void loadEEpromSettings()
high_rpm_level = motor_kv / 12 / (32 / eepromBuffer.motor_poles);
}
reverse_speed_threshold = map(motor_kv, 300, 3000, 1000, 500);
// reverse_speed_threshold = 200;
// if (!eepromBuffer.comp_pwm) {
// eepromBuffer.bi_direction = 0;
// }
}

void saveEEpromSettings()
Expand Down Expand Up @@ -896,18 +895,6 @@ void interruptRoutine()
maskPhaseInterrupts();
thiszctime = INTERVAL_TIMER_COUNT;
SET_INTERVAL_TIMER_COUNT(0);
// if(thiszctime < (commutation_interval - (commutation_interval>>2))){
// send_LED_RGB(0, 0, 255);
// // waitTime = waitTime + commutation_interval - thiszctime;
// waitTime = waitTime + (commutation_interval>>2);
// // thiszctime = commutation_interval + (commutation_interval>>2);
// }else if(thiszctime > (commutation_interval + (commutation_interval>>2))){
// send_LED_RGB(255, 0, 0);
// // waitTime = waitTime - thiszctime - commutation_interval;
// waitTime = waitTime - (commutation_interval>>2);
// // thiszctime = commutation_interval - (commutation_interval>>2);
// }
// waitTime = waitTime >> fast_accel;
SET_AND_ENABLE_COM_INT(waitTime+1); // enable COM_TIMER interrupt
__enable_irq();
}
Expand Down
Loading