modbus backend added
This commit is contained in:
parent
7b8c611c74
commit
b944c8905d
20
Kconfig
20
Kconfig
|
|
@ -762,6 +762,26 @@ menu "WebGUIApp"
|
|||
endif
|
||||
endmenu
|
||||
|
||||
menu "Modbus settings"
|
||||
config WEBGUIAPP_MBTCP_ENABLED
|
||||
bool "Enabled modbus TCP"
|
||||
default n
|
||||
help
|
||||
Set enabled Modbus TCP
|
||||
|
||||
if WEBGUIAPP_MBTCP_ENABLED
|
||||
config WEBGUIAPP_MBTCP_ON
|
||||
bool "Default modbus TCP switched on"
|
||||
default y
|
||||
|
||||
config WEBGUIAPP_MBTCP_SERVER_PORT
|
||||
int "Modbus TCP server port"
|
||||
range 1 65535
|
||||
default 502
|
||||
endif
|
||||
endmenu
|
||||
|
||||
|
||||
|
||||
menu "MQTT settings"
|
||||
config WEBGUIAPP_MQTT_ENABLE
|
||||
|
|
|
|||
|
|
@ -201,6 +201,13 @@ typedef struct
|
|||
|
||||
} lorawanSettings;
|
||||
|
||||
struct
|
||||
{
|
||||
bool IsModbusTCPEnabled;
|
||||
int ModbusTCPPort;
|
||||
|
||||
} modbusSettings;
|
||||
|
||||
|
||||
} SYS_CONFIG;
|
||||
|
||||
|
|
|
|||
|
|
@ -425,8 +425,16 @@ const rest_var_t SystemVariables[] =
|
|||
{ 0, "lora_visible", (bool*) (&VAR_FALSE), VAR_BOOL, RW, 0, 1 },
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WEBGUIAPP_MBTCP_ENABLED
|
||||
{ 0, "mbtcp_enab", &SysConfig.modbusSettings.IsModbusTCPEnabled, VAR_BOOL, RW, 0, 1 },
|
||||
{ 0, "mbtcp_port", &SysConfig.modbusSettings.ModbusTCPPort, VAR_INT, RW, 1, 65534 },
|
||||
{ 0, "mbtcp_visible", (bool*) (&VAR_TRUE), VAR_BOOL, RW, 0, 1 },
|
||||
#else
|
||||
{ 0, "mbtcp_visible", (bool*) (&VAR_FALSE), VAR_BOOL, RW, 0, 1 },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
esp_err_t SetConfVar(char *name, char *val, rest_var_types *tp)
|
||||
{
|
||||
rest_var_t *V = NULL;
|
||||
|
|
|
|||
|
|
@ -385,6 +385,14 @@ esp_netif_str_to_ip4(CONFIG_WEBGUIAPP_DNS3_ADDRESS_DEFAULT, (esp_ip4_addr_t*) &C
|
|||
memcpy(Conf->lorawanSettings.AppEui, temp, 8);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WEBGUIAPP_MBTCP_ENABLED
|
||||
Conf->modbusSettings.IsModbusTCPEnabled = false;
|
||||
#if CONFIG_WEBGUIAPP_MBTCP_ON == 1
|
||||
Conf->modbusSettings.IsModbusTCPEnabled = true;
|
||||
#endif
|
||||
Conf->modbusSettings.ModbusTCPPort = CONFIG_WEBGUIAPP_MBTCP_SERVER_PORT;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
esp_err_t ReadNVSSysConfig(SYS_CONFIG *SysConf)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user