M5StickC Plus2 crash when Button State call
-
Hello together,
I'am using the M5StickC Plus2 with the Rover.
I have an issue when trying to implement the Button state.
Whenewer I have other other Code in theloop()besides theStickCP2.update()
and theIf(StickCP2.wasClicked())the Controller is crashing. Here I wrote a simple Firmware:#include <Arduino.h> #include "M5StickCPlus2.h" #include "M5_RoverC.h" void setup() { Serial.begin(9600); Serial.println("Startup"); auto cfg = M5.config(); StickCP2.begin(cfg); StickCP2.Display.setFont(&fonts::Orbitron_Light_24); StickCP2.Display.setTextColor(GREEN,DARKGREY); StickCP2.Display.print("Startup"); delay(100); } void loop() { StickCP2.update(); Serial.println("Battery Test Start here!"); int vol = StickCP2.Power.getBatteryLevel(); StickCP2.Display.clear(); StickCP2.Display.setCursor(StickCP2.Display.width()/2, StickCP2.Display.height()/2); StickCP2.Display.printf("%d \%", vol); if (StickCP2.BtnA.wasClicked()) { StickCP2.Display.clear(DARKCYAN); } delay(50); }I Only see the the BatteryLevel and then the screen gets dark and it restarts.
Serial Output is:Rebooting... �R��RgRStartup Battery Test Start here! Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x400d2312 PS : 0x00060a30 A0 : 0x800db9e4 A1 : 0x3ffb2270 A2 : 0x00000000 A3 : 0x3ffc2804 A4 : 0x00000064 A5 : 0x00000004 A6 : 0x3ffb8188 A7 : 0x80000001 A8 : 0x800d2310 A9 : 0x3ffb21d0 A10 : 0x00000004 A11 : 0x416778b6 A12 : 0x416778b6 A13 : 0x3ffb220c A14 : 0x3ffc2b70 A15 : 0x3ffb220c SAR : 0x0000001b EXCCAUSE: 0x0000001c EXCVADDR: 0x00000016 LBEG : 0x400867e0 LEND : 0x400867f6 LCOUNT : 0x00000000 Backtrace: 0x400d230f:0x3ffb2270 0x400db9e1:0x3ffb2290 ELF file SHA256: 706bf00c17c9ca5e ``` The Button Example for the StickC Plus 2 works fine. Also, when I remove everything else from the loop except the `Update` and the check for a Button action. I am Using Visual Studio Code and PlatformIO with the Arduiono Framework. -
@restart-au said in M5StickC Plus2 crash when Button State call:
StickCP2.Display.printf("%d \%", vol);I don't think that backslash-percent means anything special in printf(). You probably want
%%instead to get a literal percent sign in the output. I don't know what happens with what you've used, but a crash would not surprise me.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login