Comments (3)
By the way, I ran some tests using sizeOf
. A state should occupy 32 bytes, while a transition occupies 40. Given this, at the moment my states occupy 2400 bytes, while my transitions occupy 8040 bytes, for a total of 10440. My chip should have ~90KiB of memory for instructions, so I should be well within that limit.
Moreover, I checked https://github.com/jonblack/arduino-fsm/ to which this library is inspired: In https://github.com/jonblack/arduino-fsm/blob/master/Fsm.cpp the way to add transitions is incremental (it doesn't recurse over an array, but adds transitions one by one at user request). In particular, immediately before adding a transition, memory is reallocated by giving:
m_transitions = (Transition*) realloc(m_transitions, (m_num_transitions + 1) * sizeof(Transition));
I tried to do the same in the function I defined in the comment above, adding the line:
transitions = (Transition*) realloc(transitions, (num_standard + size) * sizeof(Transition));
just before the for
cycle. This has the only effect of putting my chip in a cycle of crashes.
from simplefsm.
Ok, solved it. Created a pull request in case someone is interested: #7
from simplefsm.
Hey Fabrizio,
thank you for your issue report and for your pull request!
Will review your code and merge it.
🙇
from simplefsm.
Related Issues (13)
- Simple example blows up esp32 huzzah feather HOT 4
- Can't compile examples for ESP32 target HOT 12
- Issue with timedTransitions using PlatformIO HOT 4
- Compile error with Button2::CallbackFunction HOT 1
- TimedTransition fires immediately. HOT 1
- Destructor of SimpleFSM uses free() for Transitions HOT 1
- Behavior of TimedTransition undefined if "wrong" constructor is used
- Constructor of "State" does not pass on "is_final" to function "setup" HOT 1
- Listen to events/functions inside state HOT 1
- Wrong type of memcopy argument
- Set TimedTransition interval on setup or loop HOT 7
- Improve GraphViz output by using named events HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplefsm.