Skip to content

No Usermod Settings trought readFromConfig() #7

Description

@CoolZeroNL

I have some issues with readFromConfig() in my own usermod , with saving/loading settings. So i have loaded the example within my wled compilation to check out how it should work. But here i also notice that the defaults are not loaded/read.

load the example usermod:

custom_usermods =
  MyMod = https://github.com/wled/wled-usermod-example#main

Version used, latest main branch of wled repo.

Image

Here we see that the

  • testInt = 0
  • testLong = 0
  • testpins[0] = 0
  • testpins[1] =0
 "um": {
    "ExampleUsermod": {
      "enabled": false,
      "great": 0,
      "testBool": false,
      "testInt": 0,
      "testLong": 0,
      "testULong": 42424242,
      "testFloat": 42.42,
      "testString": "Forty-Two",
      "pin": [0, 0]
    }

where these are set in readFromConfig as default values, but they dont load/read the default's

  // A 3-argument getJsonValue() assigns the 3rd argument as a default value if the Json value is missing
      configComplete &= getJsonValue(top["testInt"], testInt, 42);  
      configComplete &= getJsonValue(top["testLong"], testLong, -42424242);

      // "pin" fields have special handling in settings page (or some_pin as well)
      configComplete &= getJsonValue(top["pin"][0], testPins[0], -1);
      configComplete &= getJsonValue(top["pin"][1], testPins[1], -1);

so these should have other value than 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions