diff --git a/src/HAP.cpp b/src/HAP.cpp index 102e382..01536ba 100644 --- a/src/HAP.cpp +++ b/src/HAP.cpp @@ -40,13 +40,13 @@ void HAPClient::init(){ size_t len; // not used but required to read blobs from NVS - if(strlen(homeSpan.spanOTA.otaPwd)==0){ // OTA password has not been specified in sketch - if(!nvs_get_str(homeSpan.otaNVS,"OTADATA",NULL,&len)){ // if found OTA data in NVS... - nvs_get_str(homeSpan.otaNVS,"OTADATA",homeSpan.spanOTA.otaPwd,&len); // ...retrieve data. - } else { // otherwise... - homeSpan.spanOTA.setPassword(DEFAULT_OTA_PASSWORD); // ...use default password - } - } +// if(strlen(homeSpan.spanOTA.otaPwd)==0){ // OTA password has not been specified in sketch +// if(!nvs_get_str(homeSpan.otaNVS,"OTADATA",NULL,&len)){ // if found OTA data in NVS... +// nvs_get_str(homeSpan.otaNVS,"OTADATA",homeSpan.spanOTA.otaPwd,&len); // ...retrieve data. +// } else { // otherwise... +// homeSpan.spanOTA.setPassword(DEFAULT_OTA_PASSWORD); // ...use default password +// } +// } if(!strlen(homeSpan.qrID)){ // if Setup ID has not been specified in sketch if(!nvs_get_str(homeSpan.hapNVS,"SETUPID",NULL,&len)){ // check for saved value @@ -1555,7 +1555,7 @@ HapOut::HapStreamBuffer::HapStreamBuffer(){ ctx = (mbedtls_sha512_context *)heap_caps_malloc(sizeof(mbedtls_sha512_context),caps); // space for hash context mbedtls_sha512_init(ctx); // initialize context - mbedtls_sha512_starts_ret(ctx,1); // start SHA-384 hash (note second argument=1) + mbedtls_sha512_starts(ctx,1); // start SHA-384 hash (note second argument=1) setp(buffer, buffer+bufSize-1); // assign buffer pointers } @@ -1607,7 +1607,7 @@ void HapOut::HapStreamBuffer::flushBuffer(){ delay(1); } - mbedtls_sha512_update_ret(ctx,(uint8_t *)buffer,num); // update hash + mbedtls_sha512_update(ctx,(uint8_t *)buffer,num); // update hash pbump(-num); // reset buffer pointers } @@ -1643,8 +1643,8 @@ int HapOut::HapStreamBuffer::sync(){ callBackUserData=NULL; } - mbedtls_sha512_finish_ret(ctx,hash); // finish SHA-384 and store hash - mbedtls_sha512_starts_ret(ctx,1); // re-start hash for next time + mbedtls_sha512_finish(ctx,hash); // finish SHA-384 and store hash + mbedtls_sha512_starts(ctx,1); // re-start hash for next time return(0); } diff --git a/src/HAP.h b/src/HAP.h index 9532741..86ed487 100644 --- a/src/HAP.h +++ b/src/HAP.h @@ -118,7 +118,7 @@ struct HAPClient { // individual structures and data defined for each Hap Client connection - WiFiClient client; // handle to client + NetworkClient client; // handle to client int clientNumber; // client number Controller *cPair=NULL; // pointer to info on current, session-verified Paired Controller (NULL=un-verified, and therefore un-encrypted, connection) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 3ed0421..a18b648 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -87,7 +87,7 @@ void Span::begin(Category catID, const char *_displayName, const char *_hostName statusLED=new Blinker(statusDevice,autoOffLED); // create Status LED, even is statusDevice is NULL - esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(0)); // required to avoid watchdog timeout messages from ESP32-C3 +//D esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(0)); // required to avoid watchdog timeout messages from ESP32-C3 hapServer=new WiFiServer(tcpPortNum); // create HAP WIFI SERVER @@ -147,7 +147,7 @@ void Span::begin(Category catID, const char *_displayName, const char *_hostName LOG0("\nSketch Compiled: %s %s",__DATE__,__TIME__); LOG0("\nPartition: %s",esp_ota_get_running_partition()->label); - LOG0("\nMAC Address: %s",WiFi.macAddress().c_str()); + LOG0("\nMAC Address: %s",Network.macAddress().c_str()); LOG0("\n\nDevice Name: %s\n\n",displayName); @@ -155,11 +155,11 @@ void Span::begin(Category catID, const char *_displayName, const char *_hostName nvs_get_u8(otaNVS,"OTA_REQUIRED",&otaRequired); nvs_set_u8(otaNVS,"OTA_REQUIRED",0); nvs_commit(otaNVS); - if(otaRequired && !spanOTA.enabled){ - LOG0("\n\n*** OTA SAFE MODE ALERT: OTA REQUIRED BUT NOT ENABLED. ROLLING BACK TO PREVIOUS APPLICATION ***\n\n"); - delay(100); - esp_ota_mark_app_invalid_rollback_and_reboot(); - } +// if(otaRequired && !spanOTA.enabled){ +// LOG0("\n\n*** OTA SAFE MODE ALERT: OTA REQUIRED BUT NOT ENABLED. ROLLING BACK TO PREVIOUS APPLICATION ***\n\n"); +// delay(100); +// esp_ota_mark_app_invalid_rollback_and_reboot(); +// } } // begin @@ -268,8 +268,8 @@ void Span::pollTask() { HAPClient::checkNotifications(); HAPClient::checkTimedWrites(); - if(spanOTA.enabled) - ArduinoOTA.handle(); +//D if(spanOTA.enabled) +//D ArduinoOTA.handle(); if(controlButton && controlButton->primed()) STATUS_UPDATE(start(LED_ALERT),HS_ENTERING_CONFIG_MODE) @@ -472,24 +472,24 @@ void Span::checkConnect(){ memcpy(hashInput,qrID,4); // Create the Setup ID for use with optional QR Codes. This is an undocumented feature of HAP R2! memcpy(hashInput+4,id,17); // Step 1: Concatenate 4-character Setup ID and 17-character Accessory ID into hashInput - mbedtls_sha512_ret(hashInput,21,hashOutput,0); // Step 2: Perform SHA-512 hash on combined 21-byte hashInput to create 64-byte hashOutput + mbedtls_sha512(hashInput,21,hashOutput,0); // Step 2: Perform SHA-512 hash on combined 21-byte hashInput to create 64-byte hashOutput mbedtls_base64_encode((uint8_t *)setupHash,9,&len,hashOutput,4); // Step 3: Encode the first 4 bytes of hashOutput in base64, which results in an 8-character, null-terminated, setupHash mdns_service_txt_item_set("_hap","_tcp","sh",setupHash); // Step 4: broadcast the resulting Setup Hash - if(spanOTA.enabled){ - ArduinoOTA.setHostname(hostName); - - if(spanOTA.auth) - ArduinoOTA.setPasswordHash(spanOTA.otaPwd); - - ArduinoOTA.onStart(spanOTA.start).onEnd(spanOTA.end).onProgress(spanOTA.progress).onError(spanOTA.error); - - ArduinoOTA.begin(); - LOG0("Starting OTA Server: %s at %s\n",displayName,WiFi.localIP().toString().c_str()); - LOG0("Authorization Password: %s",spanOTA.auth?"Enabled\n\n":"DISABLED!\n\n"); - } +// if(spanOTA.enabled){ +// ArduinoOTA.setHostname(hostName); +// +// if(spanOTA.auth) +// ArduinoOTA.setPasswordHash(spanOTA.otaPwd); +// +// ArduinoOTA.onStart(spanOTA.start).onEnd(spanOTA.end).onProgress(spanOTA.progress).onError(spanOTA.error); +// +// ArduinoOTA.begin(); +// LOG0("Starting OTA Server: %s at %s\n",displayName,WiFi.localIP().toString().c_str()); +// LOG0("Authorization Password: %s",spanOTA.auth?"Enabled\n\n":"DISABLED!\n\n"); +// } - mdns_service_txt_item_set("_hap","_tcp","ota",spanOTA.enabled?"yes":"no"); // OTA status (info only - NOT used by HAP) +//D mdns_service_txt_item_set("_hap","_tcp","ota",spanOTA.enabled?"yes":"no"); // OTA status (info only - NOT used by HAP) if(webLog.isEnabled){ mdns_service_txt_item_set("_hap","_tcp","logURL",webLog.statusURL.c_str()+4); // Web Log status (info only - NOT used by HAP) @@ -608,34 +608,34 @@ void Span::processSerialCommand(const char *c){ } break; - case 'O': { - - char textPwd[34]="\0"; - - LOG0("\n>>> New OTA Password, or to cancel request: "); - readSerial(textPwd,33); - - if(strlen(textPwd)==0){ - LOG0("(cancelled)\n\n"); - return; - } - - if(strlen(textPwd)==33){ - LOG0("\n*** Sorry, 32 character limit - request cancelled\n\n"); - return; - } - - LOG0("%s\n",mask(textPwd,2).c_str()); - spanOTA.setPassword(textPwd); - nvs_set_str(otaNVS,"OTADATA",spanOTA.otaPwd); // update data - nvs_commit(otaNVS); - - LOG0("... Accepted! Password change will take effect after next restart.\n"); - if(!spanOTA.enabled) - LOG0("... Note: OTA has not been enabled in this sketch.\n"); - LOG0("\n"); - } - break; +// case 'O': { +// +// char textPwd[34]="\0"; +// +// LOG0("\n>>> New OTA Password, or to cancel request: "); +// readSerial(textPwd,33); +// +// if(strlen(textPwd)==0){ +// LOG0("(cancelled)\n\n"); +// return; +// } +// +// if(strlen(textPwd)==33){ +// LOG0("\n*** Sorry, 32 character limit - request cancelled\n\n"); +// return; +// } +// +// LOG0("%s\n",mask(textPwd,2).c_str()); +// spanOTA.setPassword(textPwd); +// nvs_set_str(otaNVS,"OTADATA",spanOTA.otaPwd); // update data +// nvs_commit(otaNVS); +// +// LOG0("... Accepted! Password change will take effect after next restart.\n"); +// if(!spanOTA.enabled) +// LOG0("... Note: OTA has not been enabled in this sketch.\n"); +// LOG0("\n"); +// } +// break; case 'S': { @@ -2457,89 +2457,89 @@ void SpanWebLog::vLog(boolean sysMsg, const char *fmt, va_list ap){ // SpanOTA // /////////////////////////////// -int SpanOTA::init(boolean _auth, boolean _safeLoad, const char *pwd){ - if(esp_ota_get_running_partition()==esp_ota_get_next_update_partition(NULL)){ - LOG0("\n*** WARNING: Can't start OTA Server - Partition table used to compile this sketch is not configured for OTA.\n\n"); - return(-1); - } - - enabled=true; - safeLoad=_safeLoad; - auth=_auth; - if(pwd==NULL) - return(0); - return(setPassword(pwd)); -} - -/////////////////////////////// - -int SpanOTA::setPassword(const char *pwd){ - if(strlen(pwd)<1 || strlen(pwd)>32){ - LOG0("\n*** WARNING: Cannot change OTA password to '%s'. Password length must be between 1 and 32 characters.\n\n",pwd); - return(-1); - } - - MD5Builder otaPwdHash; - otaPwdHash.begin(); - otaPwdHash.add(pwd); - otaPwdHash.calculate(); - otaPwdHash.getChars(homeSpan.spanOTA.otaPwd); - return(0); -} - -/////////////////////////////// - -void SpanOTA::start(){ - LOG0("\n*** Current Partition: %s\n*** New Partition: %s\n*** OTA Starting..", - esp_ota_get_running_partition()->label,esp_ota_get_next_update_partition(NULL)->label); - otaPercent=0; - STATUS_UPDATE(start(LED_OTA_STARTED),HS_OTA_STARTED) -} - -/////////////////////////////// - -void SpanOTA::end(){ - nvs_set_u8(homeSpan.otaNVS,"OTA_REQUIRED",safeLoad); - nvs_commit(homeSpan.otaNVS); - LOG0(" DONE! Rebooting...\n"); - homeSpan.reboot(); -} - -/////////////////////////////// - -void SpanOTA::progress(uint32_t progress, uint32_t total){ - int percent=progress*100/total; - if(percent/10 != otaPercent/10){ - otaPercent=percent; - LOG0("%d%%..",progress*100/total); - } - - if(safeLoad && progress==total){ - SpanPartition newSpanPartition; - esp_partition_read(esp_ota_get_next_update_partition(NULL), sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t), &newSpanPartition, sizeof(newSpanPartition)); - LOG0("Checking for HomeSpan Magic Cookie: %s..",newSpanPartition.magicCookie); - if(strcmp(newSpanPartition.magicCookie,spanPartition.magicCookie)) - Update.abort(); - } -} - -/////////////////////////////// - -void SpanOTA::error(ota_error_t err){ - LOG0("*** OTA Error[%u]: ", err); - if (err == OTA_AUTH_ERROR) LOG0("Auth Failed\n\n"); - else if (err == OTA_BEGIN_ERROR) LOG0("Begin Failed\n\n"); - else if (err == OTA_CONNECT_ERROR) LOG0("Connect Failed\n\n"); - else if (err == OTA_RECEIVE_ERROR) LOG0("Receive Failed\n\n"); - else if (err == OTA_END_ERROR) LOG0("End Failed\n\n"); -} - -/////////////////////////////// - -int SpanOTA::otaPercent; -boolean SpanOTA::safeLoad; -boolean SpanOTA::enabled=false; -boolean SpanOTA::auth; +//int SpanOTA::init(boolean _auth, boolean _safeLoad, const char *pwd){ +// if(esp_ota_get_running_partition()==esp_ota_get_next_update_partition(NULL)){ +// LOG0("\n*** WARNING: Can't start OTA Server - Partition table used to compile this sketch is not configured for OTA.\n\n"); +// return(-1); +// } +// +// enabled=true; +// safeLoad=_safeLoad; +// auth=_auth; +// if(pwd==NULL) +// return(0); +// return(setPassword(pwd)); +//} +// +///////////////////////////////// +// +//int SpanOTA::setPassword(const char *pwd){ +// if(strlen(pwd)<1 || strlen(pwd)>32){ +// LOG0("\n*** WARNING: Cannot change OTA password to '%s'. Password length must be between 1 and 32 characters.\n\n",pwd); +// return(-1); +// } +// +// MD5Builder otaPwdHash; +// otaPwdHash.begin(); +// otaPwdHash.add(pwd); +// otaPwdHash.calculate(); +// otaPwdHash.getChars(homeSpan.spanOTA.otaPwd); +// return(0); +//} +// +///////////////////////////////// +// +//void SpanOTA::start(){ +// LOG0("\n*** Current Partition: %s\n*** New Partition: %s\n*** OTA Starting..", +// esp_ota_get_running_partition()->label,esp_ota_get_next_update_partition(NULL)->label); +// otaPercent=0; +// STATUS_UPDATE(start(LED_OTA_STARTED),HS_OTA_STARTED) +//} +// +///////////////////////////////// +// +//void SpanOTA::end(){ +// nvs_set_u8(homeSpan.otaNVS,"OTA_REQUIRED",safeLoad); +// nvs_commit(homeSpan.otaNVS); +// LOG0(" DONE! Rebooting...\n"); +// homeSpan.reboot(); +//} +// +///////////////////////////////// +// +//void SpanOTA::progress(uint32_t progress, uint32_t total){ +// int percent=progress*100/total; +// if(percent/10 != otaPercent/10){ +// otaPercent=percent; +// LOG0("%d%%..",progress*100/total); +// } +// +// if(safeLoad && progress==total){ +// SpanPartition newSpanPartition; +// esp_partition_read(esp_ota_get_next_update_partition(NULL), sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t), &newSpanPartition, sizeof(newSpanPartition)); +// LOG0("Checking for HomeSpan Magic Cookie: %s..",newSpanPartition.magicCookie); +// if(strcmp(newSpanPartition.magicCookie,spanPartition.magicCookie)) +// Update.abort(); +// } +//} +// +///////////////////////////////// +// +//void SpanOTA::error(ota_error_t err){ +// LOG0("*** OTA Error[%u]: ", err); +// if (err == OTA_AUTH_ERROR) LOG0("Auth Failed\n\n"); +// else if (err == OTA_BEGIN_ERROR) LOG0("Begin Failed\n\n"); +// else if (err == OTA_CONNECT_ERROR) LOG0("Connect Failed\n\n"); +// else if (err == OTA_RECEIVE_ERROR) LOG0("Receive Failed\n\n"); +// else if (err == OTA_END_ERROR) LOG0("End Failed\n\n"); +//} +// +///////////////////////////////// +// +//int SpanOTA::otaPercent; +//boolean SpanOTA::safeLoad; +//boolean SpanOTA::enabled=false; +//boolean SpanOTA::auth; /////////////////////////////// // SpanPoint // @@ -2598,7 +2598,7 @@ void SpanPoint::init(const char *password){ esp_wifi_set_config(WIFI_IF_AP,&conf); uint8_t hash[32]; - mbedtls_sha256_ret((const unsigned char *)password,strlen(password),hash,0); // produce 256-bit bit hash from password + mbedtls_sha256((const unsigned char *)password,strlen(password),hash,0); // produce 256-bit bit hash from password esp_now_init(); // initialize ESP-NOW memcpy(lmk, hash, 16); // store first 16 bytes of hash for later use as local key @@ -2711,7 +2711,8 @@ boolean SpanPoint::send(const void *data){ /////////////////////////////// -void SpanPoint::dataReceived(const uint8_t *mac, const uint8_t *incomingData, int len){ +//void SpanPoint::dataReceived(const uint8_t *mac, const uint8_t *incomingData, int len){ +void SpanPoint::dataReceived(const esp_now_recv_info *mac, const uint8_t *incomingData, int len){ auto it=SpanPoints.begin(); for(;it!=SpanPoints.end() && memcmp((*it)->peerInfo.peer_addr,mac,6)!=0; it++); diff --git a/src/HomeSpan.h b/src/HomeSpan.h index f0376f1..8d9b84a 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -37,19 +37,19 @@ #include #include #include -#include +//D#include #include #include #include "src/extras/Blinker.h" -#include "src/extras/Pixel.h" -#include "src/extras/RFControl.h" -#include "src/extras/PwmPin.h" -#include "src/extras/StepperControl.h" +//D #include "src/extras/Pixel.h" +//D #include "src/extras/RFControl.h" +//D #include "src/extras/PwmPin.h" +//D #include "src/extras/StepperControl.h" #include "Settings.h" #include "Utils.h" -#include "Network.h" +#include "Network_HS.h" #include "HAPConstants.h" #include "HapQR.h" #include "Characteristics.h" @@ -186,22 +186,22 @@ struct SpanWebLog{ // optional web status/log data /////////////////////////////// -struct SpanOTA{ // manages OTA process - - char otaPwd[33]=""; // MD5 Hash of OTA password, represented as a string of hexidecimal characters - - static boolean enabled; // enables OTA - default if not enabled - static boolean auth; // indicates whether OTA password is required - static int otaPercent; - static boolean safeLoad; // indicates whether OTA update should reject any application update that is not another HomeSpan sketch - - int init(boolean auth, boolean safeLoad, const char *pwd); - int setPassword(const char *pwd); - static void start(); - static void end(); - static void progress(uint32_t progress, uint32_t total); - static void error(ota_error_t err); -}; +//struct SpanOTA{ // manages OTA process +// +// char otaPwd[33]=""; // MD5 Hash of OTA password, represented as a string of hexidecimal characters +// +// static boolean enabled; // enables OTA - default if not enabled +// static boolean auth; // indicates whether OTA password is required +// static int otaPercent; +// static boolean safeLoad; // indicates whether OTA update should reject any application update that is not another HomeSpan sketch +// +// int init(boolean auth, boolean safeLoad, const char *pwd); +// int setPassword(const char *pwd); +// static void start(); +// static void end(); +// static void progress(uint32_t progress, uint32_t total); +// static void error(ota_error_t err); +//}; ////////////////////////////////////// // USER API CLASSES BEGINS HERE // @@ -216,7 +216,7 @@ class Span{ friend class SpanButton; friend class SpanWebLog; friend class SpanOTA; - friend class Network; + friend class Network_HS; friend class HAPClient; char *displayName; // display name for this device - broadcast as part of Bonjour MDNS @@ -267,13 +267,13 @@ class Span{ Blinker *statusLED; // indicates HomeSpan status Blinkable *statusDevice = NULL; // the device used for the Blinker PushButton *controlButton = NULL; // controls HomeSpan configuration and resets - Network network; // configures WiFi and Setup Code via either serial monitor or temporary Access Point + Network_HS network; // configures WiFi and Setup Code via either serial monitor or temporary Access Point SpanWebLog webLog; // optional web status/log TaskHandle_t pollTaskHandle = NULL; // optional task handle to use for poll() function TaskHandle_t loopTaskHandle; // Arduino Loop Task handle boolean verboseWifiReconnect = true; // set to false to not print WiFi reconnect attempts messages - SpanOTA spanOTA; // manages OTA process +//D SpanOTA spanOTA; // manages OTA process SpanConfig hapConfig; // track configuration changes to the HAP Accessory database; used to increment the configuration number (c#) when changes found list> hapList; // linked-list of HAPClient structures containing HTTP client connections, parsing routines, and state variables @@ -333,10 +333,10 @@ class Span{ int getControlPin(){return(controlButton?controlButton->getPin():-1);} // get Control Pin (returns -1 if undefined) Span& setStatusPin(uint8_t pin){statusDevice=new GenericLED(pin);return(*this);} // sets Status Device to a simple LED on specified pin - Span& setStatusPixel(uint8_t pin,float h=0,float s=100,float v=100){ // sets Status Device to an RGB Pixel on specified pin - statusDevice=((new Pixel(pin))->setOnColor(Pixel::HSV(h,s,v))); - return(*this); - } +//D Span& setStatusPixel(uint8_t pin,float h=0,float s=100,float v=100){ // sets Status Device to an RGB Pixel on specified pin +//D statusDevice=((new Pixel(pin))->setOnColor(Pixel::HSV(h,s,v))); +//D return(*this); +//D } Span& setStatusDevice(Blinkable *sDev){statusDevice=sDev;return(*this);} // sets Status Device to a generic Blinkable object Span& setStatusAutoOff(uint16_t duration){autoOffLED=duration;return(*this);} // sets Status LED auto off (seconds) @@ -370,8 +370,8 @@ class Span{ Span& setHostNameSuffix(const char *suffix){asprintf(&hostNameSuffix,"%s",suffix);return(*this);} // sets the hostName suffix to be used instead of the 6-byte AccessoryID - int enableOTA(boolean auth=true, boolean safeLoad=true){return(spanOTA.init(auth, safeLoad, NULL));} // enables Over-the-Air updates, with (auth=true) or without (auth=false) authorization password - int enableOTA(const char *pwd, boolean safeLoad=true){return(spanOTA.init(true, safeLoad, pwd));} // enables Over-the-Air updates, with custom authorization password (overrides any password stored with the 'O' command) +//D int enableOTA(boolean auth=true, boolean safeLoad=true){return(spanOTA.init(auth, safeLoad, NULL));} // enables Over-the-Air updates, with (auth=true) or without (auth=false) authorization password +//D int enableOTA(const char *pwd, boolean safeLoad=true){return(spanOTA.init(true, safeLoad, pwd));} // enables Over-the-Air updates, with custom authorization password (overrides any password stored with the 'O' command) Span& enableWebLog(uint16_t maxEntries=0, const char *serv=NULL, const char *tz="UTC", const char *url=DEFAULT_WEBLOG_URL){ // enable Web Logging webLog.init(maxEntries, serv, tz, url); @@ -807,7 +807,7 @@ class SpanPoint { static QueueHandle_t statusQueue; // queue for communication between SpanPoint::dataSend and SpanPoint::send static nvs_handle pointNVS; // NVS storage for channel number (only used for remote devices) - static void dataReceived(const uint8_t *mac, const uint8_t *incomingData, int len); + static void dataReceived(const esp_now_recv_info *mac, const uint8_t *incomingData, int len); static void init(const char *password="HomeSpan"); static void setAsHub(){isHub=true;} static uint8_t nextChannel(); diff --git a/src/Network.cpp b/src/Network.cpp index bf9ee39..fb63a67 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -29,7 +29,7 @@ #include -#include "Network.h" +#include "Network_HS.h" #include "HomeSpan.h" #include "Utils.h" @@ -37,7 +37,7 @@ using namespace Utils; /////////////////////////////// -void Network::scan(){ +void Network_HS::scan(){ int n=WiFi.scanNetworks(); @@ -62,7 +62,7 @@ void Network::scan(){ /////////////////////////////// -void Network::serialConfigure(){ +void Network_HS::serialConfigure(){ wifiData.ssid[0]='\0'; wifiData.pwd[0]='\0'; @@ -94,7 +94,7 @@ void Network::serialConfigure(){ /////////////////////////////// -boolean Network::allowedCode(char *s){ +boolean Network_HS::allowedCode(char *s){ return( strcmp(s,"00000000") && strcmp(s,"11111111") && strcmp(s,"22222222") && strcmp(s,"33333333") && strcmp(s,"44444444") && strcmp(s,"55555555") && strcmp(s,"66666666") && strcmp(s,"77777777") && @@ -103,7 +103,7 @@ boolean Network::allowedCode(char *s){ /////////////////////////////// -void Network::apConfigure(){ +void Network_HS::apConfigure(){ LOG0("*** Starting Access Point: %s / %s\n",apSSID,apPassword); @@ -235,7 +235,7 @@ void Network::apConfigure(){ /////////////////////////////// -void Network::processRequest(char *body, char *formData){ +void Network_HS::processRequest(char *body, char *formData){ String responseHead="HTTP/1.1 200 OK\r\nContent-type: text/html\r\n"; @@ -368,7 +368,7 @@ void Network::processRequest(char *body, char *formData){ ////////////////////////////////////// -int Network::getFormValue(char *formData, const char *tag, char *value, int maxSize){ +int Network_HS::getFormValue(char *formData, const char *tag, char *value, int maxSize){ char *s=strstr(formData,tag); // find start of tag @@ -402,7 +402,7 @@ int Network::getFormValue(char *formData, const char *tag, char *value, int maxS ////////////////////////////////////// -int Network::badRequestError(){ +int Network_HS::badRequestError(){ char s[]="HTTP/1.1 400 Bad Request\r\n\r\n"; LOG2("\n>>>>>>>>>> "); diff --git a/src/Network.h b/src/Network_HS.h similarity index 97% rename from src/Network.h rename to src/Network_HS.h index 97843a5..7581ea9 100644 --- a/src/Network.h +++ b/src/Network_HS.h @@ -27,6 +27,7 @@ #pragma once +#include #include #include "Settings.h" @@ -35,7 +36,7 @@ const int MAX_PWD=64; // max number of characters /////////////////////////////// -struct Network { +struct Network_HS { const int MAX_HTTP=4095; // max number of bytes in HTTP message @@ -46,7 +47,7 @@ struct Network { char **ssidList=NULL; int numSSID; - WiFiClient client; // client used for HTTP calls + NetworkClient client; // client used for HTTP calls int waitTime; // time to wait between HTTP refreshed when checking for WiFi connection unsigned long alarmTimeOut; // alarm time after which access point is shut down and HomeSpan is re-started int apStatus; // tracks access point status (0=timed-out, -1=cancel, 1=save) diff --git a/src/SRP.cpp b/src/SRP.cpp index 93ec8dc..de97955 100644 --- a/src/SRP.cpp +++ b/src/SRP.cpp @@ -100,10 +100,10 @@ void SRP6A::createVerifyCode(const char *setupCode, Verification *vData){ // compute x = SHA512( s | SHA512( I | ":" | P ) ) - memcpy(tBuf,vData->salt,16); // write salt into first 16 bytes of staging buffer - mbedtls_sha512_ret((uint8_t *)icp,strlen(icp),tBuf+16,0); // create hash of username:password and write into last 64 bytes of staging buffer - mbedtls_sha512_ret(tBuf,80,tHash,0); // create second hash of salted, hashed username:password - mbedtls_mpi_read_binary(&x,tHash,64); // load hash result into x + memcpy(tBuf,vData->salt,16); // write salt into first 16 bytes of staging buffer + mbedtls_sha512((uint8_t *)icp,strlen(icp),tBuf+16,0); // create hash of username:password and write into last 64 bytes of staging buffer + mbedtls_sha512(tBuf,80,tHash,0); // create second hash of salted, hashed username:password + mbedtls_mpi_read_binary(&x,tHash,64); // load hash result into x // compute v = g^x %N @@ -136,7 +136,7 @@ void SRP6A::createPublicKey(const Verification *vData, uint8_t *publicKey){ mbedtls_mpi_write_binary(&N,tBuf,384); // write N into first half of staging buffer mbedtls_mpi_write_binary(&g,tBuf+384,384); // write g into second half of staging buffer (fully padded with leading zeros) - mbedtls_sha512_ret(tBuf,768,tHash,0); // create hash of data + mbedtls_sha512(tBuf,768,tHash,0); // create hash of data mbedtls_mpi_read_binary(&k,tHash,64); // load hash result into k // compute B = (k*v + g^b) %N @@ -163,7 +163,7 @@ void SRP6A::createSessionKey(const uint8_t *publicKey, size_t len){ mbedtls_mpi_write_binary(&A,tBuf,384); // write A into first half of staging buffer (padding with initial zeros is less than 384 bytes) mbedtls_mpi_write_binary(&B,tBuf+384,384); // write B into second half of staging buffer (padding with initial zeros is less than 384 bytes) - mbedtls_sha512_ret(tBuf,768,tHash,0); // create hash of data + mbedtls_sha512(tBuf,768,tHash,0); // create hash of data mbedtls_mpi_read_binary(&u,tHash,64); // load hash result into mpi structure u // compute S = (A * v^u)^b %N @@ -176,7 +176,7 @@ void SRP6A::createSessionKey(const uint8_t *publicKey, size_t len){ // compute K = SHA512( PAD(S) ) mbedtls_mpi_write_binary(&S,tBuf,384); // write S into staging buffer (only first half of buffer will be used) - mbedtls_sha512_ret(tBuf,384,K,0); // create hash of data - this is the SRP SHARED SESSION KEY, K + mbedtls_sha512(tBuf,384,K,0); // create hash of data - this is the SRP SHARED SESSION KEY, K } @@ -196,13 +196,13 @@ int SRP6A::verifyClientProof(const uint8_t *proof){ // compute M1V = SHA512( SHA512(N) xor SHA512(g) | SHA512(I) | s | A | B | K ) mbedtls_mpi_write_binary(&N,tBuf,384); // write N into staging buffer - mbedtls_sha512_ret(tBuf,384,tHash,0); // create hash of data - mbedtls_sha512_ret(&g3072,1,tBuf,0); // create hash of g, but place output directly into staging buffer + mbedtls_sha512(tBuf,384,tHash,0); // create hash of data + mbedtls_sha512(&g3072,1,tBuf,0); // create hash of g, but place output directly into staging buffer for(int i=0;i<64;i++) // H(g) -> H(g) XOR H(N), with results in first 64 bytes of staging buffer tBuf[i]^=tHash[i]; - mbedtls_sha512_ret((uint8_t *)I,strlen(I),tBuf+64,0); // create hash of userName and concatenate result to end of staging buffer + mbedtls_sha512((uint8_t *)I,strlen(I),tBuf+64,0); // create hash of userName and concatenate result to end of staging buffer mbedtls_mpi_write_binary(&s,tBuf+128,16); // concatenate s to staging buffer @@ -217,7 +217,7 @@ int SRP6A::verifyClientProof(const uint8_t *proof){ memcpy(tBuf+count,K,64); // concatenate K to staging buffer (should always be 64 bytes since it is a hashed value) count+=64; // final total of bytes written to staging buffer - mbedtls_sha512_ret(tBuf,count,tHash,0); // create hash of data - this is M1V + mbedtls_sha512(tBuf,count,tHash,0); // create hash of data - this is M1V if(!memcmp(M1,tHash,64)) // check that client Proof M1 matches M1V return(1); // success - proof from HAP Client is verified @@ -236,7 +236,7 @@ void SRP6A::createAccProof(uint8_t *proof){ mbedtls_mpi_write_binary(&A,tBuf,384); // write A into staging buffer memcpy(tBuf+384,M1,64); // concatenate M1 (now verified) to staging buffer memcpy(tBuf+448,K,64); // concatenate K to staging buffer - mbedtls_sha512_ret(tBuf,512,proof,0); // create hash of data writing directly to proof - this is M2 + mbedtls_sha512(tBuf,512,proof,0); // create hash of data writing directly to proof - this is M2 } diff --git a/src/extras/Blinker.h b/src/extras/Blinker.h deleted file mode 100644 index fe89bef..0000000 --- a/src/extras/Blinker.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/Blinker.h" diff --git a/src/extras/Pixel.h b/src/extras/Pixel.h deleted file mode 100644 index 34b699e..0000000 --- a/src/extras/Pixel.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/Pixel.h" diff --git a/src/extras/PwmPin.h b/src/extras/PwmPin.h deleted file mode 100644 index 269f2a4..0000000 --- a/src/extras/PwmPin.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/PwmPin.h" diff --git a/src/extras/RFControl.h b/src/extras/RFControl.h deleted file mode 100644 index bd955aa..0000000 --- a/src/extras/RFControl.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/RFControl.h" diff --git a/src/extras/StepperControl.h b/src/extras/StepperControl.h deleted file mode 100644 index 0e685ca..0000000 --- a/src/extras/StepperControl.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2023 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/StepperControl.h" diff --git a/src/extras/Stepper_A3967.h b/src/extras/Stepper_A3967.h deleted file mode 100644 index a5fb2b0..0000000 --- a/src/extras/Stepper_A3967.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/Stepper_A3967.h" diff --git a/src/extras/Stepper_TB6612.h b/src/extras/Stepper_TB6612.h deleted file mode 100644 index 14365d9..0000000 --- a/src/extras/Stepper_TB6612.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************************* - * MIT License - * - * Copyright (c) 2020-2022 Gregg E. Berman - * - * https://github.com/HomeSpan/HomeSpan - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - ********************************************************************************/ - -#pragma once - -#include "../src/extras/Stepper_TB6612.h" diff --git a/src/extras/extras.ino b/src/extras/extras.ino deleted file mode 100644 index fd9911d..0000000 --- a/src/extras/extras.ino +++ /dev/null @@ -1 +0,0 @@ -// This is a placeholder .ino file that allows for editing of top-level "extras" header files. diff --git a/src/src.ino b/src/src.ino index 83c11e3..ae2000b 100644 --- a/src/src.ino +++ b/src/src.ino @@ -27,61 +27,23 @@ #include "HomeSpan.h" - -CUSTOM_CHAR(TestChar,3F4F,PR+PW,UINT8,20,0,100,false) -CUSTOM_CHAR_STRING(TestString,3F45,PR+EV,"Hello"); -CUSTOM_CHAR_TLV8(TestTLV,45674F457,PW+PR); -CUSTOM_CHAR_DATA(TestData,303,PW+PW); - void setup() { - - Serial.begin(115200); - homeSpan.setLogLevel(2); - homeSpan.enableWebLog(); + Serial.begin(115200); homeSpan.begin(Category::Lighting,"HomeSpan LightBulb"); - - new SpanUserCommand('D', " - disconnect WiFi", [](const char *buf){WiFi.disconnect();}); - new SpanAccessory(); - new Service::AccessoryInformation(); - new Characteristic::Identify(); + new SpanAccessory(); + new Service::AccessoryInformation(); + new Characteristic::Identify(); new Service::LightBulb(); new Characteristic::On(); - new Characteristic::TestChar(30); - new Characteristic::TestString(); - new Characteristic::TestString("MyName"); - new Characteristic::TestTLV(); - Characteristic::TestData *testData = new Characteristic::TestData(); - - TLV8 myTLV; - - myTLV.add(5,0x20); - myTLV.add(5,0x30); - myTLV.add(1); - myTLV.add(5,255); - - Characteristic::TestTLV *testTLV = new Characteristic::TestTLV(myTLV); - - size_t n=testTLV->getData(NULL,0); - uint8_t buf[n]; - testTLV->getData(buf,n); - - Serial.printf("\n"); - for(int i=0;isetData(buf,8); -} - + +} ////////////////////////////////////// void loop(){ - - homeSpan.poll(); + + homeSpan.poll(); } - -////////////////////////////////////// diff --git a/src/src/extras/Pixel.cpp b/src/src/extras/Pixel.cpp index 24be2ce..3c1d724 100644 --- a/src/src/extras/Pixel.cpp +++ b/src/src/extras/Pixel.cpp @@ -24,6 +24,8 @@ * SOFTWARE. * ********************************************************************************/ + +#ifdef HS_PIXEL //////////////////////////////////////////// // Addressable LEDs // @@ -31,6 +33,8 @@ #include "Pixel.h" +#warning "Pixel.cpp Compiling" + //////////////////////////////////////////// // Single-Wire RGB/RGBW NeoPixels // //////////////////////////////////////////// @@ -203,3 +207,5 @@ void Dot::set(Color *c, int nPixels, boolean multiColor){ } //////////////////////////////////////////// + +#endif diff --git a/src/src/extras/Pixel.h b/src/src/extras/Pixel.h index 1cd37a1..79b1856 100644 --- a/src/src/extras/Pixel.h +++ b/src/src/extras/Pixel.h @@ -31,6 +31,8 @@ #pragma once +#warning "Pixel.h Included" + #include "RFControl.h" #include "PwmPin.h" #include "Blinker.h" diff --git a/src/src/extras/PwmPin.cpp b/src/src/extras/PwmPin.cpp index 703e142..0bf6d41 100644 --- a/src/src/extras/PwmPin.cpp +++ b/src/src/extras/PwmPin.cpp @@ -27,6 +27,8 @@ #include "PwmPin.h" +#warning "PwmPin.cpp Compiling" + /////////////////// LedC::LedC(uint8_t pin, uint16_t freq, boolean invert){ diff --git a/src/src/extras/PwmPin.h b/src/src/extras/PwmPin.h index eedce3a..2f20f7a 100644 --- a/src/src/extras/PwmPin.h +++ b/src/src/extras/PwmPin.h @@ -42,6 +42,8 @@ #pragma once +#warning "PwmPin.h Included" + #include #include #include "Blinker.h" diff --git a/src/src/extras/RFControl.cpp b/src/src/extras/RFControl.cpp index 1266263..6f8f344 100644 --- a/src/src/extras/RFControl.cpp +++ b/src/src/extras/RFControl.cpp @@ -27,6 +27,8 @@ #include "RFControl.h" +#warning "RFControl.cpp Compiling" + /////////////////// RFControl::RFControl(uint8_t pin, boolean refClock, boolean installDriver){ diff --git a/src/src/extras/RFControl.h b/src/src/extras/RFControl.h index d80d22d..81f63da 100644 --- a/src/src/extras/RFControl.h +++ b/src/src/extras/RFControl.h @@ -31,6 +31,8 @@ #pragma once +#warning "RFControl.h Included" + #include #include #include "driver/rmt.h" diff --git a/src/src/extras/StepperControl.cpp b/src/src/extras/StepperControl.cpp index db01788..efced40 100644 --- a/src/src/extras/StepperControl.cpp +++ b/src/src/extras/StepperControl.cpp @@ -26,6 +26,8 @@ ********************************************************************************/ #include "StepperControl.h" + +#warning "StepperControl.cpp Compiling" ////////////////////////// diff --git a/src/src/extras/StepperControl.h b/src/src/extras/StepperControl.h index e8b52ab..fccf075 100644 --- a/src/src/extras/StepperControl.h +++ b/src/src/extras/StepperControl.h @@ -27,6 +27,8 @@ #pragma once +#warning "StepperControl.h Included" + #include #include "PwmPin.h" diff --git a/src/version.h b/src/version.h index 953e596..f539d71 100644 --- a/src/version.h +++ b/src/version.h @@ -43,8 +43,8 @@ #include -#if ESP_ARDUINO_VERSION_MAJOR!=2 - #error ERROR: HOMESPAN REQUIRES VERSION 2 OF THE ARDUINO ESP32 LIBRARY. HOMESPAN IS NOT COMPATIBLE WITH VERSION 1 OR VERSION 3 +#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 2) + #error ERROR: THIS VERSION OF HOMESPAN REQUIRES VERSION 3.0.2 OR GREATER OF THE ARDUINO-ESP32 BOARD MANAGER #include #endif