I have a toggle switch defined and shows up as such in the RM app.
When I toggle the switch I get messages in the callback to its new state.
When the code starts it sets the switch on with value(true)
Code: Select all
showPosition = Param("Show Position", ESP_RMAKER_PARAM_CCT, value(true), PROP_FLAG_READ | PROP_FLAG_WRITE);
setValue(showPosition, value(true));
showPosition.addUIType(ESP_RMAKER_UI_TOGGLE);
my_setup->addParam(showPosition);
I then toggle that switch back on and I see the message in the callback say the state is now true.
The code then again sends the same value to setValue ie. setValue(value(false)) however this time the switch does not return to off in the RM app. No matter how many times you send setValue(value(false)) it will never again show the off state in the app. It only turns the toggle off the first time.
Code: Select all
void setValue(Param &p, param_val_t v) {
values[p.getParamName()] = v; // std::map<const char*, param_val_t>
p.updateAndReport(v);
Serial.printf("Manually Set %s to '%s'\n", p.getParamName(), value(p).c_str()); // this is an overloaded value(Param) function that returns the state in a String
}