aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorIan O'Dea <ianodea@gmail.com>2019-01-07 10:20:15 -0600
committerIan O'Dea <ianodea@gmail.com>2019-01-07 10:20:15 -0600
commit9f3afae5d12e7847639666b30f3239580dafed28 (patch)
treeb365f02db61d410e0e8c5ec26fed70e4c6319792 /tmk_core
parentd55dc9b8168dc4582751b4d7ee4b2de3f5b4e3ab (diff)
downloadqmk_firmware-9f3afae5d12e7847639666b30f3239580dafed28.tar.gz
qmk_firmware-9f3afae5d12e7847639666b30f3239580dafed28.zip
Make arm_atsam led matrix circular animation circular rather than obloid
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/arm_atsam/led_matrix.c4
-rw-r--r--tmk_core/protocol/arm_atsam/led_matrix.h1
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 3e07fbe6c..af49db28d 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)
218 218
219 disp.width = disp.right - disp.left; 219 disp.width = disp.right - disp.left;
220 disp.height = disp.top - disp.bottom; 220 disp.height = disp.top - disp.bottom;
221 disp.max_distance = sqrtf(powf(disp.width, 2) + powf(disp.height, 2));
221} 222}
222 223
223void disp_pixel_setup(void) 224void disp_pixel_setup(void)
@@ -267,6 +268,7 @@ void led_matrix_run(void)
267 float go; 268 float go;
268 float bo; 269 float bo;
269 float po; 270 float po;
271
270 uint8_t led_this_run = 0; 272 uint8_t led_this_run = 0;
271 led_setup_t *f = (led_setup_t*)led_setups[led_animation_id]; 273 led_setup_t *f = (led_setup_t*)led_setups[led_animation_id];
272 274
@@ -330,7 +332,7 @@ void led_matrix_run(void)
330 { 332 {
331 333
332 if (led_animation_circular) { 334 if (led_animation_circular) {
333 po = sqrtf((powf(fabsf(50 - led_cur->py), 2) + powf(fabsf(50 - led_cur->px), 2))); 335 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;
334 } 336 }
335 else { 337 else {
336 if (led_animation_orientation) 338 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 f0d452834..4513234e7 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 {
83 float bottom; 83 float bottom;
84 float width; 84 float width;
85 float height; 85 float height;
86 float max_distance;
86} led_disp_t; 87} led_disp_t;
87 88
88uint8_t led_matrix_init(void); 89uint8_t led_matrix_init(void);