Compare commits

...

9 Commits

Author SHA1 Message Date
Gregg 0e346be0a2 Tested and verified PwmPin functionality
Verified fading works as expected.
2024-07-20 12:27:06 -05:00
Gregg fc4d8d85d1 Re-established SpanOTA code and tested OTA upload
Only problem was that the definition for esp_image_header_t was moved to a new IDF header file.  Solution was to add: #include <esp_app_format.h>.
2024-07-20 09:38:54 -05:00
Gregg 158274cac6 Fixed warnings related to multiplication of two enums without explicit recasting 2024-07-19 17:47:52 -05:00
Gregg 3534f0c79e Update Blinker.h
Removed "driver/timer.h".  This is an old include that has not been used for a while, and happens to have now been deprecated in IDF5 (removing entirely prevents deprecation warnings).
2024-07-15 06:34:03 -05:00
Gregg d58eed5198 Conformed server.available() to server.accept()
"available()" was deprecated and replaced with "accept()"
2024-07-15 06:18:09 -05:00
Gregg 112faf37a5 Added operator delete whenever operator new is overridden
Addresses compiler warning (and fixes potential underlying issue)
2024-07-14 17:15:35 -05:00
Gregg eaba8294b3 Conformed SpanPoint to small change in ESP-NOW in Arduino-ESP32 version 3
Reflects small change to ESP-NOW data receive callback function.  Also updated examples to use Network instead of WiFi to obtain MAC address prior to WiFi being setup/used.
2024-07-14 16:23:46 -05:00
Gregg 6e9279db60 Updated printf to use %lu instead of %u for all uint32_t
Addresses warnings in main library as a result of Espressif now including --Wformat warnings during compilation.  No impact on any functionality - these warnings were not meaningful in any case.
2024-07-14 10:01:09 -05:00
Gregg 0e04051ab7 Initial Test under Arduino-ESP32 version 3.0.2
In order to compile, commented out all Pixel, PWM, and RFControl Code.  Also needed to comment out ArduinoOTA and make change to SpanPoint.
2024-07-04 22:46:23 -05:00
31 changed files with 122 additions and 358 deletions

View File

@ -57,12 +57,12 @@ void setup() {
Serial.begin(115200);
delay(1000);
Serial.printf("\n\nThis is a REMOTE Device with MAC Address = %s\n",WiFi.macAddress().c_str());
Serial.printf("\n\nThis is a REMOTE Device with MAC Address = %s\n",Network.macAddress().c_str());
Serial.printf("NOTE: This MAC Address must be entered into the corresponding SpanPoint() call of the MAIN Device.\n\n");
// In the line below, replace the MAC Address with that of your MAIN HOMESPAN DEVICE
mainDevice=new SpanPoint("84:CC:A8:11:B4:84",sizeof(float),0); // create a SpanPoint with send size=sizeof(float) and receive size=0
mainDevice=new SpanPoint("AC:67:B2:77:42:20",sizeof(float),0); // create a SpanPoint with send size=sizeof(float) and receive size=0
homeSpan.setLogLevel(1);
}

View File

@ -70,7 +70,7 @@ void setup() {
homeSpan.setLogLevel(1);
Serial.begin(115200);
delay(1000);
Serial.printf("Starting Remote Temperature Sensor. MAC Address of this device = %s\n",WiFi.macAddress().c_str());
Serial.printf("Starting Remote Temperature Sensor. MAC Address of this device = %s\n",Network.macAddress().c_str());
#endif
// In the line below, replace the MAC Address with that of your MAIN HOMESPAN DEVICE

View File

@ -1043,7 +1043,7 @@ int HAPClient::putPrepareURL(char *json){
uint64_t pid;
if((cBuf=strstr(json,ttlToken)))
sscanf(cBuf+strlen(ttlToken),"%u",&ttl);
sscanf(cBuf+strlen(ttlToken),"%lu",&ttl);
if((cBuf=strstr(json,pidToken)))
sscanf(cBuf+strlen(ttlToken),"%llu",&pid);
@ -1233,7 +1233,7 @@ void HAPClient::checkTimedWrites(){
auto tw=homeSpan.TimedWrites.begin();
while(tw!=homeSpan.TimedWrites.end()){
if(cTime>tw->second){ // timer has expired
LOG2("Removing PID=%llu ALARM=%u\n",tw->first,tw->second);
LOG2("Removing PID=%llu ALARM=%lu\n",tw->first,tw->second);
tw=homeSpan.TimedWrites.erase(tw);
}
else
@ -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);
}

View File

@ -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)

View File

@ -38,6 +38,7 @@
#include <esp_sntp.h>
#include <esp_ota_ops.h>
#include <esp_wifi.h>
#include <esp_app_format.h>
#include "HomeSpan.h"
#include "HAP.h"
@ -87,7 +88,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
@ -129,7 +130,7 @@ void Span::begin(Category catID, const char *_displayName, const char *_hostName
LOG0("\nHomeSpan Version: %s",HOMESPAN_VERSION);
LOG0("\nArduino-ESP Ver.: %s",ARDUINO_ESP_VERSION);
LOG0("\nESP-IDF Version: %d.%d.%d",ESP_IDF_VERSION_MAJOR,ESP_IDF_VERSION_MINOR,ESP_IDF_VERSION_PATCH);
LOG0("\nESP32 Chip: %s Rev %d %s-core %dMB Flash", ESP.getChipModel(),ESP.getChipRevision(),
LOG0("\nESP32 Chip: %s Rev %d %s-core %luMB Flash", ESP.getChipModel(),ESP.getChipRevision(),
ESP.getChipCores()==1?"single":"dual",ESP.getFlashChipSize()/1024/1024);
#ifdef ARDUINO_VARIANT
@ -138,7 +139,7 @@ void Span::begin(Category catID, const char *_displayName, const char *_hostName
#endif
LOG0("\nPWM Resources: %d channels, %d timers, max %d-bit duty resolution",
LEDC_SPEED_MODE_MAX*LEDC_CHANNEL_MAX,LEDC_SPEED_MODE_MAX*LEDC_TIMER_MAX,LEDC_TIMER_BIT_MAX-1);
(int)LEDC_SPEED_MODE_MAX*(int)LEDC_CHANNEL_MAX,(int)LEDC_SPEED_MODE_MAX*(int)LEDC_TIMER_MAX,LEDC_TIMER_BIT_MAX-1);
LOG0("\nSodium Version: %s Lib %d.%d",sodium_version_string(),sodium_library_version_major(),sodium_library_version_minor());
char mbtlsv[64];
@ -147,7 +148,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);
@ -230,7 +231,7 @@ void Span::pollTask() {
if(hapServer->hasClient()){
auto it=hapList.emplace(hapList.begin()); // create new HAPClient connection
it->client=hapServer->available();
it->client=hapServer->accept();
it->clientNumber=it->client.fd()-LWIP_SOCKET_OFFSET;
HAPClient::pairStatus=pairState_M1; // reset starting PAIR STATE (which may be needed if Accessory failed in middle of pair-setup)
@ -472,7 +473,7 @@ 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
@ -489,7 +490,7 @@ void Span::checkConnect(){
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)
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)
@ -816,7 +817,7 @@ void Span::processSerialCommand(const char *c){
char pNames[][7]={"PR","PW","EV","AA","TW","HD","WR"};
for(auto acc=Accessories.begin(); acc!=Accessories.end(); acc++){
LOG0("\u27a4 Accessory: AID=%u\n",(*acc)->aid);
LOG0("\u27a4 Accessory: AID=%lu\n",(*acc)->aid);
boolean foundInfo=false;
if(acc==Accessories.begin() && (*acc)->aid!=1)
@ -829,7 +830,7 @@ void Span::processSerialCommand(const char *c){
vector<uint32_t, Mallocator<uint32_t>> iidValues;
for(auto svc=(*acc)->Services.begin(); svc!=(*acc)->Services.end(); svc++){
LOG0(" \u279f Service %s: IID=%u, %sUUID=\"%s\"\n",(*svc)->hapName,(*svc)->iid,(*svc)->isCustom?"Custom-":"",(*svc)->type);
LOG0(" \u279f Service %s: IID=%lu, %sUUID=\"%s\"\n",(*svc)->hapName,(*svc)->iid,(*svc)->isCustom?"Custom-":"",(*svc)->type);
if(!strcmp((*svc)->type,"3E")){
foundInfo=true;
@ -845,7 +846,7 @@ void Span::processSerialCommand(const char *c){
iidValues.push_back((*svc)->iid);
for(auto chr=(*svc)->Characteristics.begin(); chr!=(*svc)->Characteristics.end(); chr++){
LOG0(" \u21e8 Characteristic %s(%.33s%s): IID=%u, %sUUID=\"%s\", %sPerms=",
LOG0(" \u21e8 Characteristic %s(%.33s%s): IID=%lu, %sUUID=\"%s\", %sPerms=",
(*chr)->hapName,(*chr)->uvPrint((*chr)->value).c_str(),strlen((*chr)->uvPrint((*chr)->value).c_str())>33?"...\"":"",(*chr)->iid,(*chr)->isCustom?"Custom-":"",(*chr)->type,(*chr)->perms!=(*chr)->hapChar->perms?"Custom-":"");
int foundPerms=0;
@ -946,7 +947,7 @@ void Span::processSerialCommand(const char *c){
for(int i=0;i<Accessories.size();i++){ // identify all services with over-ridden loop() methods
for(int j=0;j<Accessories[i]->Services.size();j++){
SpanService *s=Accessories[i]->Services[j];
LOG0("%-30s %8.8s %10u %3u %6s %4s %6s ",s->hapName,s->type,Accessories[i]->aid,s->iid,
LOG0("%-30s %8.8s %10lu %3lu %6s %4s %6s ",s->hapName,s->type,Accessories[i]->aid,s->iid,
(void(*)())(s->*(&SpanService::update))!=(void(*)())(&SpanService::update)?"YES":"NO",
(void(*)())(s->*(&SpanService::loop))!=(void(*)())(&SpanService::loop)?"YES":"NO",
(void(*)(int,boolean))(s->*(&SpanService::button))!=(void(*)(int,boolean))(&SpanService::button)?"YES":"NO"
@ -954,7 +955,7 @@ void Span::processSerialCommand(const char *c){
if(s->linkedServices.empty())
LOG0("-");
for(int k=0;k<s->linkedServices.size();k++){
LOG0("%u",s->linkedServices[k]->iid);
LOG0("%lu",s->linkedServices[k]->iid);
if(k<s->linkedServices.size()-1)
LOG0(",");
}
@ -1340,11 +1341,11 @@ int Span::updateCharacteristics(char *buf, SpanBuf *pObj){
t1=NULL;
char *t3;
if(!strcmp(t2,"aid") && (t3=strtok_r(t1,"}[]:, \"\t\n\r",&p2))){
sscanf(t3,"%u",&pObj[nObj].aid);
sscanf(t3,"%lu",&pObj[nObj].aid);
okay|=1;
} else
if(!strcmp(t2,"iid") && (t3=strtok_r(t1,"}[]:, \"\t\n\r",&p2))){
sscanf(t3,"%u",&pObj[nObj].iid);
sscanf(t3,"%lu",&pObj[nObj].iid);
okay|=2;
} else
if(!strcmp(t2,"value") && (t3=strtok_r(t1,"}[]:,\"",&p2))){
@ -1414,7 +1415,7 @@ int Span::updateCharacteristics(char *buf, SpanBuf *pObj){
if(pObj[j].characteristic->service==pObj[i].characteristic->service){ // if service of this characteristic matches service that was updated
pObj[j].status=status; // save statusCode for this object
LOG1("Updating aid=%u iid=%u",pObj[j].characteristic->aid,pObj[j].characteristic->iid);
LOG1("Updating aid=%lu iid=%lu",pObj[j].characteristic->aid,pObj[j].characteristic->iid);
if(status==StatusCode::OK){ // if status is okay
pObj[j].characteristic->uvSet(pObj[j].characteristic->value,pObj[j].characteristic->newValue); // update characteristic value with new value
if(pObj[j].characteristic->nvsKey){ // if storage key found
@ -1504,7 +1505,7 @@ boolean Span::printfAttributes(char **ids, int numIDs, int flags){
StatusCode status[numIDs];
for(int i=0;i<numIDs;i++){ // PASS 1: loop over all ids requested to check status codes - only errors are if characteristic not found, or not readable
sscanf(ids[i],"%u.%u",&aid,&iid); // parse aid and iid
sscanf(ids[i],"%lu.%lu",&aid,&iid); // parse aid and iid
Characteristics[i]=find(aid,iid); // find matching chararacteristic
if(Characteristics[i]){ // if found
@ -1528,7 +1529,7 @@ boolean Span::printfAttributes(char **ids, int numIDs, int flags){
if(Characteristics[i]) // if found
Characteristics[i]->printfAttributes(flags); // get JSON attributes for characteristic (may or may not include status=0 attribute)
else{ // else create JSON status attribute based on requested aid/iid
sscanf(ids[i],"%u.%u",&aid,&iid);
sscanf(ids[i],"%lu.%lu",&aid,&iid);
hapOut << "{\"iid\":" << iid << ",\"aid\":" << aid << ",\"status\":" << (int)status[i] << "}";
}
@ -1654,7 +1655,7 @@ SpanAccessory::~SpanAccessory(){
while((*acc)!=this)
acc++;
homeSpan.Accessories.erase(acc);
LOG1("Deleted Accessory AID=%d\n",aid);
LOG1("Deleted Accessory AID=%lu\n",aid);
}
///////////////////////////////
@ -1722,7 +1723,7 @@ SpanService::~SpanService(){
}
}
LOG1("Deleted Service AID=%u IID=%u\n",accessory->aid,iid);
LOG1("Deleted Service AID=%lu IID=%lu\n",accessory->aid,iid);
}
///////////////////////////////
@ -1824,7 +1825,7 @@ SpanCharacteristic::~SpanCharacteristic(){
free(newValue.STRING);
}
LOG1("Deleted Characteristic AID=%u IID=%u\n",aid,iid);
LOG1("Deleted Characteristic AID=%lu IID=%lu\n",aid,iid);
}
///////////////////////////////
@ -2126,7 +2127,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev, boolean wr){
if(evFlag && !(perms&EV)) // notification is not supported for characteristic
return(StatusCode::NotifyNotAllowed);
LOG1("Notification Request for aid=%u iid=%u: %s\n",aid,iid,evFlag?"true":"false");
LOG1("Notification Request for aid=%lu iid=%lu: %s\n",aid,iid,evFlag?"true":"false");
HAPClient *hc=&(*(homeSpan.currentClient));
if(evFlag)
@ -2157,7 +2158,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev, boolean wr){
newValue.INT=0;
else if(!strcmp(val,"true"))
newValue.INT=1;
else if(!sscanf(val,"%d",&newValue.INT))
else if(!sscanf(val,"%ld",&newValue.INT))
return(StatusCode::InvalidValue);
break;
@ -2184,7 +2185,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev, boolean wr){
newValue.UINT32=0;
else if(!strcmp(val,"true"))
newValue.UINT32=1;
else if(!sscanf(val,"%u",&newValue.UINT32))
else if(!sscanf(val,"%lu",&newValue.UINT32))
return(StatusCode::InvalidValue);
break;
@ -2511,7 +2512,7 @@ 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);
LOG0("%d%%..",percent);
}
if(safeLoad && progress==total){
@ -2598,7 +2599,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 +2712,9 @@ boolean SpanPoint::send(const void *data){
///////////////////////////////
void SpanPoint::dataReceived(const uint8_t *mac, const uint8_t *incomingData, int len){
void SpanPoint::dataReceived(const esp_now_recv_info *info, const uint8_t *incomingData, int len){
const uint8_t *mac=info->src_addr;
auto it=SpanPoints.begin();
for(;it!=SpanPoints.end() && memcmp((*it)->peerInfo.peer_addr,mac,6)!=0; it++);

View File

@ -42,14 +42,14 @@
#include <mbedtls/base64.h>
#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"
@ -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,7 +267,7 @@ 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
@ -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)
@ -438,6 +438,8 @@ class SpanAccessory{
public:
void *operator new(size_t size){return(HS_MALLOC(size));} // override new operator to use PSRAM when available
void operator delete(void *p){free(p);}
SpanAccessory(uint32_t aid=0); // constructor
};
@ -470,6 +472,8 @@ class SpanService{
public:
void *operator new(size_t size){return(HS_MALLOC(size));} // override new operator to use PSRAM when available
void operator delete(void *p){free(p);}
SpanService(const char *type, const char *hapName, boolean isCustom=false); // constructor
SpanService *setPrimary(); // sets the Service Type to be primary and returns pointer to self
SpanService *setHidden(); // sets the Service Type to be hidden and returns pointer to self
@ -622,7 +626,7 @@ class SpanCharacteristic{
nvsKey=(char *)HS_MALLOC(16);
uint16_t t;
sscanf(type,"%hx",&t);
sprintf(nvsKey,"%04X%08X%03X",t,aid,iid&0xFFF);
sprintf(nvsKey,"%04X%08lX%03lX",t,aid,iid&0xFFF);
size_t len;
if(format<FORMAT::STRING){
@ -656,6 +660,7 @@ class SpanCharacteristic{
SpanCharacteristic(HapChar *hapChar, boolean isCustom=false); // SpanCharacteristic constructor
void *operator new(size_t size){return(HS_MALLOC(size));} // override new operator to use PSRAM when available
void operator delete(void *p){free(p);}
template <class T=int> T getVal(){return(uvGet<T>(value));} // gets the value for numeric-based Characteristics
char *getString(){return(getStringGeneric(value));} // gets the value for string-based Characteristics
@ -807,7 +812,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 *info, const uint8_t *incomingData, int len);
static void init(const char *password="HomeSpan");
static void setAsHub(){isHub=true;}
static uint8_t nextChannel();

View File

@ -29,7 +29,7 @@
#include <DNSServer.h>
#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);
@ -161,7 +161,7 @@ void Network::apConfigure(){
dnsServer.processNextRequest();
if(client=apServer.available()){ // found a new HTTP client
if(client=apServer.accept()){ // found a new HTTP client
LOG2("=======================================\n");
LOG1("** Access Point Client Connected: (");
LOG1(millis()/1000);
@ -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>>>>>>>>>> ");

View File

@ -27,6 +27,7 @@
#pragma once
#include <Arduino.h>
#include <WiFi.h>
#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)

View File

@ -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
}

View File

@ -90,6 +90,7 @@ struct SRP6A {
~SRP6A();
void *operator new(size_t size){return(HS_MALLOC(size));} // override new operator to use PSRAM when available
void operator delete(void *p){free(p);}
void createVerifyCode(const char *setupCode, Verification *vData); // generates random s and computes v; writes back resulting Verification Data
void createPublicKey(const Verification *vData, uint8_t *publicKey); // generates random b and computes k and B; writes back resulting Accessory Public Key

View File

@ -266,7 +266,7 @@ void TLV8::print(TLV8_itc it1, TLV8_itc it2) const {
if(it1->getLen()==0)
Serial.printf(" [null]");
else if(it1->getLen()<=4)
Serial.printf(" [%u]",it1->getVal());
Serial.printf(" [%lu]",it1->getVal());
else if(it1->getLen()<=8)
Serial.printf(" [%llu]",it1->getVal<uint64_t>());
Serial.printf("\n");

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -1 +0,0 @@
// This is a placeholder .ino file that allows for editing of top-level "extras" header files.

View File

@ -27,61 +27,25 @@
#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();});
homeSpan.enableWebLog(50);
homeSpan.enableOTA();
homeSpan.begin(Category::Lighting,"HomeSpan OTA Test");
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;i<n;i++)
Serial.printf("%d %0X\n",i,buf[i]);
Serial.printf("\n");
testData->setData(buf,8);
}
}
//////////////////////////////////////
void loop(){
homeSpan.poll();
homeSpan.poll();
}
//////////////////////////////////////

View File

@ -27,7 +27,7 @@
#include "Blinker.h"
////////////////////////////////
////////////////////////////////
// Blinker //
////////////////////////////////

View File

@ -28,7 +28,6 @@
#pragma once
#include <Arduino.h>
#include <driver/timer.h>
[[maybe_unused]] static const char* BLINKER_TAG = "Blinker";

View File

@ -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

View File

@ -31,6 +31,8 @@
#pragma once
#warning "Pixel.h Included"
#include "RFControl.h"
#include "PwmPin.h"
#include "Blinker.h"

View File

@ -93,7 +93,7 @@ class LedPin : public LedC {
static bool fadeCallback(const ledc_cb_param_t *param, void *arg);
public:
LedPin(uint8_t pin, float level=0, uint16_t freq=DEFAULT_PWM_FREQ, boolean invert=false); // assigns pin to be output of one of 16 PWM channels initial level and frequency
LedPin(uint8_t pin, float level=0, uint16_t freq=DEFAULT_PWM_FREQ, boolean invert=false); // assigns LED pin
void set(float level); // sets the PWM duty to level (0-100)
int fade(float level, uint32_t fadeTime, int fadeType=ABSOLUTE); // sets the PWM duty to level (0-100) within fadeTime in milliseconds, returns success (0) or fail (1)
int fadeStatus(); // returns fading state

View File

@ -27,6 +27,8 @@
#include "RFControl.h"
#warning "RFControl.cpp Compiling"
///////////////////
RFControl::RFControl(uint8_t pin, boolean refClock, boolean installDriver){

View File

@ -31,6 +31,8 @@
#pragma once
#warning "RFControl.h Included"
#include <Arduino.h>
#include <soc/rmt_reg.h>
#include "driver/rmt.h"

View File

@ -26,6 +26,8 @@
********************************************************************************/
#include "StepperControl.h"
#warning "StepperControl.cpp Compiling"
//////////////////////////

View File

@ -27,6 +27,8 @@
#pragma once
#warning "StepperControl.h Included"
#include <Arduino.h>
#include "PwmPin.h"

View File

@ -27,7 +27,7 @@
#include "PwmPin.h"
ServoPin servo(21,0,500,2200,-60,60);
LedPin led(13);
void setup() {
@ -35,30 +35,16 @@ void setup() {
delay(1000);
Serial.print("\n\nReady\n\n");
for(int count=0;count<3;count++){
for(int i=-60;i<61;i++){
servo.set(i);
delay(10);
}
for(int i=60;i>-61;i--){
servo.set(i);
delay(10);
}
}
delay(5000);
servo.set(NAN);
delay(10000);
servo.set(0);
}
//////////////////////////////////////
void loop(){
led.fade(100,1000);
while(led.fadeStatus()==LedPin::FADING);
led.fade(0,1000);
while(led.fadeStatus()==LedPin::FADING);
}

View File

@ -43,8 +43,8 @@
#include <esp_arduino_version.h>
#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 <FATAL_ERROR>
#endif