Skip to content

Commit

Permalink
Merge pull request #36 from pzbitskiy/pavel/static-ip
Browse files Browse the repository at this point in the history
Support static IP configuration
  • Loading branch information
dzungpv authored Aug 28, 2024
2 parents b6255a2 + 40ec47b commit 6c22df6
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 12 deletions.
6 changes: 6 additions & 0 deletions main/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ String ap_ssid;
String ap_pwd;
String ota_pwd;

// WiFi static addresses
String wifi_static_ip;
String wifi_static_gateway_ip;
String wifi_static_subnet;
String wifi_static_dns_ip;

// time and time zone
String ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 3600;
Expand Down
29 changes: 26 additions & 3 deletions main/htmls/html_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

const char html_init_setup[] PROGMEM = ""
"<div style='text-align:center;'>"
"<h2>_TXT_INIT_TITLE_</h2>"
Expand Down Expand Up @@ -41,6 +41,29 @@ const char html_init_setup[] PROGMEM = ""
"<br/>"
"<input type='password' id='psk' name='psk' placeholder=' '>"
"</p>"
"<details>"
"<summary>Network static IP config</summary>"
"<p><b>_TXT_WIFI_STATIC_IP_</b>"
"<br/>"
"<input type='text' id='stip' name='stip' placeholder=' ' value='_WIFI_STATIC_IP_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_GW_</b>"
"<br/>"
"<input type='text' id='stgw' name='stgw' placeholder=' ' value='_WIFI_STATIC_GW_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_MASK_</b>"
"<br/>"
"<input type='text' id='stmask' name='stmask' placeholder='255.255.255.0' value='_WIFI_STATIC_MASK_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_DNS_</b>"
"<br/>"
"<input type='text' id='stdns' name='stdns' placeholder=' ' value='_WIFI_STATIC_DNS_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"</details>"
"</fieldset>"
"<fieldset>"
"<legend><b>&nbsp; _TXT_MQTT_TITLE_ &nbsp;</b><br/></legend>"
Expand Down Expand Up @@ -71,12 +94,12 @@ const char html_init_setup[] PROGMEM = ""
"</form>"
"</div>";

const char html_init_save[] PROGMEM =
const char html_init_save[] PROGMEM =
"<p>_TXT_INIT_REBOOT_MES_"
" <b>_CONFIG_ADDR_</b>"
"<br>"
"_TXT_INIT_REBOOT_MES_1_"
" <span id='count'>10s</span>...</p>";

const char html_init_reboot[] PROGMEM =
const char html_init_reboot[] PROGMEM =
"<p>_TXT_INIT_REBOOT_</p>";
21 changes: 21 additions & 0 deletions main/htmls/html_pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,27 @@ const char html_page_wifi[] PROGMEM =
"<input type='password' id='otapwd' name='otapwd' placeholder=' ' value='_OTA_PWD_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>Network static IP config</b></p>"
"<p><b>_TXT_WIFI_STATIC_IP_</b>"
"<br/>"
"<input type='text' id='stip' name='stip' placeholder=' ' value='_WIFI_STATIC_IP_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_GW_</b>"
"<br/>"
"<input type='text' id='stgw' name='stgw' placeholder=' ' value='_WIFI_STATIC_GW_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_MASK_</b>"
"<br/>"
"<input type='text' id='stmask' name='stmask' placeholder='255.255.255.0' value='_WIFI_STATIC_MASK_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<p><b>_TXT_WIFI_STATIC_DNS_</b>"
"<br/>"
"<input type='text' id='stdns' name='stdns' placeholder=' ' value='_WIFI_STATIC_DNS_' "
"autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false'>"
"</p>"
"<br/>"
"<button name='save' type='submit' class='button bgrn'>_TXT_SAVE_</button>"
"</form>"
Expand Down
5 changes: 5 additions & 0 deletions main/language_translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ MAKE_WORD_TRANSLATION(txt_wifi_ssid_enter, en::txt_wifi_ssid_enter, vi::txt_wifi
MAKE_WORD_TRANSLATION(txt_wifi_ssid_select, en::txt_wifi_ssid_select, vi::txt_wifi_ssid_select, da::txt_wifi_ssid_select, de::txt_wifi_ssid_select, es::txt_wifi_ssid_select, fr::txt_wifi_ssid_select, it::txt_wifi_ssid_select, ja::txt_wifi_ssid_select, zh::txt_wifi_ssid_select, ca::txt_wifi_ssid_select) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_psk, en::txt_wifi_psk, vi::txt_wifi_psk, da::txt_wifi_psk, de::txt_wifi_psk, es::txt_wifi_psk, fr::txt_wifi_psk, it::txt_wifi_psk, ja::txt_wifi_psk, zh::txt_wifi_psk, ca::txt_wifi_psk) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_otap, en::txt_wifi_otap, vi::txt_wifi_otap, da::txt_wifi_otap, de::txt_wifi_otap, es::txt_wifi_otap, fr::txt_wifi_otap, it::txt_wifi_otap, ja::txt_wifi_otap, zh::txt_wifi_otap, ca::txt_wifi_otap) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_static_ip, en::txt_wifi_static_ip, vi::txt_wifi_static_ip, da::txt_wifi_static_ip, de::txt_wifi_static_ip, es::txt_wifi_static_ip, fr::txt_wifi_static_ip, it::txt_wifi_static_ip, ja::txt_wifi_static_ip, zh::txt_wifi_static_ip, ca::txt_wifi_static_ip) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_static_gw, en::txt_wifi_static_gw, vi::txt_wifi_static_gw, da::txt_wifi_static_gw, de::txt_wifi_static_gw, es::txt_wifi_static_gw, fr::txt_wifi_static_gw, it::txt_wifi_static_gw, ja::txt_wifi_static_gw, zh::txt_wifi_static_gw, ca::txt_wifi_static_gw) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_static_mask, en::txt_wifi_static_mask, vi::txt_wifi_static_mask, da::txt_wifi_static_mask, de::txt_wifi_static_mask, es::txt_wifi_static_mask, fr::txt_wifi_static_mask, it::txt_wifi_static_mask, ja::txt_wifi_static_mask, zh::txt_wifi_static_mask, ca::txt_wifi_static_mask) // TODO translate
MAKE_WORD_TRANSLATION(txt_wifi_static_dns, en::txt_wifi_static_dns, vi::txt_wifi_static_dns, da::txt_wifi_static_dns, de::txt_wifi_static_dns, es::txt_wifi_static_dns, fr::txt_wifi_static_dns, it::txt_wifi_static_dns, ja::txt_wifi_static_dns, zh::txt_wifi_static_dns, ca::txt_wifi_static_dns) // TODO translate


// Page Control
MAKE_WORD_TRANSLATION(txt_ctrl_title, en::txt_ctrl_title, vi::txt_ctrl_title, da::txt_ctrl_title, de::txt_ctrl_title, es::txt_ctrl_title, fr::txt_ctrl_title, it::txt_ctrl_title, ja::txt_ctrl_title, zh::txt_ctrl_title, ca::txt_ctrl_title) // TODO translate
Expand Down
4 changes: 4 additions & 0 deletions main/languages/ca-ES.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace ca
const char txt_wifi_ssid_select[] PROGMEM = "o trieu una xarxa:";
const char txt_wifi_psk[] PROGMEM = "Contrasenya Wifi";
const char txt_wifi_otap[] PROGMEM = "Contrasenya OTA";
const char txt_wifi_static_ip[] PROGMEM = "Adreça IP estàtica";
const char txt_wifi_static_gw[] PROGMEM = "Adreça de passarel·la";
const char txt_wifi_static_mask[] PROGMEM = "Màscara de xarxa";
const char txt_wifi_static_dns[] PROGMEM = "Adreça IP DNS";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Control climatització";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/da-DA.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ namespace da
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Control Unit";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/de-DE.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ namespace de
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Kontrolleinheit";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/en-GB.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace en
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_psk[] PROGMEM = "Wifi Password";
const char txt_wifi_otap[] PROGMEM = "OTA Password";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Control Unit";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/es-ES.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace es
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Dirección IP estática";
const char txt_wifi_static_gw[] PROGMEM = "Dirección de puerta de enlace";
const char txt_wifi_static_mask[] PROGMEM = "Máscara de red";
const char txt_wifi_static_dns[] PROGMEM = "Dirección IP DNS";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Control del aparato";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/fr-FR.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace fr
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Adresse IP statique";
const char txt_wifi_static_gw[] PROGMEM = "Adresse de la passerelle";
const char txt_wifi_static_mask[] PROGMEM = "Masque de réseau";
const char txt_wifi_static_dns[] PROGMEM = "Adresse IP DNS";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Contrôle climatiseur";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/it-IT.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace it
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Controllo Unità";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/ja-JP.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace ja
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "エアコン操作";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/vi-VN.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace vi
const char txt_wifi_ssid_select[] PROGMEM = "hoặc chọn 1 mạng:";
const char txt_wifi_psk[] PROGMEM = "Mật khẩu Wifi";
const char txt_wifi_otap[] PROGMEM = "Mật khẩu OTA";
const char txt_wifi_static_ip[] PROGMEM = "Địa chỉ IP tĩnh";
const char txt_wifi_static_gw[] PROGMEM = "Địa chỉ cổng";
const char txt_wifi_static_mask[] PROGMEM = "Mặt nạ mạng";
const char txt_wifi_static_dns[] PROGMEM = "Địa chỉ IP DNS";

// Page Control
const char txt_ctrl_title[] PROGMEM = "Điều khiển Thiết bị";
Expand Down
4 changes: 4 additions & 0 deletions main/languages/zh-CN.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace zh
const char txt_wifi_hostname_desc[] PROGMEM = "(no space or special char)";
const char txt_wifi_ssid_enter[] PROGMEM = "(Enter a name)";
const char txt_wifi_ssid_select[] PROGMEM = "or choose a network:";
const char txt_wifi_static_ip[] PROGMEM = "Static IP address";
const char txt_wifi_static_gw[] PROGMEM = "Gateway address";
const char txt_wifi_static_mask[] PROGMEM = "Network mask";
const char txt_wifi_static_dns[] PROGMEM = "DNS IP address";

// Page Control
const char txt_ctrl_title[] PROGMEM = "控制单元";
Expand Down
Loading

0 comments on commit 6c22df6

Please sign in to comment.