KermMartian / ArTICL

TI Link Protocol library for the Arduino and MSP432 Launchpad development platforms
https://www.cemetech.net
BSD 3-Clause "New" or "Revised" License
88 stars 12 forks source link

How to send y-variables / strings / programs? #16

Open DSchndr opened 6 years ago

DSchndr commented 6 years ago

My tries to send an Y-Variable / string / program (which are Y-Variables according to http://merthsoft.com/linkguide/ti83+/vars.html ) crash my calc (ti-82 stats aka. TI-83 "minus" ) everytime, which sometimes looks awesome but isn´t what i want ;)

How about an small example that sends and receives those (Y-) Variables?

Here is my code to make the header and data which gets sent to the calc (doesn´t work (un)fortunatly)


int onSendAsCBL2(uint8_t type, enum Endpoint model, int* headerlen,
                 int* datalen, data_callback* data_callback) {
[...]
  *datalen = 2 + 1; //2 length, one token
  TIVar::intToSizeWord(*datalen, &header[0]);

  //header[0] = 0x00; //length 0
  //header[1] = 0x00; //length 0
  header[2] = 0x0c; //0x04; //package id (string = 0x04) (which one should be used?) 
  header[3] = 0x9A; //string token A
  header[4] = 0x9A; //string token A            
  header[5] = 0x8E; //string token 0
  header[6] = 0x97; //string token 9
  header[7] = 0x8E; //padding 0
  header[8] = 0x8E; //padding 0
  header[9] = 0x8E; //padding 0
  header[10] = 0x8E; //padding 0
  //header[11] = 0x00; //ver null
  //header[12] = 0x00; //checksum null
  *headerlen = 11;

  data[0] = 0x03; //length
  data[1] = 0x00; //length
  data[2] = 0xAF; //token "V"
  //*datalen = 3;
  [...] ```
jakecrowley commented 6 years ago

Have you figured out how to do this? I am having issues as well.

DSchndr commented 6 years ago

In the end I've used the fork from ajcord. Pull request #14 should also do the trick.

KermMartian commented 6 years ago

If you've tested and verified the code in #14, I'd be happy to merge that. Is that the case?

DSchndr commented 6 years ago

I've tested it with an 82Stats and remember that Calc->Arduino or Arduino->Calc worked, but i needed to hack the code a little bit up.

The code hasn't got the 82Stats model and vartype defined. (other stuff may also be required because i think the calculator wasnt recieving the right data (tokens instead of string))

14 maybe works with an 83(+) but unfortunatly i haven't got one to test.

KermMartian commented 5 years ago

Sending and receiving strings is now demonstrated in the HelloWorld example that was properly merged with #14, which does indeed properly support the TI-83 Plus/TI-84 Plus family now. Sending/receiving programs and Y= variables would be a perfect next set of examples to add. Did you ever solve this yourself, @DSchndr ?