diff --git a/application.c b/application.c index b77a3bb..4494890 100644 --- a/application.c +++ b/application.c @@ -664,6 +664,8 @@ static void command_dials(void* argument) { if (argument) { const uint32_t seconds = *(uint32_t*)argument; // get provide value + drv8825_goal = seconds; + drv8825_speed(100); if (seconds < 12 * 60 * 60) { const uint32_t goal = DIAL_CYCLE_STEPS * seconds * 1.0 / (12 * 60 * 60); if (goal != drv8825_goal) { @@ -1057,11 +1059,6 @@ void main(void) terminal_process = &process_command; // set central function to process commands terminal_setup(); // start terminal - // start motor to figure out position - gpio_set(GPIO_PORT(DRV8825_RESET_PIN), GPIO_PIN(DRV8825_RESET_PIN)); // power up driver - int32_t speed = 300; - command_speed(&speed); - // draw welcome text matrix_puts(false, 1, 1, "DACHBODEN", FONT_KING10, false, true, false); matrix_puts(false, 1, 12, "ZEIT", FONT_KING10, false, true, true); @@ -1117,12 +1114,12 @@ void main(void) dial_steps = 0; // restart position counter (and clear flag) drv8825_goal = DIAL_MIDNIGHT_STEPS; // go to midnight drv8825_reached = false; // wait until it's reached + drv8825_speed(0); // stop motor action = true; } if (drv8825_reached) { puts("midnight reached\n"); - speed = 0; // stop motor - command_speed(&speed); // stop motor + drv8825_speed(0); // stop motor drv8825_goal = 0; // disable goal drv8825_reached = false; // clear flag action = true; // redo main loop