Skip to content

Commit

Permalink
Start motor only when PWM value > 0. Use more power on startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
torfbolt committed Mar 30, 2010
1 parent fca528e commit 68e4dcc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ volatile uint16_t bldc_cnt_comm = 0;
uint8_t bldc_pwm = 0;
uint8_t bldc_pwm_max = PWM_MAX;
uint8_t bldc_running = 0;
uint8_t bldc_do_start = 1;
uint8_t bldc_do_start = 0;
uint16_t bldc_stop_detect_timer;
uint8_t bldc_old_phase = 7;

Expand Down Expand Up @@ -162,7 +162,7 @@ void bldc_run(){
}

if(bldc_old_phase != bldc_phase){
bldc_stop_detect_timer = timer_new_sw(270);
bldc_stop_detect_timer = timer_new_sw(500);
bldc_running = 1;
bldc_old_phase = bldc_phase;
}
Expand All @@ -171,7 +171,7 @@ void bldc_run(){
LED_RED_ON();
DISABLE_BEMF_INT();
bldc_running = 0;
bldc_do_start = 1;
bldc_do_start = (bldc_pwm != 0);
SET_ALL_OFF();
}

Expand Down
4 changes: 2 additions & 2 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#define SPEED_DEMO 0 /* Run a speed ramp demo */

#define PWM_START 20 /* PWM to use for starting the motor */
#define PWM_MIN 30 /* Minimum pwm so that the motor runs */
#define PWM_START 40 /* PWM to use for starting the motor */
#define PWM_MIN 40 /* Minimum pwm so that the motor runs */
#define PWM_MAX 255 /* Maximal allowed pwm value (unsigned char) */

#define BEMF_DEBOUNCE_COUNT 15 /* How many cycles to debounce the bemf signal */
Expand Down

0 comments on commit 68e4dcc

Please sign in to comment.