Giter VIP home page Giter VIP logo

Comments (9)

marvinroger avatar marvinroger commented on May 23, 2024

At first, Homie-ESP8266 was designed for NodeMCU v1.0, but this obviously has to evolve.
To sum up:

  • We keep the NodeMCU button as the default reset trigger. Not sure about this, though
  • setResetTrigger(D4, HIGH, 6000) customizes the reset trigger
  • setResetFunction(func). if func() returns true, the device resets. But setResetFunction() is already a function that allow to define a function to run (e.g. clean custom EEPROM) when a reset is triggered. Maybe we could rename this one setResetHandler() or setResetHook? The hook one is the most explicit, as it is actually an hook
  • disableResetTrigger() disables the inner reset trigger only

from homie-esp8266.

enavarro222 avatar enavarro222 commented on May 23, 2024

It seems clever for me to keep the default reset trigger. Note that to have an ESP8266 to boot from flash (normal boot) you need to have GPIO0 high, so in most set-up GPIO 0 will be pullup.

For "manual" reset I was more thinking to a Homie.resetConfig() method that can be called from the user code (basically from the loopHandler) that just directly trigger the reset...

from homie-esp8266.

marvinroger avatar marvinroger commented on May 23, 2024

The loopHandler is only called when the network is in a good state (connected to both Wi-FI and MQTT). So if you want to reset because you've changed your Wi-Fi credentials, you're stuck as the loopHandler will never be called. So a resetConfig could eventually be called from the loop(), but this is sad to add code there, where there is only a pretty Homie.loop() call.

from homie-esp8266.

enavarro222 avatar enavarro222 commented on May 23, 2024

good point :)
Maybe one can add a warning about that in the doc !
So your solution with a callback fct is clearly better.

I'll need all this for one of my devices where all GPIO are used. So I'll work on this when I update the FW of that device (to make it use Homie). However I don't know when it will be...

from homie-esp8266.

marvinroger avatar marvinroger commented on May 23, 2024

I'll create a proper documentation, as the project is becoming more and more feature-rich. ;)

I don't know how I will implement those methods either!

from homie-esp8266.

marvinroger avatar marvinroger commented on May 23, 2024

Docs are more complete about the loopHandler now. More flexible reset is the next thing I will implement.

from homie-esp8266.

marvinroger avatar marvinroger commented on May 23, 2024

Done: cfbcb59 and b9d4b6b

You can see the usage in the Wiki

from homie-esp8266.

enavarro222 avatar enavarro222 commented on May 23, 2024

Great ! Nice work 👍

I hope to have some time to test it one evening next week...

Thanks !

from homie-esp8266.

marvinroger avatar marvinroger commented on May 23, 2024

Take your time! Feel free to reopen if it does not work for you.

from homie-esp8266.

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.