Code Monkey home page Code Monkey logo

yasm's People

Contributors

bricofoy avatar jm-france avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yasm's Issues

Cannot use YASM instance with volatile qualifier

Hello
I Love YASM. I use it in several projects.

In one project (https://github.com/Loic74650/HenHouse), I use a low power ADAFRUIT FEATHER 32U4 AVR board which deep sleeps most of the time and regularly wakes up then uses a YASM object to move a door. It compiles and works fine.

Now I wish to port that project to a more powerful SAMD21 board (ADAFRUIT FEATHER M0) but now the same code does not compile and gives me the following error message:

HenHouseLowPower.ino: In function 'void setup()':
HenHouseLowPower:535:22: error: passing 'volatile YASM' as 'this' argument discards qualifiers [-fpermissive]
  535 |   Door.next(Door_wait);

Before I send you a bare bone piece of code to replicate, do you see anything obvious I should check?

Thank you

Return to previous state function

Hi,
I'm using YASM for a OLED menu system and would like to add a screen saver. To do this I envisage a method for returning to the previous state. I have not been able to figure out how to do this with the lib. Perhaps there's a clever way to do this that I have missed. If not, is it possible to add such functionality?.

Here's how I envisage the use in my screen saver functionality:

  1. In all states that draw to the OLED display I would use the bool elapsed(timeout) to trigger a jump to next(state_screen_saver) in situations of inactivity after the timeout. The elapsed(timeout) would be reset by external events via a call to the same state next(state_display, true). So the screen saver would only be called after the elapsed time and absence of external events (such as buttons, rotary input etc).

  2. Inside the state_screen_saver a bool periodic(period) would periodically redraw the screen witch a character or glyph with random x, y positions. An external event (such as buttons, rotary input etc) would trigger a return to next(previous_state) with the bool isFirstRun could be optionally be set to true (which would reset the elapsed(timeout)) .

I assume such functionality could be useful in other ways as well when there is a need to return to previous state without having to specify the state. Storing a pointer to the previous state could of course be done outside the lib but it would be handy function in my view.

Thanks again for a very useful lib.

time counter needs to be stopped when the machine is stopped ?

may be time counter needs to be stored when calling stop() ans then resumed with the stored value on resume() (when we stay in the same state) so we keep accurate execution time record. Now we just keep "time in state" record, no matter if is is running or paused

option to set isFirstRun to true on resume

Hi,
I'm using your lib to implement a menu displayed on an OLED. Works great and makes the task very easy. I'm now wondering if it's possible to change the resume() function so that it could optionally resume the state with setting the isFirstRun to true? Something like StateMachine.resume(true).

My menu is only refreshed when user change a rotary encoder.
However the application also stop the StateMachine periodically, to do other tasks (displaying other parameters on the OLED) and then resume the last state.
When the program returns to the state it was stopped in it skips refreshing the OLED because I use the isFirstRun flag to refresh the OLED. I could refresh every time the state is run through but it would be unnecessary workload and a waste of processor cycles. I could also check which state was stopped and do next(state, true) but it can be in any of some 15 states and it would be tedious to check for all with a switch statement.
Any tip or hint on how I could do this would be extremely helpful.

link error in 1.0.1

link error in1.0.1 because of the btn.cpp modification, should keep BTN* BTN::_this (without static) instead of removing it completely

bool isInState(void (*state)())

Sorry, I am quite a novice, but are using YASM and very enthousiastic about it. But there is one thing that I don's get right. It is while using 'bool isInState(void (*state)())'.
There is no example for this method in the repository.
Say my machine is called myMachine and one of the states in that machine is called myState. How would I use the method (written out, please) to check that I am in that state?

Thank you so much! Have a very nice day, Theo

update examples

in your blink examples you use the built in LED and usually have a line such as
#define LedPin 13 //pin 13 because most arduino boards provide a led here

This is un-necessary as most Arduino boards have a pin connected to an on-board LED in series with a resistor and the IDE constant LED_BUILTIN is the number of the pin to which the on-board LED is connected (Most boards have this LED connected to digital pin 13).

Would suggest you use LED_BUILTIN instead of 13 (or remove your #define and use LED_BUILTIN directly in the code but that's less flexible)

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.