Made vTaskDelay(5) in pollTask conditional of using autoPoll()
vTaskDelay(5) is only needed if polling is in its own task. If calling poll() directly, there is no need for any delay.
This commit is contained in:
parent
643c737634
commit
42f69adf49
|
|
@ -156,7 +156,7 @@ void Span::begin(Category catID, const char *displayName, const char *hostNameBa
|
||||||
void Span::poll() {
|
void Span::poll() {
|
||||||
|
|
||||||
if(pollTaskHandle){
|
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);
|
vTaskDelete(pollTaskHandle);
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
@ -305,6 +305,7 @@ void Span::pollTask() {
|
||||||
|
|
||||||
statusLED->check();
|
statusLED->check();
|
||||||
|
|
||||||
|
if(pollTaskHandle)
|
||||||
vTaskDelay(5);
|
vTaskDelay(5);
|
||||||
|
|
||||||
} // poll
|
} // poll
|
||||||
|
|
|
||||||
19
src/src.ino
19
src/src.ino
|
|
@ -84,26 +84,19 @@ void setup() {
|
||||||
new SpanAccessory();
|
new SpanAccessory();
|
||||||
new Service::AccessoryInformation();
|
new Service::AccessoryInformation();
|
||||||
new Characteristic::Identify();
|
new Characteristic::Identify();
|
||||||
// new LED_Service(13);
|
new LED_Service(13);
|
||||||
|
|
||||||
for(int i=0;i<50;i++){
|
homeSpan.autoPoll();
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
homeSpan.poll();
|
// homeSpan.poll();
|
||||||
|
delay(10000);
|
||||||
|
Serial.println(millis());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue