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. Setting parameters before system load

Setting parameters before system load

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 31 Views 2 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
    mariusl
    wrote on last edited by
    #1

    Hi
    I want to set some of my parameters prior to the mySensors code loading. I want to set the NodeId on my sensors and things like the WiFi credentials on the gateway. The gateway can be ESP8266 or ESP32.
    I noticed that was a preHwInit() function available. Will this allow me to set things like that before the code loads and if so where will I store or effect those parameters?

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      NodeID is set by defining MY_NODE_ID. The assignment can be a variable if you want to set it dynamically yourself.

      In the same manner you can probably set MY_WIFI_SSID and MY_WIFI_PASSWORD. I am not aware if anyone has tried setting them dynamically before, so you'll probably have to experiment a bit.

      https://www.mysensors.org/download/sensor_api_20#node-boot-sequence describes when things are canned in the boot sequence.

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

        Thanks for the reply. If use defined variables then I am sure it should be possible to do.
        As far as the dynamic setting is concerned, I want to connect the sensor serial port to a terminal and then set the variables that I need through text messages. There is an Arduino library called sCmd that has a very basic protocol that allows this kind of thing. There will be a button to put it into setup loop before hardware init and then I need to write the variables to the Eeprom. They will be retrieved at the next boot. Hence my need to know where the system puts it's config variables so that I don't go mess that up.

        mfalkviddM 1 Reply Last reply
        0
        • M mariusl

          Thanks for the reply. If use defined variables then I am sure it should be possible to do.
          As far as the dynamic setting is concerned, I want to connect the sensor serial port to a terminal and then set the variables that I need through text messages. There is an Arduino library called sCmd that has a very basic protocol that allows this kind of thing. There will be a button to put it into setup loop before hardware init and then I need to write the variables to the Eeprom. They will be retrieved at the next boot. Hence my need to know where the system puts it's config variables so that I don't go mess that up.

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

          @mariusl Cool use case, thanks for explaining.

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


          12

          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