- My goal is: I am planning to make a web page which can enable or disable eth from checkbox.
- My actions are: I don’t know how to change the ethernet configuration. I know that changing the config_schema can do this, but I want to change the configuration dynamically.
- ["eth.enable", true]
- The result I see is: Everything is good, unless I want to change the ethernet configuration dynamically, but not from config_schema or RPC uart.
- My expectation & question is: I am using C++, I hope there is a function that can enable or disable the ethernet.
For (almost?) every entry in config_schema there is a (auto-generated?) pair of C functions that set and read that value.
Search your build log for functions starting with
mgos_sys_config_set_. You should find a
mgos_sys_config_set_eth_enable inline function prototype. Pass a false as parameter to disable…
If I’m correct, the change will be applied at the config level, the Ethernet port itself might still be operative and you might need to either reset your device or call another function to deinitialize it, and I don’t know if such a function exists.
Source code is here
Thanks, scaprile. It was very helpful.