π
<-
Chat plein-écran
[^]

ndless os config

C, C++, ASM...

ndless os config

Message non lude parisse » 29 Mai 2020, 12:41

Is there any way to access to the nspire OS configuration? For example, language, unit angle, ...
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.1%
 
Messages: 3497
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude Adriweb » 29 Mai 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()
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: ndless os config

Message non lude parisse » 29 Mai 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).
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.1%
 
Messages: 3497
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude Adriweb » 29 Mai 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 ?
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: ndless os config

Message non lude Vogtinator » 29 Mai 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: Tout sélectionner
#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);
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude parisse » 30 Mai 2020, 06:53

Thanks, it just works!
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.1%
 
Messages: 3497
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude parisse » 30 Mai 2020, 07:41

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

but it does not work.
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.1%
 
Messages: 3497
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude Vogtinator » 30 Mai 2020, 09:30

You have to write to 0x90090008, see https://hackspire.org/index.php?title=M ... _.28RTC.29
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: ndless os config

Message non lude parisse » 30 Mai 2020, 11:10

Indeed!
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.1%
 
Messages: 3497
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile


Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 6 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
795 utilisateurs:
>770 invités
>20 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)