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. Feature Requests
  3. Eprom erase Jumper

Eprom erase Jumper

Scheduled Pinned Locked Moved Feature Requests
3 Posts 2 Posters 2.1k 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.
  • K Offline
    K Offline
    kr0815
    wrote on last edited by
    #1

    I´m not a programmer, only user - my wish would be to have an eprom-erase-jumper, so i don´t need to erase it when moving the sensor from one gateway to another one, even to another installation.
    I was even thinking, as there are many unused ports on the arduino, about jumpers to select the update time ?

    1 Reply Last reply
    0
    • BartEB Offline
      BartEB Offline
      BartE
      Contest Winner
      wrote on last edited by
      #2

      HI @kr0815 , what you can do is add a piece of code which checks for a jumper presence on start-up if so just erase your EEPROM.

      An input pin will become LOW when the jumper connects this pin to GND and will become HIGH when the jumper is removed (stable high by activating the interval pull up resistor)

      This jumper check code can be something like this:

          pinMode(CLEAR_EEPROM_JUMPER, INPUT);           // set pin to input
          digitalWrite(CLEAR_EEPROM_JUMPER, HIGH);       // turn on internal pull up resistors
          delay(50);                                     // Wait to stabilize the input pin
          // If jumper is placed and thus the input pin is LOW a clean EEPROM is required
          if (digitalRead(CLEAR_EEPROM_JUMPER) == LOW) {
              Serial.begin(BAUD_RATE);
              Serial.println(F("Clearing EEPROM. Please wait..."));
              for (int i=0;i<512;i++) {
                  EEPROM.write(i, 0xff);
              }
              Serial.println(F("Clearing done. Continue with normal init..."));
          }
      

      A very simple plug in would look something like this:

      #include <MySensor.h>
      #include <SPI.h>
      #include <EEPROM.h>  
      
      // Clear EEPROM jumper: when placed this pin should be connected to GND 
      #define CLEAR_EEPROM_JUMPER  6
      
      MySensor gw;
      
      void setup()  
      { 
          pinMode(CLEAR_EEPROM_JUMPER, INPUT);           // set pin to input
          digitalWrite(CLEAR_EEPROM_JUMPER, HIGH);       // turn on internal pull up resistors
          delay(50);                                     // Wait to stabalize the input pin
          // If jumper is placed and thus the input pin is LOW a clean EEPROM is required
          if (digitalRead(CLEAR_EEPROM_JUMPER) == LOW) {
              Serial.begin(BAUD_RATE);
              Serial.println(F("Clearing EEPROM. Please wait..."));
              for (int i=0;i<512;i++) {
                  EEPROM.write(i, 0xff);
              }
              Serial.println(F("Clearing done. Continue with normal init..."));
          }
          
          // place normal init here
          gw.begin();
      }
      
      void loop()      
      { 
          // Normal sensor stuff here
          gw.process();
      } 
      

      Just add this check to all your plugin code

      1 Reply Last reply
      5
      • K Offline
        K Offline
        kr0815
        wrote on last edited by
        #3

        Thank BartE, exactly what i needed, works perfect
        I already upgraded all my sensors, makes it much easyer because i have a different gateway on my solder bench then in the house

        It would maybe make sense to include that feature to the examples ?

        Best regards

        Klaus

        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        21

        Online

        11.7k

        Users

        11.2k

        Topics

        113.0k

        Posts


        Copyright 2019 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