Coder Social home page Coder Social logo

Comments (3)

ladyada avatar ladyada commented on July 25, 2024

hmm does it work with arduino ide? we dont use platformio

from adafruit_seesaw.

ukmaker avatar ukmaker commented on July 25, 2024

It does work with Arduino IDE, but I need a debugger :-(
To me, it just looks like that's not the way the method declaration should be - TrellisCallback is already defined as a function pointer: typedef void (*TrellisCallback)(keyEvent evt);

from adafruit_seesaw.

TriviumGames avatar TriviumGames commented on July 25, 2024

Like a year ago something changed in the esp32 toolchain where if a function declared a non-void return type, but didn't return anything, returning would crash (with illegal instruction), even if nobody used the result. There's some debate as to whether this is a compiler bug here. But even if it is a compiler bug it's a fairly longstanding one that affects this library in a way that is pretty hard to troubleshoot. The examples don't work, code that used to work with a pre-2.0 esp32 toolchain no longer works, and when it fails you just get a callstack just shows the crash as being in the callback when it returns, even if the callback doesn't do anything bad at all.

This is pretty unfriendly behavior, and I don't really see how someone without a very strong C++ background would be able to troubleshoot it. (The workaround, btw, is to just return 0; at the end of your callback.)

I absolutely agree with ukmaker that the Neotrellis library uses function pointer typedefs incorrectly. It demands we pass in a function that returns a TrellisCallback, not a function that is a TrellisCallback. And then the examples define those, but never actually get around to returning that.

That said, I don't see any practical way to fix the API that doesn't break all existing client code. My request/recommendation would be to just add the "return 0;" to all the examples. I'm mixed on whether it would be helpful or just confusing to document why this is there, since it's basically totally nuts and the ESP toolchain folks position of "this is standards compliant so I don't care if it breaks real wold code" is clearly wrong, but at least it gives people a path to success - the examples work, and at least someone can line-by-line compare them to their own code to find out what causes the crash.

from adafruit_seesaw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.