Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 66 of 66

Thread: Teensyduino 1.58 Beta #3

  1. #51
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,668
    Yes, the new toolchain is the future.

    Arduino IDE 2.0.3 bugs should be discussed on Arduino's forum or github issues. Talking about them here is ok, but does no good.

    FWIW, I still personally end up mostly using Arduino 1.8.19, because of the sorry state of 2.0.3 serial monitor.

  2. #52
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,876
    For anyone {USER} using TyCommander - or looking for an IDE 2.0.3 solution to the symptom of poor Serial Monitor connectivity/usage.

    Install TyCommander to some {PLACE}

    Then in proper teensy {ver #} folder <on Windows>: C:\Users\{USER}\AppData\Local\Arduino15\packages\teensy\hardware\ avr\{ver #}

    Make this: "C:\Users\{USER}\AppData\Local\Arduino15\packages\teensy\hardware\ avr\0.58.3\platform.local.txt"
    Code:
    tools.teensyloader.cmd.path={PLACE}\TyCommanderC.exe
    tools.teensyloader.upload.pattern="{cmd.path}" upload --autostart --wait --delegate "{build.path}/{build.project_name}.hex"
    The key there is the "--delegate" that @koromix added. The IDE will open TyCommander and ask "what Teensy" {it then associates that sketch and won't ask again}, it takes 'Serial' offline into bootloader which inspires Teensy Loader to upload the indicated .Hex or .eHex file to the chosen Teensy where it comes back online with TyCommander holding the link to SerMon restored.

    TyCommander can upload normal '.Hex' but, Only Teensy.exe can upload '.eHex' to Encrypted 1062's and this '--delegate' makes that happen, and in this case effectively allows 'Integrate to Arduino IDE 2' where TyCommander goes offline allowing upload and resume of SerMon.

    This gives a SerMon that reliably works for one or more connected Teensy devices. Same sketch will upload to same model Teensy clicking TyCommander GUI Bootloader (or Reset). To build same sketch for different model Teensy in the GUI first 'Right click the associated Teensy' and click 'Drop association' to prevent say 'T_4.1 .hex going toward a T_4.0' and failing.

    Click image for larger version. 

Name:	ide2TyComm.jpg 
Views:	19 
Size:	122.3 KB 
ID:	30374
    Last edited by defragster; Today at 06:23 PM.

  3. #53
    Senior Member
    Join Date
    Sep 2021
    Posts
    186
    Coremark is 4% higher with new compiler.
    I told you about this new information a long time ago But anyway, I'm glad that a newer toolchain is finally being used. It would be nice to see this for decades old components like the CMSIS or libraries, too.

  4. #54
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,876
    Quote Originally Posted by Mcu32 View Post
    I told you about this new information a long time ago But anyway, I'm glad that a newer toolchain is finally being used. It would be nice to see this for decades old components like the CMSIS or libraries, too.
    4% gain was fun to see.
    What is odd is the different results IDE 1 .vs. 2 - Seems I did it on two machines, but no comments on anyone else trying it to verify. Different build results may be trivial - or could be a bad surprise.

  5. #55
    Senior Member
    Join Date
    Sep 2021
    Posts
    186
    Quote Originally Posted by defragster View Post
    4% gain was fun to see.
    What is odd is the different results IDE 1 .vs. 2 - Seems I did it on two machines, but no comments on anyone else trying it to verify. Different build results may be trivial - or could be a bad surprise.
    Are the same build flags used?

  6. #56
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,876
    Quote Originally Posted by Mcu32 View Post
    Are the same build flags used?
    Assume so - it was default IDE build ... I didn't check the lines enough perhaps

  7. #57
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,876
    Quote Originally Posted by Mcu32 View Post
    Are the same build flags used?
    Collected this - both IDE 1 and 2 give this same SIZE info block - no diff in CodeCompare:
    Code:
    Memory Usage on Teensy 4.1:
      FLASH: code:16748, data:3992, headers:8952   free for files:8096772
       RAM1: variables:4864, code:14128, padding:18640   free for local variables:486656
       RAM2: variables:12384  free for malloc/new:511904
    Gotta restart machine - seems the one build already had a PCH it used. Removed most <COMMON> sections to try to make it readable and shorter:
    Click image for larger version. 

Name:	IDE12Diff.jpg 
Views:	25 
Size:	275.4 KB 
ID:	30392

  8. #58
    Junior Member
    Join Date
    Feb 2023
    Posts
    3
    Since it appears there is no beta #4 with String corrections, I tried that beta #3 then copied the cores directory which contains String corrections in the GitHub but with no avail:

    Code:
    WString.cpp: In constructor String::String(unsigned char)
     
    WString.cpp: 70:9: error: 'utoa' was not declared in this scope; did you mean 'ultoa'?
       70 |         utoa(c, buf, 10)
       |         ^~~~
       |         ultoa
    WString.cpp: In constructor String::String(int, unsigned char)
     
    WString.cpp: 78:9: error: 'itoa' was not declared in this scope; did you mean 'ltoa'?
       78 |         itoa(value, buf, base)
       |         ^~~~
       |         ltoa
    WString.cpp: In constructor String::String(unsigned int, unsigned char)
     
    WString.cpp: 86:9: error: 'utoa' was not declared in this scope; did you mean 'ultoa'?
       86 |         utoa(value, buf, base)
       |         ^~~~
       |         ultoa
    Error compiling core
    Also, I'm using Visual Studio C++ with vMicro extension (using Arduino 1.8).

    EDIT:

    It looks as if "/* #if defined(__STRICT_ANSI__) || (defined(_NEWLIB_VERSION) && (__NEWLIB__ < 2 || __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 2))" comments utoa and itoa.

    EDIT2:

    I had to replace them as
    Code:
    char * utoa(unsigned int val, char *buf, int radix) { return ultoa(val, buf, radix); }
    char * itoa(int val, char *buf, int radix) { return ltoa(val, buf, radix); }
    to be able to proceed further.
    Last edited by hlide; 02-27-2023 at 10:06 PM.

  9. #59
    Junior Member
    Join Date
    May 2020
    Posts
    13
    I tried using 1.58 beta 3 on a Mac running Sierra 10.12.6 and Arduino generated errors:

    Arduino: 1.8.19 (Mac OS X), TD: 1.58-beta3, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"

    dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
    Referenced from: /Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++
    Expected in: /usr/lib/libSystem.B.dylib

    dyld: Symbol not found: ____chkstk_darwin
    Referenced from: /Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++
    Expected in: /usr/lib/libSystem.B.dylib

    signal: abort trap
    /Applications/Arduino.app/Contents/Java/arduino-builder returned 255
    Error compiling for board Teensy 4.0.


    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.


    So I went back to 1.57 and it compiled and Teensy Loader worked.
    I just wanted let you know what I saw with 1.58 beta 3

  10. #60
    Junior Member
    Join Date
    Mar 2023
    Posts
    6
    Spent a day pulling hair out trying to get some FlexIO code working on a Teensy4. Turns out one of the definitions in imxrt.h is incorrect, making it (silently) impossible to link a shifter to any of the upper 4 timers.
    Sent a pull request on github to address it: https://github.com/PaulStoffregen/cores/pull/687

  11. #61
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,386

    Cool

    I was playing with some SmartMatrix demos (such as Adafruit_Gfx), and the new compiler in the 1.58 beta releases throws some new warnings for the Smartmatrix library. I will post this over at the Smartmaxtrix forum as well:

    Code:
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/Layer_BackgroundGfx.h:173,
                     from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:59,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/Layer_BackgroundGfx_Impl.h: In instantiation of 'void SMLayerBackgroundGFX<RGB, optionFlags>::swapBuffers(bool) [with RGB = rgb24; unsigned int optionFlags = 0]':
    /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:142:55:   required from here
    /home/meissner/Arduino/libraries/SmartMatrix/src/Layer_BackgroundGfx_Impl.h:197:19: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct rgb24' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
      197 |             memcpy(backgroundBuffers[1], backgroundBuffers[0], sizeof(RGB) * (this->matrixWidth * this->matrixHeight));
          |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:50,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixCommon.h:139:16: note: 'struct rgb24' declared here
      139 | typedef struct rgb24 {
          |                ^~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/Layer_BackgroundGfx.h:173,
                     from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:59,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/Layer_BackgroundGfx_Impl.h:199:19: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct rgb24' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
      199 |             memcpy(backgroundBuffers[0], backgroundBuffers[1], sizeof(RGB) * (this->matrixWidth * this->matrixHeight));
          |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:50,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixCommon.h:139:16: note: 'struct rgb24' declared here
      139 | typedef struct rgb24 {
          |                ^~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:218,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Refresh_Impl.h: In instantiation of 'static void SmartMatrixRefreshT4<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::hardwareSetup() [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]':
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Refresh_Impl.h:389:18:   required from 'static void SmartMatrixRefreshT4<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:272:97:   required from 'void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:380:15:   required from here
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Refresh_Impl.h:669:88: warning: taking address of packed member of 'SmartMatrixRefreshT4<36, 64, 64, 2, 0>::timerpair' may result in an unaligned pointer value [-Waddress-of-packed-member]
      669 |     sourceAddress = (volatile uint32_t*) & (matrixUpdateRows[0].rowbits[0].timerValues.timer_oe);
          |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:219,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h: In instantiation of 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers48(volatile rowDataStruct*, unsigned int) [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0; SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct = SmartMatrixRefreshT4<36, 64, 64, 2, 0>::rowDataStruct]':
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:548:24:   required from 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers(unsigned int) [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:168:113:   required from 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool) [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:270:121:   required from 'void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 64; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:380:15:   required from here
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:384:15: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'rgb48' {aka 'struct rgb48'}; use assignment or value-initialization instead [-Wclass-memaccess]
      384 |         memset(tempRow0, 0, sizeof(tempRow0));
          |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:50,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixCommon.h:159:16: note: 'rgb48' {aka 'struct rgb48'} declared here
      159 | typedef struct rgb48 {
          |                ^~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:219,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixTeensy4Hub75Calc_Impl.h:385:15: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'rgb48' {aka 'struct rgb48'}; use assignment or value-initialization instead [-Wclass-memaccess]
      385 |         memset(tempRow1, 0, sizeof(tempRow1));
          |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/meissner/Arduino/libraries/SmartMatrix/src/SmartMatrix.h:50,
                     from /home/meissner/Arduino/Tests/RGB_Matrix/Adafruit_Gfx/Adafruit_Gfx.ino:39:
    /home/meissner/Arduino/libraries/SmartMatrix/src/MatrixCommon.h:159:16: note: 'rgb48' {aka 'struct rgb48'} declared here
      159 | typedef struct rgb48 {
          |                ^~~~~
    Memory Usage on Teensy 4.1:
      FLASH: code:53692, data:9864, headers:9144   free for files:8053764
       RAM1: variables:37856, code:51048, padding:14488   free for local variables:420896
       RAM2: variables:19680  free for malloc/new:504608
    Here is the code I was using:

    Code:
    /*
     * This example shows how to use the Adafruit_GFX compatible Layers in SmartMatrix Library
     * This example was adapted from Adafruit's FX example for the Adafruit ILI9341 Breakout and Shield, see text below
     */
    
    /***************************************************
      This is our GFX example for the Adafruit ILI9341 Breakout and Shield
      ----> http://www.adafruit.com/products/1651
      Check out the links above for our tutorials and wiring diagrams
      These displays use SPI to communicate, 4 or 5 pins are required to
      interface (RST is optional)
      Adafruit invests time and resources providing this open source code,
      please support Adafruit and open-source hardware by purchasing
      products from Adafruit!
      Written by Limor Fried/Ladyada for Adafruit Industries.
      MIT license, all text above must be included in any redistribution
     ****************************************************/
    
    #define USE_ADAFRUIT_GFX_LAYERS
    
    // uncomment one line to select your MatrixHardware configuration - configuration header needs to be included before <SmartMatrix.h>
    //#include <MatrixHardware_Teensy3_ShieldV4.h>        // SmartLED Shield for Teensy 3 (V4)
    //#include <MatrixHardware_Teensy4_ShieldV5.h>        // SmartLED Shield for Teensy 4 (V5)
    //#include <MatrixHardware_Teensy3_ShieldV1toV3.h>    // SmartMatrix Shield for Teensy 3 V1-V3
    //#include <MatrixHardware_Teensy4_ShieldV4Adapter.h> // Teensy 4 Adapter attached to SmartLED Shield for Teensy 3 (V4)
    //#include <MatrixHardware_ESP32_V0.h>                // This file contains multiple ESP32 hardware configurations, edit the file to define GPIOPINOUT (or add #define GPIOPINOUT with a hardcoded number before this #include)
    //#include "MatrixHardware_Custom.h"                  // Copy an existing MatrixHardware file to your Sketch directory, rename, customize, and you can include it like this
    
    #if defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41)
    #include <MatrixHardware_Teensy4_ShieldV5.h>		// SmartLED Shield for Teensy 4 (V5)
    
    #elif defined(ARDUINO_TEENSY35) || defined(ARDUINO_TEENSY36)
    #include <MatrixHardware_Teensy4_ShieldV4.h>		// SmartLED Shield for Teensy 4 (V5)
    
    #else
    #error "Include the correct header for the microprocessor"
    #endif
    
    #include <SmartMatrix.h>
    
    #define COLOR_DEPTH 24                  // Choose the color depth used for storing pixels in the layers: 24 or 48 (24 is good for most sketches - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24)
    #define kMatrixWidth 64                 // Set to the width of your display, must be a multiple of 8
    #define kMatrixHeight 64                // Set to the height of your display
    const uint8_t kRefreshDepth = 36;       // Tradeoff of color quality vs refresh rate, max brightness, and RAM usage.  36 is typically good, drop down to 24 if you need to.  On Teensy, multiples of 3, up to 48: 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48.  On ESP32: 24, 36, 48
    const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save RAM, more to keep from dropping frames and automatically lowering refresh rate.  (This isn't used on ESP32, leave as default)
    
    // Choose the configuration that matches your panels.  See more details in
    // MatrixCommonHub75.h and the docs: https://github.com/pixelmatix/SmartMatrix/wiki
    #if kMatrixHeight == 64
    const uint8_t kPanelType = SM_PANELTYPE_HUB75_64ROW_MOD32SCAN;
    
    #elif kMatrixHeight == 32
    const uint8_t kPanelType = SM_PANELTYPE_HUB75_32ROW_MOD16SCAN;
    
    #elif kMatrixHeight == 16
    const uint8_t kPanelType = SM_PANELTYPE_HUB75_16ROW_MOD8SCAN;
    
    #else
    #error "Update setting kPanelType"
    #endif
    
    const uint32_t kMatrixOptions = (SM_HUB75_OPTIONS_NONE);        // see docs for options: https://github.com/pixelmatix/SmartMatrix/wiki
    
    SMARTMATRIX_ALLOCATE_BUFFERS(matrix, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
    
    // There are two Adafruit_GFX compatible layers, a Mono layer and an RGB layer, and this example sketch works with either (choose one):
    #if 1
      const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
      SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);
    #else
      const uint8_t kMonoLayerOptions = (SM_GFX_MONO_OPTIONS_NONE);
      SMARTMATRIX_ALLOCATE_GFX_MONO_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kMonoLayerOptions);
      
      // these backwards compatible ALLOCATE macros also work:
      //SMARTMATRIX_ALLOCATE_SCROLLING_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kMonoLayerOptions);
      //SMARTMATRIX_ALLOCATE_INDEXED_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kMonoLayerOptions);
    #endif
    
    // Assign human-readable names to some common 16-bit color values:
    #define BLACK   0x0000
    #define BLUE    0x001F
    #define RED     0xF800
    #define GREEN   0x07E0
    #define CYAN    0x07FF
    #define MAGENTA 0xF81F
    #define YELLOW  0xFFE0
    #define WHITE   0xFFFF
    
    // enable this to see the intermediate drawing steps, otherwise screen will only be updated at the end of each test (this slows the tests down considerably)
    const bool swapAfterEveryDraw = false;
    
    unsigned long testFillScreen() {
      unsigned long start = micros();
      backgroundLayer.fillScreen(BLACK);
      backgroundLayer.fillScreen(RED);
      backgroundLayer.fillScreen(GREEN);
      backgroundLayer.fillScreen(BLUE);
      backgroundLayer.fillScreen(BLACK);
      return micros() - start;
    }
    
    unsigned long testText() {
      backgroundLayer.fillScreen(BLACK);
      unsigned long start = micros();
      backgroundLayer.setCursor(0, 0);
      backgroundLayer.setTextColor(WHITE);  backgroundLayer.setTextSize(1);
      backgroundLayer.println("Hello World!");
      backgroundLayer.setTextColor(YELLOW); backgroundLayer.setTextSize(2);
      backgroundLayer.println(1234.56);
      backgroundLayer.setTextColor(RED);    backgroundLayer.setTextSize(3);
    //  backgroundLayer.println(0xDEADBEEF, HEX);
    //  backgroundLayer.println();
      backgroundLayer.setTextColor(GREEN);
      backgroundLayer.setTextSize(5);
      backgroundLayer.println("Groop");
      backgroundLayer.setTextSize(2);
      backgroundLayer.println("I implore thee,");
      backgroundLayer.setTextSize(1);
      backgroundLayer.println("my foonting turlingdromes.");
      backgroundLayer.println("And hooptiously drangle me");
      backgroundLayer.println("with crinkly bindlewurdles,");
      backgroundLayer.println("Or I will rend thee");
      backgroundLayer.println("in the gobberwarts");
      backgroundLayer.println("with my blurglecruncheon,");
      backgroundLayer.println("see if I don't!");
      return micros() - start;
    }
    
    unsigned long testLines(uint16_t color) {
      unsigned long start, t;
      int           x1, y1, x2, y2,
                    w = backgroundLayer.width(),
                    h = backgroundLayer.height();
    
      backgroundLayer.fillScreen(BLACK);
    
      x1 = y1 = 0;
      y2    = h - 1;
      start = micros();
      for(x2=0; x2<w; x2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      x2    = w - 1;
      for(y2=0; y2<h; y2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      t     = micros() - start; // fillScreen doesn't count against timing
      backgroundLayer.swapBuffers();
    
      backgroundLayer.fillScreen(BLACK);
    
      x1    = w - 1;
      y1    = 0;
      y2    = h - 1;
      start = micros();
      for(x2=0; x2<w; x2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      x2    = 0;
      for(y2=0; y2<h; y2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      t    += micros() - start;
      backgroundLayer.swapBuffers();
    
      backgroundLayer.fillScreen(BLACK);
    
      x1    = 0;
      y1    = h - 1;
      y2    = 0;
      start = micros();
      for(x2=0; x2<w; x2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      x2    = w - 1;
      for(y2=0; y2<h; y2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      t    += micros() - start;
      backgroundLayer.swapBuffers();
    
      backgroundLayer.fillScreen(BLACK);
    
      x1    = w - 1;
      y1    = h - 1;
      y2    = 0;
      start = micros();
      for(x2=0; x2<w; x2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      x2    = 0;
      for(y2=0; y2<h; y2+=6) {
        backgroundLayer.drawLine(x1, y1, x2, y2, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      t    += micros() - start;
      backgroundLayer.swapBuffers();
    
      return t;
    }
    unsigned long testFastLines(uint16_t color1, uint16_t color2) {
      unsigned long start;
      int           x, y, w = backgroundLayer.width(), h = backgroundLayer.height();
    
      backgroundLayer.fillScreen(BLACK);
      start = micros();
      for(y=0; y<h; y+=5) {
        backgroundLayer.drawFastHLine(0, y, w, color1);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
      for(x=0; x<w; x+=5) {
        backgroundLayer.drawFastVLine(x, 0, h, color2);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return micros() - start;
    }
    
    unsigned long testRects(uint16_t color) {
      unsigned long start;
      int           n, i, i2,
                    cx = backgroundLayer.width()  / 2,
                    cy = backgroundLayer.height() / 2;
    
      backgroundLayer.fillScreen(BLACK);
      n     = min(backgroundLayer.width(), backgroundLayer.height());
      start = micros();
      for(i=2; i<n; i+=6) {
        i2 = i / 2;
        backgroundLayer.drawRect(cx-i2, cy-i2, i, i, color);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return micros() - start;
    }
    
    unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
      unsigned long start, t = 0;
      int           n, i, i2,
                    cx = backgroundLayer.width()  / 2 - 1,
                    cy = backgroundLayer.height() / 2 - 1;
    
      backgroundLayer.fillScreen(BLACK);
      n = min(backgroundLayer.width(), backgroundLayer.height());
      for(i=n; i>0; i-=6) {
        i2    = i / 2;
        start = micros();
        backgroundLayer.fillRect(cx-i2, cy-i2, i, i, color1);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
        t    += micros() - start;
        // Outlines are not included in timing results
        backgroundLayer.drawRect(cx-i2, cy-i2, i, i, color2);
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return t;
    }
    
    unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
      unsigned long start;
      int x, y, w = backgroundLayer.width(), h = backgroundLayer.height(), r2 = radius * 2;
    
      backgroundLayer.fillScreen(BLACK);
      start = micros();
      for(x=radius; x<w; x+=r2) {
        for(y=radius; y<h; y+=r2) {
          backgroundLayer.fillCircle(x, y, radius, color);
          if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
        }
      }
    
      return micros() - start;
    }
    
    unsigned long testCircles(uint8_t radius, uint16_t color) {
      unsigned long start;
      int           x, y, r2 = radius * 2,
                    w = backgroundLayer.width()  + radius,
                    h = backgroundLayer.height() + radius;
    
      // Screen is not cleared for this one -- this is
      // intentional and does not affect the reported time.
      start = micros();
      for(x=0; x<w; x+=r2) {
        for(y=0; y<h; y+=r2) {
          backgroundLayer.drawCircle(x, y, radius, color);
          if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
        }
      }
    
      return micros() - start;
    }
    
    unsigned long testTriangles() {
      unsigned long start;
      int           n, i, cx = backgroundLayer.width()  / 2 - 1,
                          cy = backgroundLayer.height() / 2 - 1;
    
      backgroundLayer.fillScreen(BLACK);
      n     = min(cx, cy);
      start = micros();
      for(i=0; i<n; i+=5) {
        backgroundLayer.drawTriangle(
          cx    , cy - i, // peak
          cx - i, cy + i, // bottom left
          cx + i, cy + i, // bottom right
          backgroundLayer.color565(0, 0, i));
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return micros() - start;
    }
    
    unsigned long testFilledTriangles() {
      unsigned long start, t = 0;
      int           i, cx = backgroundLayer.width()  / 2 - 1,
                       cy = backgroundLayer.height() / 2 - 1;
    
      backgroundLayer.fillScreen(BLACK);
      start = micros();
      for(i=min(cx,cy); i>10; i-=5) {
        start = micros();
        backgroundLayer.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
          backgroundLayer.color565(0, i, i));
        t += micros() - start;
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
        backgroundLayer.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
          backgroundLayer.color565(i, i, 0));
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return t;
    }
    
    unsigned long testRoundRects() {
      unsigned long start;
      int           w, i, i2,
                    cx = backgroundLayer.width()  / 2 - 1,
                    cy = backgroundLayer.height() / 2 - 1;
    
      backgroundLayer.fillScreen(BLACK);
      w     = min(backgroundLayer.width(), backgroundLayer.height());
      start = micros();
      for(i=0; i<w; i+=6) {
        i2 = i / 2;
        backgroundLayer.drawRoundRect(cx-i2, cy-i2, i, i, i/8, backgroundLayer.color565(i, 0, 0));
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return micros() - start;
    }
    
    unsigned long testFilledRoundRects() {
      unsigned long start;
      int           i, i2,
                    cx = backgroundLayer.width()  / 2 - 1,
                    cy = backgroundLayer.height() / 2 - 1;
    
      backgroundLayer.fillScreen(BLACK);
      start = micros();
      for(i=min(backgroundLayer.width(), backgroundLayer.height()); i>20; i-=6) {
        i2 = i / 2;
        backgroundLayer.fillRoundRect(cx-i2, cy-i2, i, i, i/8, backgroundLayer.color565(0, i, 0));
        if(swapAfterEveryDraw) backgroundLayer.swapBuffers();
      }
    
      return micros() - start;
    }
    
    void setup() {
      Serial.begin(115200);
      matrix.addLayer(&backgroundLayer); 
      matrix.begin();
    
      // wait for Serial to be ready
      delay(1000);
    
      matrix.setBrightness(128);
    
      Serial.println(F("Benchmark                Time (microseconds)"));
    
      Serial.print(F("Screen fill              "));
      Serial.println(testFillScreen());
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Text                     "));
      Serial.println(testText());
      backgroundLayer.swapBuffers();
      delay(3000);
    
      Serial.print(F("Lines                    "));
      Serial.println(testLines(CYAN));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Horiz/Vert Lines         "));
      Serial.println(testFastLines(RED, BLUE));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Rectangles (outline)     "));
      Serial.println(testRects(GREEN));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Rectangles (filled)      "));
      Serial.println(testFilledRects(YELLOW, MAGENTA));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Circles (filled)         "));
      Serial.println(testFilledCircles(10, MAGENTA));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Circles (outline)        "));
      Serial.println(testCircles(10, WHITE));
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Triangles (outline)      "));
      Serial.println(testTriangles());
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Triangles (filled)       "));
      Serial.println(testFilledTriangles());
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Rounded rects (outline)  "));
      Serial.println(testRoundRects());
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.print(F("Rounded rects (filled)   "));
      Serial.println(testFilledRoundRects());
      backgroundLayer.swapBuffers();
      delay(500);
    
      Serial.println(F("Done!"));
    }
    
    void loop() {
      for(uint8_t rotation=0; rotation<4; rotation++) {
        backgroundLayer.setRotation(rotation);
        testText();
        backgroundLayer.swapBuffers();
        delay(1000);
      }
    }

  12. #62
    Senior Member
    Join Date
    Mar 2015
    Posts
    313
    I am testing now with the Arduino IDE 2.0.5 and just lost half of day troubleshooting something that I thought was due the code change I made https://forum.pjrc.com/threads/72432...784#post322784

    One should never do two changes at the same time.

    Arduino IDE 2.0.5 has some problems with the USBHost_t36.h or maybe there is new USBHost_t36.h anyway it causes now some glitches that where not with the older Arduino. It might be just that there is some printout activated as I now see constant

    Code:
    >>>USBHIDParser::out_data
    >>>USBHIDParser::out_data
    >>>USBHIDParser::out_data
    >>>USBHIDParser::out_data
    I thought then to find the USBHost_t36.h under the Arduino IDE 2.0.5 directory where it normally has been on Mac, but everything is changed, where is the USBHost_t36.h now?

  13. #63
    Senior Member
    Join Date
    Mar 2015
    Posts
    313
    Double post removed, some glitch on the forum...

  14. #64
    Senior Member
    Join Date
    Dec 2015
    Location
    LA
    Posts
    261
    @Garug
    Just checked, newest is Arduino IDE 2.0.4 not 2.0.5? Regardless IDE 2.0 serial com is not ready for prime time. It can't catch the 1st output lines and doesn't update the window to the latest lines without some kind of manual intervention. I wouldn't recommend it for debugging yet. I still use it most of the time, but if you're having issues with output don't.

    As you noted things are stored differently. If you look at the compiler output you will see:
    /Users/yourname/Library/Arduino15/packages/.....

  15. #65
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,435
    Note: As for the not seeing the last lines... There was a fix since the last released version.
    You can download from the main arduino.cc software page.

    As mentioned there are still many issues with the Serial Monitor, but for serious debugging needing Serial output, I use TyCommander anyway.

  16. #66
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,876
    Quote Originally Posted by KurtE View Post
    ... I use TyCommander anyway.
    +1 to that : see post #52 above to integrate to IDE 2 with added: "platform.local.txt"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •