Use integer network setting to avoid string comparison.

This commit is contained in:
mattbk 2023-09-25 21:53:20 -05:00
parent 7fc43238cd
commit 5e3503b497

View File

@ -34,8 +34,8 @@ const int blinker = LED_BUILTIN;
RTC_DS3231 rtc; // set up RTC
const int alarmPin = 4; // pin to monitor for RTC alarms
// Network options: "wifi" for existing netowrk, "ap" to be an access point
const char* network = "ap";
// Network options: "0" for existing netowrk, "1" to be an access point
const int network = 1;
// Connect to existing network
// Read from config.h
const char* ssid = WIFI_SSID;
@ -358,7 +358,7 @@ void setup() {
}
WiFi.setHostname("vulpes");
if (network == "wifi"){
if (network == 0){
// Attach to existing wifi
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
@ -369,7 +369,7 @@ void setup() {
Serial.println();
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
} else if (network == "ap"){
} else if (network == 1){
// Act as new access point
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(ssid_ap, password_ap);