Skip to content

Instantly share code, notes, and snippets.

@tablatronix
Last active July 2, 2018 14:42
Show Gist options
  • Save tablatronix/daf673f210b7833953e36313de29f06d to your computer and use it in GitHub Desktop.
Save tablatronix/daf673f210b7833953e36313de29f06d to your computer and use it in GitHub Desktop.
esp32_wifi_set_country
// typedef enum {
// WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */
// WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
// } WIFI_COUNTRY_POLICY;
// typedef struct {
// char cc[3]; /**< country code string */
// uint8_t schan; /**< start channel */
// uint8_t nchan; /**< total channel number */
// uint8_t policy; /**< country policy */
// } wifi_country_t;
WiFi.mode(WIFI_STA);
const wifi_country_t COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO};
const wifi_country_t COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO};
const wifi_country_t COUNTRY_JP{"JP",1,14,WIFI_COUNTRY_POLICY_AUTO};
esp_wifi_set_country(&COUNTRY_US);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment