Commit graph

28 commits

Author SHA1 Message Date
Christophe de Dinechin
60bef07561 equations: Add units to built-in equations
Add base units to built-in equations for the solver to work.

Fixes: #968

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-06-15 13:16:43 +02:00
Christophe de Dinechin
66c460fabb units: Split Eng to Elec and Visc
In order to better match the unit layout on the HP50, rename the `Eng`
menu to `Elec`, and move `P` and `St` units to the `Visc` menu.

Fixes: #960

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-06-07 22:50:58 +02:00
Christophe de Dinechin
3e7d65a330 equations: Rename PerfectGas equation to IdealGas
This is the way this is described in English.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-05-13 23:51:06 +02:00
Christophe de Dinechin
b79b40eb8a menu: Add algebra variable operations to AlgebraMenu
Add operations on algebra variables and configuration to `AlgebraMenu`

Also add the corresponding characters to the menus for testing purpose

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-05-04 12:11:01 +02:00
Christophe de Dinechin
046ce2f391 tests: Add support for more characters
Add support for mathematical characters, to be able to parse things
like `ℝ→ℂ` or `sin⁻¹`.

Fixes: #908

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-17 00:23:47 +02:00
Christophe de Dinechin
6df12cd583 characters: Add music characters menu
The `Boxes` menu is a replication of the `Blocks` menu.
Replace it with a `Music` menu.

Add four missing music glyphs to the font.

Also add the reference file for `chars-menu.png`, which was missing.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-24 15:30:55 +01:00
Christophe de Dinechin
7ccb0a7435 equations: Mark c and R as constants in equations
We need to distinguish variables from constants in the equations.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-12 17:04:07 +01:00
Christophe de Dinechin
06a6d7a8e7 characters: Add constant, equation and lib markers to RPL menu
Add the characters used as a prefix for constants, equations and
library items in the RPL menu, which required some reorganization.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-12 17:03:05 +01:00
Christophe de Dinechin
10d67d3353 tests: Add tests for characters menu/catalog
Add tests for all character menu as loaded from characters.csv.

Add tests for the character catalog feature.

Also fix the reading of the quote character from the file.
2024-03-11 11:20:43 +01:00
Christophe de Dinechin
6b8fe4bb87 constants: Get values of pi and e by name, not value
We want to be able to have adjusted (short) labels, yet get a
full-precision value, so base the lookup on the name of the constant
instead of its value.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
a1f3cf8392 constants: Add prefix to identify constants, equations and xlib
There was a prefix in the editor in the first iteration of the
implementation for constants. This was actually a good idea, since it
lets us distinguish if you really want a constant or a normal symbol.

One of the main benefits is that there is no namespace clash. For
example, you can again use the `g` name, since the g constant will
actually be (cst) g. This was breaking the part in the Demo that used
`g` as a value for the level of green.

Visually, added three characters that show as (cst), (eq) and (lib) in
the text editor, in order to know what kind of name we are dealing
with.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
9e95425850 library: Add equations library and object library
These are two catalogs that behave much like the constants catalog,
and inherit most of the code.

The equations library is intended to store standard equations.

The library is for standard objects and various useful objects or
programs.

Both can be organized by topics.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
535072fc87 constants: Represent constants with an index
Instead of identifying a constant using a name, use an index in the
constants list, which takes less space and is more efficient at
runtime.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:10 +01:00
Christophe de Dinechin
f81745fa97 characters: Add character catalog
Add character catalog when inside text.
Define character menus with various languages and shapes.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:10 +01:00
Christophe de Dinechin
000bd35ce7 characters: Organize Greek character set
Organize the Greek characters menu so that uppercase letters are
shifted and diacritical show up above in the same menu page.

Also add some missing glyphs in Greek font.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:10 +01:00
Christophe de Dinechin
c62b792b19 characterss: Add dynamic characters menu
Same principle as constants and units, but simpler.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:09 +01:00
Christophe de Dinechin
e2096dcc32 constants: Parse units containing text
Allow `"Hello World"` in a constant

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:09 +01:00
Christophe de Dinechin
9484413d55 constants: Do not use units that don't parse correctly
The unit parser is not too happy with dot multiplication

Fixes: #842

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-03 17:33:54 +01:00
Christophe de Dinechin
dd5db54d97 arithmetic: Symbolic and numeric infinity
Add support for the `InfinityValue` (-22) flag, described in the
HP50G as the "Infinite result exception" flag.

When the flag is set, infinite results are returned either as symbolic
constant infinity `∞` or as its value, currently defined as
`9.99999E999999`.

Whether the infinity value is returned symbolically or numerially
depends on the `NumericalConstants` (-2) and `NumericalResults` (-3)
flags.

Fixes: #835

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 14:02:14 +01:00
Christophe de Dinechin
beaaee23e4 constants: Evaluate constants from config/constants.csv
Dynamic constants menu, similar to units menu, which is populated
either from an internal table, or from `config/constants.csv`

Fixes: #497

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 00:55:00 +01:00
Christophe de Dinechin
4cffc39d3a units: Add dms unit to angles menu
Add the `dms` unit to angles menu, with value "one degree" so that we
can convert between DMS and decimal degrees using the normal units
menu.

Fixes: #818

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-02-12 00:05:25 +01:00
Christophe de Dinechin
06d042785e units: Fix parsing of angle units
After the introduction of `_dms` and the parsing of degrees symbols in
numbers, degrees could not be parsed correctly as a unit.

Fixes: #809
Fixes: #810

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-02-12 00:05:25 +01:00
Christophe de Dinechin
5ef744fa61 units: Fix rpm value in the units definitions
One `rpm` is `1/60_Hz`, not `60_Hz`.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Reported-by: spiff72 <mgobluevictor@gmail.com>
2023-11-17 14:10:57 +01:00
Christophe de Dinechin
770c389909 units: Allow customization of the Cycle command from units file
The units file can contain a section beginning with `"=Cycle"`, which
specifies how `Cycle` should convert specific units. For example:

```
"=Cycle"
"in", "mm",
"mm", "cm"
"cm", "in"
"USD", "EUR"
"EUR", "CHF"
"CHF", "USD"
```

This enables quick unit conversions with a single key.

Fixes: #534

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-06 16:54:29 +01:00
Christophe de Dinechin
e974ad2966 units: Reorganize menus both in units file and built-in units
Reorganize the units menu both in the units file and in the built-in units

Fixes: #550

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-06 14:25:59 +01:00
Christophe de Dinechin
6b936d69a6 units: Add Test menu for units file
This is just for testing purpose.
2023-11-06 00:36:30 +01:00
Christophe de Dinechin
f0771e4459 units: Second iteration units file parsing
This implementation does not require to allocate > 5K of memory
for the default units menu.

The new approach is to load the units from the file every time. Some
initial timing on the DM42 showed that it took about 80ms to parse the
file.

Fixes: #544

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-06 00:19:11 +01:00
Christophe de Dinechin
328c2e484f Makefile: install demo state and configuration
Better to update the demo and unit configuration files when updating

Fixes: #547

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-06 00:19:11 +01:00