diff options
Diffstat (limited to 'src/view/view_racing.c')
-rw-r--r-- | src/view/view_racing.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/view/view_racing.c b/src/view/view_racing.c index 29735b2..38d99fb 100644 --- a/src/view/view_racing.c +++ b/src/view/view_racing.c @@ -45,10 +45,7 @@ static s_view_racing s_info = { static float _calculate_angle(float value, float min, float max) { - float x = sinf(value); - - float y = (x-(-1)) * ((max - min) / (1 - (-1))) + min; - + float y = (value-(-1)) * ((max - min) / (1 - (-1))) + min; return y; } @@ -96,11 +93,11 @@ static void _controller_cb(void *data) { s_controller_data *controller_data = (s_controller_data *)data; - _D("VIEW VALUES: %f %f", controller_data->direction, controller_data->velocity); - float angle = _calculate_angle(controller_data->direction, s_info.dir_min_angle, s_info.dir_max_angle); view_base_set_angle(s_info.direction, angle, 180.0, 180.0); + _D("VIEW VALUES: %f %f DIR: %f", controller_data->direction, controller_data->velocity, angle); + angle = _calculate_angle(controller_data->velocity, s_info.vel_min_angle, s_info.vel_max_angle); view_base_set_angle(s_info.velocity, angle, 180.0, 180.0); } |