From 381b25860aaf21dbe7be1ca9b5b9087d5496c16d Mon Sep 17 00:00:00 2001 From: Gregg Date: Sun, 27 Sep 2020 22:52:03 -0500 Subject: [PATCH] Moved default parameters for homeSpan.begin() to Settings.h --- src/HomeSpan.h | 12 ++++++------ src/Settings.h | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 2c27fdd..d7bdc68 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -50,9 +50,9 @@ struct Span{ char category[3]=""; // category ID of primary accessory - broadcast as Bonjour field "ci" (HAP Section 13) unsigned long snapTime; // current time (in millis) snapped before entering Service loops() or updates() - char *defaultSetupCode=DEFAULT_SETUP_CODE; // default configuration parameters - uint8_t statusPin=DEFAULT_STATUS_PIN; - uint8_t controlPin=DEFAULT_CONTROL_PIN; + char *defaultSetupCode=DEFAULT_SETUP_CODE; // Setup Code used for pairing + uint8_t statusPin=DEFAULT_STATUS_PIN; // pin for status LED + uint8_t controlPin=DEFAULT_CONTROL_PIN; // pin for Control Pushbutton Blinker statusLED; // indicates HomeSpan status PushButton controlButton; // controls HomeSpan configuration and resets @@ -66,9 +66,9 @@ struct Span{ unordered_map TimedWrites; // map of timed-write PIDs and Alarm Times (based on TTLs) void begin(Category catID, - char *displayName="HomeSpan Server", - char *hostNameBase="HomeSpan", - char *modelName="HS-ESP32"); + char *displayName=DEFAULT_DISPLAY_NAME, + char *hostNameBase=DEFAULT_HOST_NAME, + char *modelName=DEFAULT_MODEL_NAME); void poll(); // poll HAP Clients and process any new HAP requests int getFreeSlot(); // returns free HAPClient slot number. HAPClients slot keep track of each active HAPClient connection diff --git a/src/Settings.h b/src/Settings.h index 082a7fc..339a4c2 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -11,11 +11,18 @@ ////////////////////////////////////////////////////// // DEFAULT SETTINGS -#define DEFAULT_SETUP_CODE "46637726" // changed during network setup or with 'S' command -#define DEFAULT_CONTROL_PIN 21 // change with homeSpan.setControlPin(pin) -#define DEFAULT_STATUS_PIN LED_BUILTIN // change with homeSpan.setStatusPin(pin) -#define DEFAULT_AP_PASSWORD "homespan" // change with homeSpan.setApPassword(pwd) -#define DEFAULT_AP_TIMEOUT 120 // change with homeSpan.setApTimeout(nSeconds) +#define DEFAULT_DISPLAY_NAME "HomeSpan Server" // change with optional second argument in homeSpan.begin() +#define DEFAULT_HOST_NAME "HomeSpan" // change with optional third argument in homeSpan.begin() +#define DEFAULT_MODEL_NAME "HomeSpan-ESP32" // change with optional fourth argument in homeSpan.begin() + +#define DEFAULT_SETUP_CODE "46637726" // changed during network setup or with 'S' command + +#define DEFAULT_CONTROL_PIN 21 // change with homeSpan.setControlPin(pin) +#define DEFAULT_STATUS_PIN LED_BUILTIN // change with homeSpan.setStatusPin(pin) + +#define DEFAULT_AP_PASSWORD "homespan" // change with homeSpan.setApPassword(pwd) + +#define DEFAULT_AP_TIMEOUT 120 // change with homeSpan.setApTimeout(nSeconds) ////////////////////////////////////////////////////// // Maximum number of simultaenous IP connections //