mirror of
https://github.com/martin-ger/esp_wifi_repeater.git
synced 2026-10-26 22:10:17 +00:00
WiFi country code added
This commit is contained in:
1 parent
d6534e4c03
commit
1f73415217
11 files changed
+45
-11
No files matched your search
@@ -101,6 +101,7 @@ Any part of a command line input after a single "#" until the end of the line wi
|
||||
- set auto_connect [0|1]: selects, whether the STA should keep retrying to reconnect to the AP. auto_connect is off (0) after first flashing or after "reset factory". When you enter a new SSID it will be automatically set on (1).
|
||||
- set ssid_hidden [0|1]: selects, whether the SSID of the soft-AP is hidden (ssid_hidden=1) or visible (ssid_hidden=0, default)
|
||||
- set phy_mode [1|2|3]: sets the PHY_MODE of the WiFi (1=b, 2=g, 3=n(default))
|
||||
- set country _CC_: sets the WiFi regulatory country code as a 2-letter ISO 3166-1 code (e.g. "US", "DE", "CN", "JP"). Non-US codes unlock channels 12 and 13. Empty (default) leaves the SDK default unchanged. The setting is saved to flash and re-applied on every boot.
|
||||
- set bssid _xx:xx:xx:xx:xx:xx_: sets the specific BSSID of the uplink AP to connect to (default 00:00:00:00:00:00 which means any)
|
||||
- set [ap_mac|sta_mac] _xx:xx:xx:xx:xx:xx_: sets the MAC address of the STA and SOFTAP to a user defined value (bit 0 of the first byte of the MAC address can not be 1)
|
||||
- set sta_mac random: set a new random STA MAC after each reboot
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
18ce3701d67e9bc13b65ce5a16102eb1f21ba1ce firmware/0x02000.bin
|
||||
19f87e4cafb4e9aeaa866cb714637ed05a32df2e firmware/0x82000.bin
|
||||
55f8ed3f25498c5f0ca3f8979176e8e6994e95d2 firmware/0x02000.bin
|
||||
72fdf81d984007fb5a8aada3c1b0767280dab749 firmware/0x82000.bin
|
||||
9bd7d25204d71b3db5f35e0b2def8a6aaa7f765c firmware/0x00000.bin
|
||||
Regular → Executable
File mode changed.
Binary file not shown.
Binary file not shown.
+2
-2
@@ -1,3 +1,3 @@
|
||||
328b8dcff7cca18c63b01a11b079ca62529d5cbc firmware/0x02000.bin
|
||||
20d9a4001a755ad702bbc9996a17afebaa96eeed firmware/0x82000.bin
|
||||
b05bd9ddf02b481b1091d1ad01dd6da6151fdb30 firmware/0x02000.bin
|
||||
8024f70b10e9af7c791f1070809f87706774f7f1 firmware/0x82000.bin
|
||||
9bd7d25204d71b3db5f35e0b2def8a6aaa7f765c firmware/0x00000.bin
|
||||
@@ -156,6 +156,7 @@ typedef struct {
|
||||
gpio_trigger_type gpio_trigger_type[17];
|
||||
uint8_t gpio_trigger_pin[17];
|
||||
#endif
|
||||
char country_code[3]; // ISO 3166-1 alpha-2 (e.g. "US","DE","CN"); empty = SDK default
|
||||
} sysconfig_t, *sysconfig_p;
|
||||
|
||||
int config_load(sysconfig_p config);
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#ifndef _USER_CONFIG_
|
||||
#define _USER_CONFIG_
|
||||
|
||||
#define ESP_REPEATER_VERSION "V2.2.17"
|
||||
#define ESP_REPEATER_VERSION "V2.2.18"
|
||||
|
||||
#define LOCAL_ACCESS 0x01
|
||||
#define REMOTE_ACCESS 0x02
|
||||
|
||||
+38
-6
@@ -1288,6 +1288,7 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
|
||||
int16_t i;
|
||||
struct portmap_table *p;
|
||||
ip_addr_t i_ip;
|
||||
enum phy_mode phy;
|
||||
|
||||
if (nTokens == 1 || (nTokens == 2 && strcmp(tokens[1], "config") == 0))
|
||||
{
|
||||
@@ -1461,6 +1462,14 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
|
||||
to_console(response);
|
||||
}
|
||||
#endif
|
||||
#if PHY_MODE
|
||||
phy = wifi_get_phy_mode();
|
||||
os_sprintf(response, "Phy mode: %c\r\n", phy == PHY_MODE_11B ? 'b' : phy == PHY_MODE_11G ? 'g' : 'n');
|
||||
to_console(response);
|
||||
#endif
|
||||
os_sprintf(response, "Country: %s\r\n",
|
||||
config.country_code[0] ? config.country_code : "none");
|
||||
to_console(response);
|
||||
goto command_handled_2;
|
||||
}
|
||||
|
||||
@@ -1468,7 +1477,6 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
|
||||
{
|
||||
uint32_t time = (uint32_t)(get_long_systime() / 1000000);
|
||||
int16_t i;
|
||||
enum phy_mode phy;
|
||||
|
||||
os_sprintf(response, "System uptime: %d:%02d:%02d\r\n", time / 3600, (time % 3600) / 60, time % 60);
|
||||
to_console(response);
|
||||
@@ -1494,11 +1502,6 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
|
||||
#ifdef USER_GPIO_OUT
|
||||
os_sprintf(response, "GPIO output status: %d\r\n", config.gpio_out_status);
|
||||
to_console(response);
|
||||
#endif
|
||||
#if PHY_MODE
|
||||
phy = wifi_get_phy_mode();
|
||||
os_sprintf(response, "Phy mode: %c\r\n", phy == PHY_MODE_11B ? 'b' : phy == PHY_MODE_11G ? 'g' : 'n');
|
||||
to_console(response);
|
||||
#endif
|
||||
os_sprintf(response, "Free mem: %d\r\n", system_get_free_heap_size());
|
||||
to_console(response);
|
||||
@@ -2809,6 +2812,24 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
|
||||
goto command_handled;
|
||||
}
|
||||
#endif
|
||||
if (strcmp(tokens[1], "country") == 0)
|
||||
{
|
||||
if (nTokens < 3 || os_strlen(tokens[2]) != 2)
|
||||
{
|
||||
os_sprintf_flash(response, "Usage: set country <2-letter-code> (e.g. US, DE, CN)\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
config.country_code[0] = tokens[2][0] >= 'a' && tokens[2][0] <= 'z'
|
||||
? tokens[2][0] - 32 : tokens[2][0];
|
||||
config.country_code[1] = tokens[2][1] >= 'a' && tokens[2][1] <= 'z'
|
||||
? tokens[2][1] - 32 : tokens[2][1];
|
||||
config.country_code[2] = '\0';
|
||||
os_sprintf(response, "Country code set to %s\r\n", config.country_code);
|
||||
}
|
||||
goto command_handled;
|
||||
}
|
||||
|
||||
if (strcmp(tokens[1], "max_nat") == 0)
|
||||
{
|
||||
config.max_nat = atoi(tokens[2]);
|
||||
@@ -4564,6 +4585,17 @@ void ICACHE_FLASH_ATTR user_init()
|
||||
#if PHY_MODE
|
||||
wifi_set_phy_mode(config.phy_mode);
|
||||
#endif
|
||||
if ((config.country_code[0] >= 'A' && config.country_code[0] <= 'Z') &&
|
||||
(config.country_code[1] >= 'A' && config.country_code[1] <= 'Z'))
|
||||
{
|
||||
wifi_country_t country;
|
||||
os_memcpy(country.cc, config.country_code, 2);
|
||||
country.cc[2] = '\0';
|
||||
country.schan = 1;
|
||||
country.nchan = 13;
|
||||
country.policy = WIFI_COUNTRY_POLICY_MANUAL;
|
||||
wifi_set_country(&country);
|
||||
}
|
||||
|
||||
if (config.my_addr.addr != 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user