-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point usage in radio.c #1408
Comments
I haven't looked yet, but how much precision do these calculations require? 32-bits? |
good question. frequency is among the inputs and is in the mhz range. time is the output and is in the milliseconds range. that's a larger value span than 32 bit integer can do, so a bit of scaling here and there will be required (maybe it's as simple as dividing the frequencies by 1000 first, and then the result outmatically comes out as milliseconds integers and the problem magically goes away, but i don't have the code in front of me and don't know). |
I note that ST re-wrote RadioTimeOnAir() to use integer math. Probably a good example here. I'm using the STM32WL firmware v1.3. |
I don't know which version of this project you are using. Changed
At some point in time we have tried to remove all Please take a look at this project master branch radio drivers implementation. You may also take a look at v5.0.0-branch as it implements completely refactored radio drivers. |
thanks. i will pass on the information. |
copy and pasting my bug report from HelTecAutomation/CubeCell-Arduino#261
radio.c uses floating point numbers (doubles, to be precise) to calculate the air time (maybe there are other places too), however it would be quite trivial to rewrite this computation to fixed point maths.
the goal would be to get rid of the generated code for float/double support when there is no hf unit:
8035: 0000f7bd 1464 FUNC GLOBAL HIDDEN 2 __aeabi_ddiv
8141: 0000f0d1 1772 FUNC GLOBAL HIDDEN 2 __aeabi_dadd
8045: 0000ffb1 1252 FUNC GLOBAL HIDDEN 2 __aeabi_dmul
8097: 0000ecc9 840 FUNC GLOBAL HIDDEN 2 __aeabi_fsub
8279: 0000ea99 560 FUNC GLOBAL HIDDEN 2 __aeabi_fdiv
in total this accounts for 5.8kB of flash on cortex-m0 mcus.
The text was updated successfully, but these errors were encountered: