Added the code to allow 0%-100% speed.

This commit is contained in:
jakeg00dwin 2025-02-14 14:06:52 -08:00
parent 71ff471fde
commit bf39006dea
1 changed files with 5 additions and 4 deletions

View File

@ -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;