generated from TDD-Templates/cmake_cpputest_template_avr
Added the code to allow 0%-100% speed.
This commit is contained in:
parent
71ff471fde
commit
bf39006dea
|
@ -132,7 +132,8 @@ uint8_t MotorGetSavedPos(void) {
|
|||
|
||||
void MotorMoveTo(uint8_t target) {
|
||||
|
||||
double speed_delay = ReadFader();
|
||||
uint8_t on_delay = ReadFader();
|
||||
uint8_t off_delay = 255 - on_delay;
|
||||
uint8_t pos = (uint8_t)(ReadFader() >> 2);
|
||||
|
||||
while (diff(target, pos) > 8) {
|
||||
|
@ -144,9 +145,9 @@ void MotorMoveTo(uint8_t target) {
|
|||
}
|
||||
|
||||
// The delay ratio controlls the PWM waveforms.
|
||||
//_delay_ms(5);
|
||||
// MotorCoast();
|
||||
// _delay_ms(5);
|
||||
_delay_ms((double) on_delay);
|
||||
MotorCoast();
|
||||
_delay_ms((double) off_delay);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue