Refactor trig functions into LUT#476
Conversation
|
Final tally for binary size change with this diff is exactly 7000 bytes less. I still need to load this on my watch tomorrow to verify that everything's good but I think it's all correct. |
|
There already seems to exist this in LVGL. Can you use this instead? |
|
There seem to be some issues with this. VID_20210710_120654.mp4 |
|
Yeah, that definitely looks wrong, I'll take another look to see what I messed up. The implementation in LVGL doesn't appear to be part of its exposed API so I wasn't sure if we wanted to use that directly. |
If they remove it I guess we can think of a solution. For now I suspect it'd be fine. Quite a bit less to maintain. |
Replaced the use of the standard library trig functions with a LUT-based implementation instead. The standard library implementations produce more accurate results but the usage here doesn't need that. This ends up saving nearly 7kB of binary size.
|
Updated the changes to use LVGL's _lv_trigo_sin function instead. The issue @Riksu9000 mentioned should also be fixed now. |
|
Seems to work fine now. text goes down 7160 and data goes up 4 compared to develop. |
|
Looks good to me, thanks for this PR, this nice review and these 7160 free bytes in memory ;) |
Replaced the use of the standard library trig functions with a LUT-based
implementation instead. The standard library implementations produce
more accurate results but the usage here doesn't need that. This ends up
saving nearly 7kB of binary size.