Skip to content

Commit

Permalink
Remove unused variables, fix build error for ESP8266
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 committed Feb 9, 2019
1 parent 6d4b4d7 commit 959e28d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ setup: $(ARDUINO_DIR)/arduino-cli
$(ARDUINO_CLI) core update-index
$(ARDUINO_CLI) core install $(CORES)
$(ARDUINO_CLI) core list

.PHONY: clean %.hex all setup
2 changes: 1 addition & 1 deletion src/BasicStepperDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void BasicStepperDriver::startMove(long steps, long time){
float a2 = 1.0 / profile.accel + 1.0 / profile.decel;
float sqrt_candidate = t*t - 2 * a2 * d; // in √b^2-4ac
if (sqrt_candidate >= 0){
speed = min(speed, (t - sqrt(sqrt_candidate)) / a2);
speed = min(speed, (t - (float)sqrt(sqrt_candidate)) / a2);
};
}
// how many microsteps from 0 to target speed
Expand Down
5 changes: 2 additions & 3 deletions src/MultiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ long MultiDriver::nextAction(void){
*/
void MultiDriver::startBrake(void){
FOREACH_MOTOR(
if (event_timers[i] >= 0){
if (event_timers[i] > 0){
motors[i]->startBrake();
}
)
Expand All @@ -91,10 +91,9 @@ bool MultiDriver::isRunning(void){
* positive to move forward, negative to reverse, 0 to remain still
*/
void MultiDriver::move(long steps1, long steps2, long steps3){
unsigned long next_event;
startMove(steps1, steps2, steps3);
while (!ready){
next_event = nextAction();
nextAction();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/MultiDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MultiDriver {
// ready to start a new move
bool ready = true;
// when next state change is due for each motor
long event_timers[MAX_MOTORS];
unsigned long event_timers[MAX_MOTORS];
unsigned long next_action_interval = 0;
unsigned long last_action_end = 0;

Expand Down
2 changes: 0 additions & 2 deletions src/SyncDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
*/
void SyncDriver::startMove(long steps1, long steps2, long steps3){
long steps[3] = {steps1, steps2, steps3};
long timing[MAX_MOTORS];
/*
* find which motor would take the longest to finish,
*/
long move_time = 0;
FOREACH_MOTOR(
long m = motors[i]->getTimeForMove(abs(steps[i]));
timing[i] = m;
if (m > move_time){
move_time = m;
}
Expand Down

0 comments on commit 959e28d

Please sign in to comment.