-
-
Notifications
You must be signed in to change notification settings - Fork 952
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
Calculator App #375
base: main
Are you sure you want to change the base?
Calculator App #375
Conversation
Video 2588-10mB.mp4 |
3fe992e
to
5f4c65c
Compare
Ok, I'm declaring this "ready for review" now. I cant find any bugs anymore and spent hours trying to reduce the memory usage. One obvious thing that could still be done is parsing the numbers while putting everything on the input stack. that would save n*(k)+31 bytes, where n is the number of digits a number has and k is the number of bytes a single digit on the stack takes up. in praxis it should be at the lower range of that. Overflows are not handled. The eval function has a lot of resemblance with Italian cuisine, so i wouldn't be surprised if there are still some errors in it. I couldn't test that the motor actually works but i don't expect any surprises there. |
I've found a bug that causes the watch to reset. If you just enter a period, and then hit equals, it resets. This happens no matter how many periods you add. For example, if you enter just "." and then hit equals, it will reset, and "...." and then equals will also reset. Another case of unwanted behavior happens when you put "1+.1" into the calculator, and hit equals. It says the answer is "2.1", while I would expect it to say "1.1". If you type ".2+.3", it results in "5", which is also unexpected. The build that I'm running on my watch is a custom one that I compiled from your Calc branch, plus a custom Terminal watchface from a different repo. I'm a beginner when it comes to Git and compiling InfiniTime, so it's possible that my build is messed up, although everything else seems to work just fine. Otherwise, the app is great, and I hope that once these bugs get sorted out, we can have a calculator built into one of the next versions of InfiniTime! |
Yeah, that sounds plausible. Currently there's no handling for periods that dont appear after some digits, so they just act as if nothing was there at all. The reset can be explained by trying to evaluate an empty expression. I should probably check for that and either interpret it as a zero or treat it as an invalid expression, vibrate and return |
Thanks @jonvmey for all those reviews |
7eecd9c
to
1b18a63
Compare
Is this just waiting to be merged or? |
Its should be ready. Its just been long enough that I would probably have to rebase it again |
Any updates on this? |
It's basically done. At the time JF was to busy to take a look at this and its just kind of been sitting here since. Doesn't help that I've not been active on Infinitime for a while now. Rebasing it doesn't look to bad assuming it doesn't run into memory limits again. |
i would really like that feature on InfiniTime |
I have successfully tested this nice calculator by rebasing it on the latest develop branch. It would be great, if it could be merged into the official codebase. |
This would be a handy feature indeed. 🙂 |
… and cleaning up some remains from hacking around on this.
…valuate a single operator
rebased the Calc branch on current added the |
Just a quick heads up: Ive had some incorrect results (like 0.3*0.3) and am still not super confident about my overflow checks. I would like to pull out the eval function and write some tests for it before this gets realeased. |
Also, thanks for rebasing |
# Conflicts: # src/displayapp/Apps.h # src/displayapp/fonts/jetbrains_mono_bold_20.c # src/displayapp/screens/Symbols.h # src/displayapp/screens/settings/Settings.cpp
Too bad this didn't get merged yet. I like that the main devs are active, but the main feature in 1.9.0 is a terminal watchface, really? I mean: it looks great and geeky, so I really dig it! :) But if I had to choose, I would've liked to see something that's actually useful, like this calculator app. |
Had you an opportunity to raise your confidence in overflow checks? If not, could you please write more details? |
Please note that there are a lot of reasons why any specific PR is not merged yet : some are not finished or do not meet the project goals, priorities and/or code quality, they need time and attention from developers to review it and maintain it, they need too much memory and cannot be merged until we can find a way to free some ram/flash memory space,... As you can see, there are currently ~100 open PR, and I'm really sorry I cannot give them the attention they deserve, but I (along with other core developers) work on this project on our free time, and we cannot possibly review and merge that much PR as soon as they are opened. I'm sorry you don't find the terminal watchface as amazing as I do, but I'm pretty sure that If we merged this one instead, other people would have said that they don't need a calculator, and that they are sad the new watchface is not released yet. Now, regarding this PR, the first question I'll ask before going any further is : what is the added memory usage (flash and ram ) of this PR ? |
Just writing to express my support for this feature. I would definitely use it once it's available. |
rebased the Calc branch on current Additionally I refactored the PR into three single commits to make rebases easier when the fonts were changed by other PRs:
I propose to replace the current branch content with the new git remote add neroburner https://github.com/NeroBurner/InfiniTime.git
git fetch neroburner Calc_rebase
git switch Calc
git reset --hard neroburner/Calc_rebase
git push --force-with-lease origin Calc |
Thanks! |
I tried to reduce the firmware size and ram usage by not using heap-allocated stacks, and removing the intermediate tree data structures, without changing the algorithm. Some issues were solved, for example with displaying the result of Feel free to cherry-pick the commit: rev22@d1bedeb (updated) It's based on NeroBurner's rebase above. The binary size of the calculator changed from 13164 to 8628 bytes in my test builds with |
Any status on this besides a potential 1.10 rebase if needed? I'd love to see this merged |
I merged the rebase from @NeroBurner into the current develop state and resolved all conflicts. Hope I did it right! 😄 |
Could someone please tell why this hasn't been merged yet? |
I updated the code to work with v1.14, its available on my branch: https://github.com/JustScott/InfiniTime/tree/calculator_app. While it's working in InfiniSim, I get the following error attempting to build the mcuboot-app directly:
I'm assuming this means the |
Memory Optimisations@JustScott re. "needs some memory optimizations", this commit solves it for me: https://lab.trax.im/gentle/infinitime/-/commit/eebd027eecb2a4c756d02efecd11f96fc914d95a
The essence of the change is: @@ -124,3 +124,3 @@ Calculator::~Calculator() {
-static const char* buttonMap1[] = {
+static const char* const buttonMap1[] = {
"7", "8", "9", "/", "\n",
@@ -131,3 +131,3 @@ static const char* buttonMap1[] = {
-static const char* buttonMap2[] = {
+static const char* const buttonMap2[] = {
"7", "8", "9", "(", "\n", It also includes three You can pull that specific commit from my repo into your git pull https://lab.trax.im/gentle/infinitime/ eebd027eecb2a4c756d02efecd11f96fc914d95a or pull my git pull https://lab.trax.im/gentle/infinitime/ calculator_app which is currently just that single commit but I might add more. Let me know if it works for you, if you try it. Thanks. |
Anything holding this back from being merged? |
@tituscmd yes of course there is. please read the comments especially #375 (comment) |
That comment being 3 years old, I thought I might as well check up on it again. My bad! |
There's also #1483 to consider |
A calculator based on the Shunting-yard algorithm as described here. The basic functionality is in place but some work still needs to be done:
this resolves #227