Shop Learn P1 Docs P2 Docs Events
FlexProp: a complete programming system for P2 (and P1) - Page 39 — Parallax Forums

FlexProp: a complete programming system for P2 (and P1)

13637394142

Comments

  • RaymanRayman Posts: 12,971

    Just go here and scroll down for the zip file link:
    https://github.com/totalspectrum/flexprop/releases

  • @DiverBob

    Was a great help. Thanks

  • How do you get he info out of the solar array?

    Mike

  • @msrobots said:
    How do you get he info out of the solar array?

    Mike

    Get what info out of what solar array?

  • I am trying to use an array in flexprop. I get an arror saying that Datastring[100] is not a an arra> @ersmith said:

    @whicker said:
    @ersmith
    in FlexBasic I am having trouble passing an array to a subroutine.

    Multi-dimensional arrays aren't really supported very well in FlexBasic, unfortunately. I'll try to improve this in the future, but for now your best bet is to instead use structs, arrays of structs, or arrays of arrays. For example, you could declare a mat3d type similar to the vec3d. Or, you could do:

    Sub MultiplyMatrixVector3(i As vec3d, o As vec3d, m() as Single(3))
    

    Is flexspin in the same boat. I am trying to use datastring[100] for a single dimension array and get errors. Using your hello program as a template and expanding.
    Thanks in advance

  • @pilot0315 said:
    I am trying to use an array in flexprop. I get an arror saying that Datastring[100] is not a an array

    That's because you mis-spelled it as "Datasting" in your declaration. That's why it says that "Datastring" is an unknown symbol.

    Just to be clear, the array problem in FlexBasic is with two dimensional and higher arrays like Foo(10, 20), which couldn't easily be passed as parameters. Single dimensional arrays work in all languages and in all cases that I'm aware of.

  • @ersmith

    My dumb mistake. Missed it. Thanks
    And thanks for the info re flexbasic. I make mistakes all the time.
    It is always humbling. :)

  • @ersmith
    I tried installing the latest version of flexprop on my Linux Mint 20 system and when I envoke flexprop, I get the following error message:
    bash: ./flexprop: cannot execute binary file: Exec format error
    I am sure that I have done something wrong but not a clue as to what it is.
    Jim

  • @RS_Jim said:
    @ersmith
    I tried installing the latest version of flexprop on my Linux Mint 20 system and when I envoke flexprop, I get the following error message:
    bash: ./flexprop: cannot execute binary file: Exec format error
    I am sure that I have done something wrong but not a clue as to what it is.
    Jim

    You'll have to build flexprop from source. The binary .zip file is for Windows and Mac OS only.

  • FlexProp 5.9.21 is available now in binary form from github (see link in my signature).

  • Eric,
    I have a bug report for 5.9.20.
    Ansi terminal formatting does not work, specifically Position(x;y)
    and my computer will not do terminal functions at any Baud Rates other than 230_400 or 115_200

    both of those functions worked correctly in the previous version. I don't want to install 5.9.21 until I know those functions work!
    Thanks for all you do
    Jim

  • @RS_Jim said:
    I have a bug report for 5.9.20.
    Ansi terminal formatting does not work, specifically Position(x;y)
    and my computer will not do terminal functions at any Baud Rates other than 230_400 or 115_200

    What operating system are you using? What language? How are you printing the strings? Are you using the default (built in) ANSI terminal or an external one? Have you tried using the external one?
    I can assure you that the built in one has always been able to position characters for me on my Debian Linux (Buster) system. I just verified it at 2000000 baud with a simple test program:

    '' some useful variables
    dim x, y as integer
    dim esc$
    
    const cols = 80
    const rows = 25
    
    x = (cols-10) / 2
    y = (rows/2)
    
    
    esc$ = chr$(27) + "["
    gotoxy(x, y)
    print "Hello, world!";
    gotoxy(x, y)
    print esc$; 5; "ACursor up";
    gotoxy(x, y)
    print esc$; 5; "BCursor down";
    gotoxy(x, y)
    print esc$; 10; "DLeft";
    gotoxy(x, y)
    print esc$; 20; "CRight";
    
    gotoxy(0, y + 12)
    print "A number of special effects are available, such as:"
    rem print esc$; "1;31m"; "color " ; esc$; "32;44m"; "combinations"; esc$; "0m"
    rem print esc$; "4m"; "underscore"; esc$; "0m"; ", ";
    rem print esc$; "9m"; "strikethrough"; esc$; "0m"; ", ";
    rem print esc$; "5m"; "blinking"; esc$; "0m"; ", or ";
    print esc$; "7m"; "inverted"; esc$; "0m"; " text"
    rem print esc$; "9;5m"; "or even combinations"; esc$; "0m"
    print esc$; "0m";
    '' and finish
    do
    loop
    
    sub gotoxy(x, y)
      print esc$; y; ";"; x; "H";
    end sub
    

    This worked both with the built in ANSI terminal and with an external terminal. The REM'd out lines only produce effects on the external terminal, the built in one does not yet support underline, strikethrough, or color (and never has).

  • Eric,
    I am working with a HP G6 computer using Linux Mint 20 which is fully updated. The program I am working with is all in Spin2. Most of the software comes from the thread "NRF24L01+revisited. Jessie @avisa242 created a series of spin2 files to support the NRF transceiver and in them he has a bunch of terminal widgets to do ANSI onscreen formatting. All of the formatting works in 5.9.19 but not in 5.9.20. I used a very brief spin2 test loop to assess the screen formatting.

    repeat idx from 0 to 10
    ser.position(0;idx)
    ser.printf("how now brown cow idx =",%d",idx)

    The printf and position are both part of jessie's ANSI terminal support routines in the above mentioned thread. when I try any other BAUD setting than 115_200 and 340_400, get garbage on the screen. patching the exact same program into 5.9.19 will work at 2_000_000 BAUD (or any other setting) I forget the forum commands to make the code properly format space so it looks like I failed to indent, but in the real thing it is indented.
    I hope I have answered all your questions.
    Jim

  • @ersmith
    I just installed 5.9.21 and I have the same formatting and Baud issues. It works at 230_400 but not higher. Something got broken after 5.9.19.
    Jim

  • Jim: Literally there have been no changes to the ANSI terminal code since well before 5.9.19. It isn't the terminal, as you can verify by selecting an external terminal instead of using the built in one (or by running the sample BASIC program i posted earlier).

    Perhaps some change has broken your code (or revealed a bug in your code). Are you able to share that code, or at least some kind of a test program? Without seeing the exact code you're using it's difficult for me to diagnose this.

  • AribaAriba Posts: 2,619
    edited 2022-12-13 00:51

    I also have problems with the terminal after upgrading from 5.9.18 to 5.9.21
    Here is a testcode that shows the problem:

      _clkfreq = 160_000_000
    obj
      ser : "spin/SmartSerial"
    
    pub main() | i
      ser.start(63,62,0,230_400)
      ser.str(string("0123456789",13,10))
      ser.tx($FF)   ' <-- this corrupts further characters
      ser.str(string("0123456789",13,10))
    

    characters above ASCII 127 seems to get sticky and show with any new printed character.
    Edit: Seems to be the same in older versions, I just discovered this yet.

    Another problem, that also exist since a few versions:
    The context menu for Tabs in the editor is no longer available. If you right click on a tab, nothing happens. This menu was very handy to save/close a file in the tab. Now I have to go to the pulldown menu, or use shortcut keys.

    Andy

  • Eric,
    attached is an archive file of my test program that is giving me difficulty.
    Jim

  • @Ariba : the built-in terminal has always been a bit dodgy with characters above $7F; on Linux it uses UTF-8 encoding, on Windows I'm not sure. That was always the case in FlexProp, but the default terminal to use may have changed after the version you were using. Could you check under your Options menu and try changing the terminal to the external one?
    (In the most recent source code I've modified the terminal to explicitly set the character encoding based on the runtime character set option, which should improve the internal terminal behavior.)

    @RS_Jim : I don't see any top level .spin file in that archive. Did you mean to include testserial.spin2? If so you missed it.

  • Lets try this again!
    Jim

  • @RS_Jim : Now I get "Unable to open file 'com.serial' while compiling com.serial.terminal.ansi.spin2.

  • RS_JimRS_Jim Posts: 1,694
    edited 2022-12-13 23:35

    try this
    Edit: I just extracted the file and was able to get it to compile in flexprop 5.9.21
    Just as a side note how do you determine a version when you open flexprop?
    Jim

  • @RS_Jim said:
    try this
    Edit: I just extracted the file and was able to get it to compile in flexprop 5.9.21
    Just as a side note how do you determine a version when you open flexprop?
    Jim

    Still missing com.serial, but this time also missing com.serial.terminal.ansi (which I could get from an older archive, but I still can't compile). The bug is most likely in com.serial.spin2, so I really need to see that. I do not need any .p2asm files, just the .spin2 files.

    As for the version, whenever you have a question about flexprop go to the "Help" menu first. Under there you'll find an "About..." menu item which will give you the version.

  • @RS_Jim : Have you tried setting the terminal mode (under the Options menu) to "Use external terminal"? That will use the Linux terminal window, which might work better than the terminal built in to FlexProp.

  • @ersmith
    I did as you suggested and switched to external terminal and my print data formatting works as expected. I don't understand why the problem cropped up after 5.9.19, as I had made no changes in my code.
    Oh well, keep up the good work.
    Jim

  • AribaAriba Posts: 2,619
    edited 2022-12-19 03:11

    Can you disable specific warnings for the Flex_C compiler?
    I get a ton of these warnings, when I work with strings:

      warning: parameter passing discards const attribute from pointer
    

    If you have 50 lines of these warnings in the console output, it's hard to find the relevant informations, like Program Size, or Errors.

    Andy

  • whickerwhicker Posts: 747
    edited 2022-12-19 16:49

    @Ariba said:
    Can you disable specific warnings for the Flex_C compiler?
    I get a ton of these warnings, when I work with strings:

      warning: parameter passing discards const attribute from pointer
    

    If you have 50 lines of these warnings in the console output, it's hard to find the relevant informations, like Program Size, or Errors.

    Andy

    The warnings are usually there for a reason. C strings are dangerous and you're doing something potentially dangerous without realizing it.

    Edit: C is a very hard language to get correct and likes to yell at you for doing something wrong but doesn't tell you how to do it right.

    But we could help you with the necessary casts or attributes if you post the details in another thread.

  • @Ariba @whicker this is a case where FlexC is following the spirit of the C standard rather than the letter; strictly speaking a string literal should have type "char []" rather than type "const char[]", even though they are not supposed to be writable. I'll add some way to disable that particular warning.

  • @ersmith said:
    @Ariba @whicker this is a case where FlexC is following the spirit of the C standard rather than the letter; strictly speaking a string literal should have type "char []" rather than type "const char[]", even though they are not supposed to be writable. I'll add some way to disable that particular warning.

    They are const in C++ though, because it's the correct thing to do. Non-const literals in regular C are for backwards compat with code that was written before the const keyword existed.

  • AribaAriba Posts: 2,619
    edited 2022-12-19 22:01

    Thanks Eric

    I need to say, that this code is quite big and I don't have written it, so going thru all the functions and add a const to the parameter type would be a lot of work.

    So other compilers take string literals as non-const type and therefore don't give these warnings. Why not do the same in Flex-C? Or just disable this warning by default.

    Andy

Sign In or Register to comment.