diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 5f77a85..7bc7748 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -156,7 +156,7 @@ void Span::begin(Category catID, const char *displayName, const char *hostNameBa void Span::poll() { if(pollTaskHandle){ - LOG0("\n** FATAL ERROR: Do not call homeSpan.poll() directly if homeSpan.start() is used!\n** PROGRAM HALTED **\n\n"); + LOG0("\n** FATAL ERROR: Do not call homeSpan.poll() directly if homeSpan.autoPoll() is used!\n** PROGRAM HALTED **\n\n"); vTaskDelete(pollTaskHandle); while(1); } @@ -305,7 +305,8 @@ void Span::pollTask() { statusLED->check(); - vTaskDelay(5); + if(pollTaskHandle) + vTaskDelay(5); } // poll diff --git a/src/src.ino b/src/src.ino index b86eddf..457ccf3 100644 --- a/src/src.ino +++ b/src/src.ino @@ -84,26 +84,19 @@ void setup() { new SpanAccessory(); new Service::AccessoryInformation(); new Characteristic::Identify(); -// new LED_Service(13); + new LED_Service(13); - for(int i=0;i<50;i++){ - new SpanAccessory(); - new Service::AccessoryInformation(); - new Characteristic::Identify(); - new Service::LightBulb(); - new Characteristic::On(true); - new Service::Fan(); - new Characteristic::Active(); - new Characteristic::RotationDirection(); - (new Characteristic::RotationSpeed(50))->setRange(0,100,25); - } + homeSpan.autoPoll(); } ////////////////////////////////////// void loop(){ - homeSpan.poll(); +// homeSpan.poll(); +delay(10000); +Serial.println(millis()); + } //////////////////////////////////////