Currently if you spend more then 15 seconds looking up figures or
transcribing the answer then the system will switch back to the
clock and the answer will be lost.
Fix this by remembering the output between invocations.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently calculations such as 22/7 do not work correctly on the
simulator (which uses double precision floating point). Fix this
by explicitly truncating the strings when needed.
Additionally the current calculate() method has some problems when
the calculation cannot be evaluated since it will needlessly clear out
the calculation. Push calculate (and the exception handling) into the
caller and report errors using the vibration motor instead.
Finally we rename display_output() to the more idiomatic _update().
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently the fields is a list of lists of strings. This will needlessly
consume RAM so lets switch it over to a simple string (which is immutable
and can be stored in flash).
We also replace indices with simple x and y variables. In addition to
avoiding a (temporary) memory allocation this is also easier to use
when looking up in fields.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently the calculator uses an open grid. It's a matter of taste but
I prefer a closed grid.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently the coordindates used for line drawing are "tuned" for a bug in
the line drawing code (and now draw off the edge of the screen). Fix this.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>