Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Press inclusion button to reboot after 10 sec, ESP8266 only

Press inclusion button to reboot after 10 sec, ESP8266 only

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Clone Tv
    wrote on last edited by
    #1

    The patch for the inclusion button, after holding for 10 seconds, the device goes into reboot.
    Only suitable for ESP8266 ..

    MySensors/core/MyInclusionMode.patch

    9c9
    <  * Copyright (C) 2013-2019 Sensnology AB
    ---
    >  * Copyright (C) 2013-2020 Sensnology AB
    21,23d20
    < #if defined(ARDUINO_ARCH_ESP8266)
    < #  include <Esp.h>
    < #endif
    28,29c25,26
    < unsigned long _inclusionStartTime = 0U, _rebootStartTime = 0U;
    < bool _inclusionMode, _rebootMode;
    ---
    > unsigned long _inclusionStartTime;
    > bool _inclusionMode;
    33d29
    < 	_rebootMode = false;
    66,68c62
    < 
    < 	bool b = (hwDigitalRead(MY_INCLUSION_MODE_BUTTON_PIN) == MY_INCLUSION_BUTTON_PRESSED);
    < 	if (!_inclusionMode && b) {
    ---
    > 	if (!_inclusionMode && hwDigitalRead(MY_INCLUSION_MODE_BUTTON_PIN) == MY_INCLUSION_BUTTON_PRESSED) {
    72,84d65
    < #	if defined(ARDUINO_ARCH_ESP8266)
    < 	if (!_rebootMode && b) {
    < 		_rebootStartTime = hwMillis() + 10000U;
    < 		_rebootMode = true;
    < 
    < 	} else if (_rebootMode && b) {
    < 		if (_rebootStartTime < hwMillis())
    < 			ESP.restart();
    < 
    < 	} else if (_rebootMode) {
    < 		_rebootMode = false;
    < 	}
    < #	endif
    86c67,68
    < 	if (_inclusionMode && (hwMillis() - _inclusionStartTime > MY_INCLUSION_MODE_DURATION * 1000L)) {
    ---
    > 
    > 	if (_inclusionMode && hwMillis()-_inclusionStartTime>MY_INCLUSION_MODE_DURATION*1000L) {
    90c72
    < }
    ---
    > }
    \ No newline at end of file
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    26

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular