Skip to content

Commit f73eae6

Browse files
dimonomidcesantabot
authored andcommitted
BREAKING: Sys config API change
Now apps should use getters and setters instead of accessing struct fields directly, e.g. instead of `get_cfg()->update.timeout` it should be `mgos_sys_config_get_update_timeout()` to get the current value, and `mgos_sys_config_set_update_timeout(123)` to update the value. For now, the config structs are public, but they will be made private soon, so use accessors to keep your code working. PUBLISHED_FROM=f7d582421a8d7e4d1ed50a280f2670d8b62f8d45
1 parent e1ae332 commit f73eae6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/esp32/libethernet.a

2.52 KB
Binary file not shown.

src/esp32/esp32_eth.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616

1717
static void eth_config_pins(void) {
1818
phy_rmii_configure_data_interface_pins();
19-
phy_rmii_smi_configure_pins(get_cfg()->eth.mdc_gpio,
20-
get_cfg()->eth.mdio_gpio);
19+
phy_rmii_smi_configure_pins(mgos_sys_config_get_eth_mdc_gpio(),
20+
mgos_sys_config_get_eth_mdio_gpio());
2121
}
2222

2323
bool mgos_ethernet_init(void) {
24-
struct sys_config_eth *ecfg = &get_cfg()->eth;
25-
if (!ecfg->enable) return true;
24+
if (!mgos_sys_config_get_eth_enable()) return true;
2625

2726
eth_config_t config;
2827
const char *phy_model;
@@ -37,11 +36,12 @@ bool mgos_ethernet_init(void) {
3736
#endif
3837

3938
/* Set the PHY address in the example configuration */
40-
config.phy_addr = ecfg->phy_addr;
39+
config.phy_addr = mgos_sys_config_get_eth_phy_addr();
4140
config.gpio_config = eth_config_pins;
4241
config.tcpip_input = tcpip_adapter_eth_input;
4342

44-
LOG(LL_INFO, ("Eth init: %s PHY @ %d", phy_model, ecfg->phy_addr));
43+
LOG(LL_INFO,
44+
("Eth init: %s PHY @ %d", phy_model, mgos_sys_config_get_eth_phy_addr()));
4545
esp_err_t ret = esp_eth_init(&config);
4646
if (ret == ESP_OK) {
4747
esp_eth_enable();

0 commit comments

Comments
 (0)