arduinoMenu crash in nav.poll - help needed

wearyhacker

Well-known member
I am trying to get a CHOOSE submenu working in a platformio prioject for teensy 4.1.
This is what the menu definition looks like. Full code is attache to this post.
C++:
int instrument_index =-1;//some variable used by your code (not necessarily an int)
CHOOSE(instrument_index, instrument_menu,"Choose instrument",doNothing,noEvent,wrapStyle
  ,VALUE("First",1,doNothing,noEvent)
  ,VALUE("Second",2,doNothing,noEvent)
);
MENU(mainMenu, "Settings menu", doNothing, noEvent, wrapStyle
    ,SUBMENU(instrument_menu)
    ,OP("Sub1", dummy, enterEvent)
);
The very first call to the nav.poll() in the loop function crashes the teensy.
I have used the arduinoMenu library in a number of other projects on teensy with problems. This the first time I have tried to the CHOOSE submenu macro.

Here is the platformio.ini file.

Code:
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
lib_deps =
    neu-rah/ArduinoMenu library@^4.21.4
    greiman/SSD1306Ascii@^1.3.5
    neu-rah/streamFlow@0.0.0-alpha+sha.bf16ce8926

Any suggestions on how to fix this, I have run out of ideas.
 

Attachments

  • main.cpp
    3.4 KB · Views: 10
@wearyhacker:

Have you tried making use of the crash report capability is your setup() function (note that the while (!Serial); line will wait forever if nothing is connected to the serial console, so comment that line out and/or remove it after you have finished with the crash debugging) ??

Code:
   while (!Serial);

   if (CrashReport)
   {
      Serial.print(CrashReport);
   }

Which type of crash does it report & what's the apparent cause at the specific line that the crash report indicates ??

Mark J Culross
KD5RXT
 
Thanks for your response.

I have found what the problem was.

The line just before the CHOOSE macro
Code:
int instrument_index = -1;//some variable used by your code (not necessarily an int)
That I copied from an example in the ArduinoMenu library, causes the crash. Initialising the variable to 1 works fine.
 
Back
Top