Skip to content
Snippets Groups Projects
Commit a88f6516 authored by benjamin.sitbon's avatar benjamin.sitbon
Browse files

no more seg fault

parent f658e23e
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,7 @@ int main() ...@@ -60,6 +60,7 @@ int main()
case SDLK_SPACE: case SDLK_SPACE:
wait_key_release(); wait_key_release();
stop_wheel(&mas.wheels[wheel_turn]); stop_wheel(&mas.wheels[wheel_turn]);
wheel_turn += 1;
break; break;
case SDLK_s: case SDLK_s:
wait_key_release(); wait_key_release();
......
...@@ -22,7 +22,7 @@ void *wheel_func(void *param){ ...@@ -22,7 +22,7 @@ void *wheel_func(void *param){
printf("\nwheel_func"); printf("\nwheel_func");
wheel* id = (wheel *) (param); wheel* id = (wheel *) (param);
while(id->speed > 0){ while(1){
wheel_spin_1_tick(id); wheel_spin_1_tick(id);
wait_until(wheel_delay_ms(*id)); wait_until(wheel_delay_ms(*id));
} }
...@@ -44,7 +44,7 @@ int wheel_delay_ms(wheel this){ ...@@ -44,7 +44,7 @@ int wheel_delay_ms(wheel this){
int stop_wheel(wheel* this){ int stop_wheel(wheel* this){
while (this->current_px % 128 != 32) { // 32 is the offset to center the item while (this->current_px % 128 != 32) { // 32 is the offset to center the item
wheel_spin_1_tick(&this); wheel_spin_1_tick(this);
wait_until(wheel_delay_ms(*this)); wait_until(wheel_delay_ms(*this));
} }
this->speed = 0; this->speed = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment