diff options
author | Ian O'Dea <ianodea@gmail.com> | 2019-01-07 10:20:15 -0600 |
---|---|---|
committer | Ian O'Dea <ianodea@gmail.com> | 2019-01-07 10:20:15 -0600 |
commit | 9f3afae5d12e7847639666b30f3239580dafed28 (patch) | |
tree | b365f02db61d410e0e8c5ec26fed70e4c6319792 /tmk_core/protocol/arm_atsam | |
parent | d55dc9b8168dc4582751b4d7ee4b2de3f5b4e3ab (diff) |
Make arm_atsam led matrix circular animation circular rather than obloid
Diffstat (limited to 'tmk_core/protocol/arm_atsam')
-rw-r--r-- | tmk_core/protocol/arm_atsam/led_matrix.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/led_matrix.h | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c index 3e07fbe6c3..af49db28dd 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/led_matrix.c @@ -218,6 +218,7 @@ void disp_calc_extents(void) disp.width = disp.right - disp.left; disp.height = disp.top - disp.bottom; + disp.max_distance = sqrtf(powf(disp.width, 2) + powf(disp.height, 2)); } void disp_pixel_setup(void) @@ -267,6 +268,7 @@ void led_matrix_run(void) float go; float bo; float po; + uint8_t led_this_run = 0; led_setup_t *f = (led_setup_t*)led_setups[led_animation_id]; @@ -330,7 +332,7 @@ void led_matrix_run(void) { if (led_animation_circular) { - po = sqrtf((powf(fabsf(50 - led_cur->py), 2) + powf(fabsf(50 - led_cur->px), 2))); + po = sqrtf((powf(fabsf((disp.width / 2) - (led_cur->x - disp.left)), 2) + powf(fabsf((disp.height / 2) - (led_cur->y - disp.bottom)), 2))) / disp.max_distance * 100; } else { if (led_animation_orientation) diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/led_matrix.h index f0d4528348..4513234e7f 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.h +++ b/tmk_core/protocol/arm_atsam/led_matrix.h @@ -83,6 +83,7 @@ typedef struct led_disp_s { float bottom; float width; float height; + float max_distance; } led_disp_t; uint8_t led_matrix_init(void); |