Shop OBEX P1 Docs P2 Docs Learn Events
Quick Byte: P2 Edge 16MB Flash Reader and Explorer — Parallax Forums

Quick Byte: P2 Edge 16MB Flash Reader and Explorer

As presented in JonnyMac's Spin2 Beginner Series last week.

Comments, improvements appreciated.

Thanks,

Ken Gracey

Comments

  • dgatelydgately Posts: 1,630
    edited 2021-02-01 20:12

    The Flash Reader example code from JonnyMac's week5 Zoom meetups (& this Quick Byte code) will have display issues when executed from flexprop's terminal window. Setting  T_TYPE = T_ANSI <== ANSI mode terminal, usually allows the code to use some standard ansi features to format the terminal window, but it appears that code is not yet included in the examples.

    When executed the terminal shows (all text displays to the first line):

    I made a few edits that allowed the code to run from flexprop as well as PropTool 2.4.1, without the need for specific ansi features:

    In main():
    
     term.fstr0(string("P2 Flash Reader \n\r"))   '' added '\n'
    
    
     whoami1, whoami0 := flash.unique_id()
    
     term.fstr2(string("Unique ID...... %0.8x %0.8x\n\r"), whoami1, whoami0) '' added '\n'
    
    
     id := flash.device_type()
    
     term.fstr1(string("Manufacturer... %2.2x\n\r"), id.byte[1])  '' added '\n'
    
     term.fstr1(string("Device......... %2.2x\n\r"), id.byte[0])  '' added '\n'
    
    
     jedec := flash.jedec_info()
    
     term.fstr1(string("Manufacturer... %2.2x\n\r"), jedec.byte[2])  '' added '\n'
    
     term.fstr1(string("Mem Type....... %2.2x\n\r"), jedec.byte[1])  '' added '\n'
    
     term.fstr2(string("Capacity....... %2.2x (%d bytes)\n\r"), jedec.byte[0], 1 << jedec.byte[0]) '' added '\n'
    
    
    
    in dump():
    
      term.fstr1(string(" %s\n\r"), @asc)            ' and display at end of line   '' added '\n'
    
    
    

    This may be more of a macOS vs WIN issue, as opposed to an ansi problem...

  • Perfect, Dennis. It seems that for all @JonnyMac code examples that support both PST and ANSI terminal modes, it would be a good to create a self-standing P2 Quick Byte entitled "ANSI or Parallax Serial Terminal with JonnyMac's Code" and show how this line of code would be changed for the different tools. It appears to be important enough that we should not bury this important compatibility benefit as a sub-topic.

    Thoughts from the P2 Quick Byte fan club? (I just made one, hoping you all join as members). This would or wouldn't make its own Quick Byte?

    Thanks,

    Ken Gracey

  • Ken,

    Definitely worth it's own Quick Byte.

  • Okay, I think so too, @Roy. It will help us all, going forward, to be able to provide more direct visibility to FlexProp.

    Ken Gracey

  • Ken,


    I'm not sure if my solution is the best... JonnyMac may have a much better one.


    dgately

  • He self-alerted when he read this post and proposed a solution already.

    He'll be providing an example specifically for this purpose.

    Ken Gracey

  • Well... the problem is that PST adds a newline to the CR character -- we may have to do this manually in terminal used by FlexProp. I thought that the -T option made that terminal compatible with PST (i.e., adding the extra NL). Other terminals allow this. I use Putty and tell it to add the NL character so that I can use CR at the end of strings.


    Let me research solutions.

  • JonnyMacJonnyMac Posts: 9,104
    edited 2021-02-02 15:48

    I thought I had tested those programs on my Windows system prior to the class -- it turns out I had. Perhaps this is a Mac thing.

    On my system I add "-T" to the end of the run command line. With that and setting T_TYPE to T_ANSI, the program output is as expected -- again, on Windows.



  • JonnyMacJonnyMac Posts: 9,104
    edited 2021-02-02 00:06

    This was an accidental post. This new forums code is really getting on my nerves....

  • @"Ken Gracey" said:

    ...

    Thoughts from the P2 Quick Byte fan club? (I just made one, hoping you all join as members). ...

    ...

    Thanks,
    Ken Gracey

    Where is this P2 Quick Byte fan club? I want to join!

  • @DaveJenson said:
    Where is this P2 Quick Byte fan club? I want to join!

    You're already a premier member, Dave. But, welcome to the club anyway!

    Ken Gracey

Sign In or Register to comment.