π
<-
Chat plein-écran
[^]

ndless os config

C, C++, ASM...

ndless os config

Unread postby parisse » 29 May 2020, 12:41

Is there any way to access to the nspire OS configuration? For example, language, unit angle, ...
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 0.9%
 
Posts: 2011
Joined: 13 Dec 2013, 16:35
Gender: Not specified

Re: ndless os config

Unread postby Adriweb » 29 May 2020, 17:21

The problem can (should?) be put the other way around, especially in your case where it's via a lua module.
What I mean is, TI already provides all these APIs to get (and set, in some cases) settings/config of a document, from Nspire Lua.

So, it would be easy to just call your own C function of your module that "receives" the lua value corresponding to what you want.

For instance you can look at math.getEvalSettings()
(Returns a table of tables with the document settings that are currently being used by math.eval. These settings are equivalent to the current document settings unless a call has been made to setEvalSettings)
. Cf the page https://wiki.inspired-lua.org/math.setEvalSettings that has more info too.
For the language, there is locale.name()
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 54.3%
 
Posts: 12948
Images: 1086
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
Class: (ingénieur)
Twitter: adriweb
GitHub: adriweb

Re: ndless os config

Unread postby parisse » 29 May 2020, 19:02

Adrien, the "new" KhiCAS UI (ported from the Numworks UI) does not use lua anymore : the idea is to have the same codebase for several calculator brands (with a few ifdef of course), at least for the Numworks and the TI.
That's why it would be nice to get the language from a C call, otherwise I will have to ask the user English or French when he run KhiCAS for the first time, or set it to French and leave the user press ctrl s and select English (current behavior).
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 0.9%
 
Posts: 2011
Joined: 13 Dec 2013, 16:35
Gender: Not specified

Re: ndless os config

Unread postby Adriweb » 29 May 2020, 19:16

OK, if not from a Lua module anymore (I thought for graphics etc. you just "drew on screen" with a backup buffer etc.), then the Lua stuff doesn't apply of course :P
And it's more complicated now. The ndless sdk would have to impement that in an os-specific way, which isn't done right now afaik. No syscalls for it I think.
I'll let Vogtinator know about this topic.

Edit: getLangInfo() and getMode() from Basic would work -> https://www.manualslib.com/manual/37632 ... =48#manual ... if that's callable from ndless ?
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 54.3%
 
Posts: 12948
Images: 1086
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
Class: (ingénieur)
Twitter: adriweb
GitHub: adriweb

Re: ndless os config

Unread postby Vogtinator » 29 May 2020, 20:12

You could parse /phoenix/syst/settings/current.zip yourself, that's where the settings are stored (AFAICT).
It might be enough to use some undocumented syscalls to poke the calc engine, though I don't know how well that works and it might break in the future when the OS changes ABI.

Code: Select all
#include <os.h>
#include <syscall.h>
...

        char16_t input_w[] = u"nsolve(x-42=0,x)";
        void *math_expr = nullptr;
        int str_offset = 0;

        int error = TI_MS_evaluateExpr_ACBER(NULL, NULL, (const uint16_t*)input_w, &math_expr, &str_offset);
        if(error)
                return 0;

        char16_t *output_w;
        error = TI_MS_MathExprToStr(math_expr, NULL, (uint16_t**)&output_w);
        syscall<e_free, void>(math_expr); // Should be TI_MS_DeleteMathExpr

        if(error)
                return 0;

        // Do something with output_w, it's u"42." here

        syscall<e_free, void>(output_w);
User avatar
VogtinatorPremium
Niveau 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Level up: 57%
 
Posts: 158
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):

Re: ndless os config

Unread postby parisse » 30 May 2020, 06:53

Thanks, it just works!
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 0.9%
 
Posts: 2011
Joined: 13 Dec 2013, 16:35
Gender: Not specified

Re: ndless os config

Unread postby parisse » 30 May 2020, 07:41

Is there any way to set the RTC? I tried
Code: Select all
   unsigned NSPIRE_RTC_ADDR=0x90090000;
   * (volatile unsigned *) NSPIRE_RTC_ADDR = (h*60+m)*60;

but it does not work.
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 0.9%
 
Posts: 2011
Joined: 13 Dec 2013, 16:35
Gender: Not specified

Re: ndless os config

Unread postby Vogtinator » 30 May 2020, 09:30

You have to write to 0x90090008, see https://hackspire.org/index.php?title=M ... _.28RTC.29
User avatar
VogtinatorPremium
Niveau 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Level up: 57%
 
Posts: 158
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):

Re: ndless os config

Unread postby parisse » 30 May 2020, 11:10

Indeed!
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 0.9%
 
Posts: 2011
Joined: 13 Dec 2013, 16:35
Gender: Not specified


Return to Native: Ndless, Linux, ...

Who is online

Users browsing this forum: No registered users and 12 guests

-
Search
-
Featured topics
L'OS 5.5 de la TI-83 Premium CE / 84 Plus CE supprime l'assembleur - la plupart des jeux et certains programme ne fonctionneront plus
Omega, le fork étendant les capacités de ta NumWorks, même en mode examen !
Découvre les nouvelles fonctionnalités en Python de l'OS 5.5 pour la 83PCE/84+C-T Python Edition
Comparaisons des meilleurs prix pour acheter sa calculatrice !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...

Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
646 utilisateurs:
>640 invités
>2 membres
>4 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)