Setting parameters before system load



  • 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?


  • Mod

    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.



  • 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.


  • Mod

    @mariusl Cool use case, thanks for explaining.


Log in to reply
 

Suggested Topics

  • 4
  • 8
  • 15
  • 20
  • 4
  • 9

46
Online

11.4k
Users

11.1k
Topics

112.6k
Posts