The calculator is integrated and can be accessed by toggling the layer key until you see the following on the OLED screen:
From here the key matrix acts as the input method for the calculator, following this mapping:
The calculator supports 2 operands , called term_1
and term_2
in the code (for reference). A series of checks is implemented so that the state of the calculator is always valid.
The input flow is as follows for the 4 basic operations:
-
user enters digits for
term_1
1.1 user presses
±
to changeterm_1
sing -
user selects an operation
+
,-
,*
or/
-
user enters digits for
term_2
3.1 user presses
±
to changeterm_2
sing -
user presses
=
to calculate the result
When the calculation result is displayed, the calculator will wait for the user to reset the state to the initial state via the AC
key.
Note: if an operation is selected before any digit has being pressed the calculator treats term_1
as a 0
. In this case when *
or /
is selected the return value will be 0
as the result. The indetermination case is also handled, returning 0
.
The SQRT
function calculates the square root of the term_1
operand by itself or the result of an operation between term_1
and term_2
. Therefore the term_1
operand or the result of the operation between term_1
and term_2
must be a positive number, otherwise the calculator will display Imaginary Root!
as a result.
The input flow is as follows:
term_1
only
-
user enters digits for
term_1
-
user presses
SQRT
to calculate the result
term_1
and term_2
-
user enters digits for
term_1
1.1 user presses
±
to changeterm_1
sing -
user selects an operation
+
,-
,*
or/
-
user enters digits for
term_2
3.1 user presses
±
to changeterm_2
sing -
user presses
SQRT
to calculate the result, evaluated assqrt( term_1|operand|term_2)
As for the 4 basic operations, when the calculation result is displayed, the calculator will wait for the user to reset the state to the initial state via the AC
key.
* The SQRT
function is not supported for term_2
operands. If you try to execute one of the 4 basic operations and then press SQRT
this won't produce any output (the SQRT
command is ignored).
* Again if no digits are entered for term_1
the calculator will treat it as a 0
and return 0
as the result if SQRT
is pressed.
Implementation of the SQRT
function as above (term1
→ operation
→ term__2
→ SQRT
) is in the work.
This table summarize the implementation status of the calculator.
Legend: | ✅ Supported | 🚧 Under Development | 💡 Planned |
---|
Feature | Status |
---|---|
+ |
✅ |
- |
✅ |
* |
✅ |
/ |
✅ |
± |
✅ |
AC |
✅ |
SQRT |
✅ |
C |
💡 |
. aka decimal operands |
🚧 |