From bf7a49b14be84034856b0e16e2180602009c88f4 Mon Sep 17 00:00:00 2001 From: Julien Vanier Date: Wed, 1 Jun 2016 10:40:12 -0400 Subject: [PATCH] Restore the default WICED country to Japan --- hal/src/photon/wlan_hal.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hal/src/photon/wlan_hal.cpp b/hal/src/photon/wlan_hal.cpp index 4ea03ea146..fe46aa1f41 100644 --- a/hal/src/photon/wlan_hal.cpp +++ b/hal/src/photon/wlan_hal.cpp @@ -56,13 +56,17 @@ wiced_country_code_t fetch_country_code() wiced_country_code_t result = wiced_country_code_t(MK_CNTRY(code[0], code[1], hex_nibble(code[2]))); - if (code[0] == 0xFF || code[0] == 0) + + // if Japan explicitly configured, lower tx power for TELEC certification + if (result == WICED_COUNTRY_JAPAN) { - result = WICED_COUNTRY_UNITED_KINGDOM; // default is UK, so channels 1-13 are available by default. + wwd_select_nvram_image_resource(1, nullptr); } - if (result == WICED_COUNTRY_JAPAN) + + // if no country configured, use Japan WiFi config for compatibility with older firmware + if (code[0] == 0xFF || code[0] == 0) { - wwd_select_nvram_image_resource(1, nullptr); // lower tx power for TELEC certification + result = WICED_COUNTRY_JAPAN; } return result; } @@ -75,7 +79,9 @@ bool initialize_dct(platform_dct_wifi_config_t* wifi_config, bool force=false) wifi_config->country_code != country) { if (!wifi_config->device_configured) - memset(wifi_config, 0, sizeof(*wifi_config)); + { + memset(wifi_config, 0, sizeof(*wifi_config)); + } wifi_config->country_code = country; wifi_config->device_configured = WICED_TRUE; changed = true;