Added homeSpan.getAutoPollTask() to return task handler of autoPoll
Returns NULL if autoPoll has not been used. Also added low stack size for both main Arduino loop task and HomeSpan autoPoll task to 'm' command
This commit is contained in:
parent
2d86ee4a25
commit
3c3e5c21ea
|
|
@ -55,6 +55,8 @@ HapCharacteristics hapChars; // Instantiation of all HAP Characteristics
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
void Span::begin(Category catID, const char *displayName, const char *hostNameBase, const char *modelName){
|
void Span::begin(Category catID, const char *displayName, const char *hostNameBase, const char *modelName){
|
||||||
|
|
||||||
|
loopTaskHandle=xTaskGetCurrentTaskHandle(); // a roundabout way of getting the current task handle
|
||||||
|
|
||||||
this->displayName=displayName;
|
this->displayName=displayName;
|
||||||
this->hostNameBase=hostNameBase;
|
this->hostNameBase=hostNameBase;
|
||||||
|
|
@ -834,7 +836,9 @@ void Span::processSerialCommand(const char *c){
|
||||||
Serial.printf(" Internal: %9d %9d %9d %9d\n",heapInternal.total_allocated_bytes,heapInternal.total_free_bytes,heapInternal.largest_free_block,heapInternal.minimum_free_bytes);
|
Serial.printf(" Internal: %9d %9d %9d %9d\n",heapInternal.total_allocated_bytes,heapInternal.total_free_bytes,heapInternal.largest_free_block,heapInternal.minimum_free_bytes);
|
||||||
Serial.printf(" PSRAM: %9d %9d %9d %9d\n\n",heapPSRAM.total_allocated_bytes,heapPSRAM.total_free_bytes,heapPSRAM.largest_free_block,heapPSRAM.minimum_free_bytes);
|
Serial.printf(" PSRAM: %9d %9d %9d %9d\n\n",heapPSRAM.total_allocated_bytes,heapPSRAM.total_free_bytes,heapPSRAM.largest_free_block,heapPSRAM.minimum_free_bytes);
|
||||||
|
|
||||||
LOG0("Lowest stack level: %d bytes\n",uxTaskGetStackHighWaterMark(NULL));
|
if(getAutoPollTask())
|
||||||
|
LOG0("Lowest stack level: %d bytes (%s)\n",uxTaskGetStackHighWaterMark(getAutoPollTask()),pcTaskGetName(getAutoPollTask()));
|
||||||
|
LOG0("Lowest stack level: %d bytes (%s)\n",uxTaskGetStackHighWaterMark(loopTaskHandle),pcTaskGetName(loopTaskHandle));
|
||||||
nvs_stats_t nvs_stats;
|
nvs_stats_t nvs_stats;
|
||||||
nvs_get_stats(NULL, &nvs_stats);
|
nvs_get_stats(NULL, &nvs_stats);
|
||||||
LOG0("NVS Flash Partition: %d of %d records used\n\n",nvs_stats.used_entries,nvs_stats.total_entries-126);
|
LOG0("NVS Flash Partition: %d of %d records used\n\n",nvs_stats.used_entries,nvs_stats.total_entries-126);
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,7 @@ class Span{
|
||||||
Network network; // configures WiFi and Setup Code via either serial monitor or temporary Access Point
|
Network network; // configures WiFi and Setup Code via either serial monitor or temporary Access Point
|
||||||
SpanWebLog webLog; // optional web status/log
|
SpanWebLog webLog; // optional web status/log
|
||||||
TaskHandle_t pollTaskHandle = NULL; // optional task handle to use for poll() function
|
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
|
boolean verboseWifiReconnect = true; // set to false to not print WiFi reconnect attempts messages
|
||||||
|
|
||||||
SpanOTA spanOTA; // manages OTA process
|
SpanOTA spanOTA; // manages OTA process
|
||||||
|
|
@ -370,6 +371,8 @@ class Span{
|
||||||
LOG0("\n*** AutoPolling Task started with priority=%d\n\n",uxTaskPriorityGet(pollTaskHandle));
|
LOG0("\n*** AutoPolling Task started with priority=%d\n\n",uxTaskPriorityGet(pollTaskHandle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TaskHandle_t getAutoPollTask(){return(pollTaskHandle);}
|
||||||
|
|
||||||
Span& setTimeServerTimeout(uint32_t tSec){webLog.waitTime=tSec*1000;return(*this);} // sets wait time (in seconds) for optional web log time server to connect
|
Span& setTimeServerTimeout(uint32_t tSec){webLog.waitTime=tSec*1000;return(*this);} // sets wait time (in seconds) for optional web log time server to connect
|
||||||
|
|
||||||
[[deprecated("Please use reserveSocketConnections(n) method instead.")]]
|
[[deprecated("Please use reserveSocketConnections(n) method instead.")]]
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
#define MAX_LIGHTS 2
|
#define MAX_LIGHTS 2
|
||||||
|
|
||||||
SpanCharacteristic *brightness[2];
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
@ -53,14 +51,13 @@ void setup() {
|
||||||
new Characteristic::Name(c);
|
new Characteristic::Name(c);
|
||||||
new Service::LightBulb();
|
new Service::LightBulb();
|
||||||
new Characteristic::On(0,true);
|
new Characteristic::On(0,true);
|
||||||
brightness[i]=new Characteristic::Saturation(0,true);
|
new Characteristic::Saturation(0,true);
|
||||||
WEBLOG("Configuring %s\n",c);
|
WEBLOG("Configuring %s\n",c);
|
||||||
}
|
}
|
||||||
|
|
||||||
new SpanUserCommand('w', " - get web log test",webLogTest); // simulate getting an HTTPS request for weblog
|
new SpanUserCommand('w', " - get web log test",webLogTest); // simulate getting an HTTPS request for weblog
|
||||||
new SpanUserCommand('b', " - change brightness to fraction",[](const char *buf){brightness[0]->setVal(atof(buf+1));}); // simulate getting an HTTPS request for weblog
|
|
||||||
new SpanUserCommand('c', " - change brightness to fraction",[](const char *buf){brightness[1]->setVal(atof(buf+1));}); // simulate getting an HTTPS request for weblog
|
|
||||||
|
|
||||||
|
// homeSpan.autoPoll(8192+10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue