using wifi cred. from cmake

This commit is contained in:
Martin Brodbeck 2023-01-05 10:34:27 +01:00
parent 4227a33c9e
commit 32d24c3712
2 changed files with 6 additions and 4 deletions

View file

@ -33,6 +33,8 @@ target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
SNTP_STARTUP_DELAY=0
SNTP_SET_SYSTEM_TIME=set_system_time
SNTP_UPDATE_DELAY=86400
WLAN_SSID="<YOUR SSID>"
WLAN_PW="<YOUR PW>"
)
set_target_properties(${CMAKE_PROJECT_NAME}

View file

@ -160,22 +160,22 @@ int wifi_setup(uint32_t country, const string &ssid, const string &pw, bool firs
}
void wifi_enable() {
const string ssid{"Apis cerana"};
const string pw{"2JkJEh2vptVT"};
const uint32_t country{CYW43_COUNTRY_GERMANY};
bool firstTry = true;
int res = -1;
do {
if (firstTry) {
res = wifi_setup(country, ssid, pw, true);
res = wifi_setup(country, WLAN_SSID, WLAN_PW,
true); // WLAN_SSID and WLAN_PW come from CMakeLists.txt
firstTry = false;
} else {
#ifdef DEBUG
printf("Setting up connection failed. Trying again after 5 sec...\n");
#endif
sleep_ms(5000);
res = wifi_setup(country, ssid, pw, false);
res = wifi_setup(country, WLAN_SSID, WLAN_PW,
false); // WLAN_SSID and WLAN_PW come from CMakeLists.txt
}
} while (res != CYW43_LINK_UP);