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. General Discussion
  3. Gateway Address EEPROM

Gateway Address EEPROM

Scheduled Pinned Locked Moved General Discussion
gateway address eeprom
5 Posts 2 Posters 1.5k Views 3 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.
  • M Offline
    M Offline
    miclane
    wrote on last edited by
    #1

    Hello,
    I save the ip address of my gateway to eeprom. At reboot, I would like to read the eeprom address and assign it to define MY_IP_ADDRESS. Is it possible ?
    Thank you.

    mfalkviddM 1 Reply Last reply
    0
    • M miclane

      Hello,
      I save the ip address of my gateway to eeprom. At reboot, I would like to read the eeprom address and assign it to define MY_IP_ADDRESS. Is it possible ?
      Thank you.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      @miclane could you describe your use case?

      Using dhcp means the ip address assignment is handled by a dhcp server. Most dhcp servers can be configured to hand out the same ip every time for the same mac address. This is usually called static lease or something similar.

      People who want the node itself control the ip address just define it in the sketch.

      Could you describe why these cases don't cover your needs?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miclane
        wrote on last edited by
        #3

        I am not going to use a DHCP address but a static address that I define in EEPROM.
        It's easy to define in the sketch directly but it's not my need.

        With a small interface, I define the address in EEPROM and when the sketch type my gateway starts, I would like the #define MY_IP_ADDRESS to include the address in eeprom.
        Thank you.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          miclane
          wrote on last edited by
          #4

          I solved my need.
          I get the bytes from the EEPROM as well.
          #define MY_IP_ADDRESS_B0 EEPROM.read(xxxx)
          ....
          #define MY_IP_ADDRESS_B3 EEPROM.read(yyyy)

          Then I define the address of the gateway like this:
          #define MY_IP_ADDRESS ((uint32_t)(MY_IP_ADDRESS_B3) << 24) | ((uint32_t)(MY_IP_ADDRESS_B2) << 16) | ((uint32_t)(MY_IP_ADDRESS_B1) << 8) | (uint32_t)(MY_IP_ADDRESS_B0)

          This applies to the other addresses required for the operation of an MQTT gateway.
          Hopefully this sharing is useful.
          Thank you

          1 Reply Last reply
          3
          • mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            That's a clever solution. Thanks for sharing.

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


            25

            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