Stack overflow issue for Monitor task fix

This commit is contained in:
Roman Mashta 2023-09-03 23:52:24 +03:00
parent fc23e9797e
commit 6d245aa1ac
3 changed files with 11 additions and 27 deletions

View File

@ -91,7 +91,7 @@ void setup()
Serial.println("Initiating tasks...");
char *name = (char*) malloc(32);
sprintf(name, "(%s)", "Monitor");
BaseType_t res1 = xTaskCreatePinnedToCore(runMonitor, "Monitor", 5000, (void*)name, 4, NULL,1);
BaseType_t res1 = xTaskCreatePinnedToCore(runMonitor, "Monitor", 10000, (void*)name, 4, NULL,1);
/******** CREATE STRATUM TASK *****/
sprintf(name, "(%s)", "Stratum");

View File

@ -405,6 +405,11 @@ void runMonitor(void *name)
mMiner.newJob ? "true" : "false", mMiner.inRun ? "true" : "false",
client.connected() ? "true" : "false", isMinerSuscribed ? "true" : "false", WiFi.status() == WL_CONNECTED ? "true" : "false");
}
#ifdef DEBUG_MEMORY
Serial.printf("### [Total Heap / Free heap]: %d / %d \n", ESP.getHeapSize(), ESP.getFreeHeap());
Serial.printf("### Max stack usage: %d\n", uxTaskGetStackHighWaterMark(NULL));
#endif
}
animateCurrentScreen(frame);
doLedStuff(frame);

View File

@ -55,7 +55,7 @@ void updateGlobalData(void){
http.begin(getGlobalHash);
int httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
DynamicJsonDocument doc(1024);
@ -76,32 +76,11 @@ void updateGlobalData(void){
http.end();
//OLD code gets remaining blocks to next difficulty ajustment
/*//Make second API call to get remaining Blocks
http.begin(getDifficulty);
httpCode = http.GET();
if (httpCode > 0) {
String payload = http.getString();
DynamicJsonDocument doc(1024);
deserializeJson(doc, payload);
String temp = "";
if (doc.containsKey("progressPercent")) gData.progressPercent = doc["progressPercent"].as<float>();
if (doc.containsKey("remainingBlocks")) gData.remainingBlocks = doc["remainingBlocks"].as<int>();
doc.clear();
mGlobalUpdate = millis();
}
http.end();*/
//Make third API call to get fees
http.begin(getFees);
httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
DynamicJsonDocument doc(1024);
@ -131,7 +110,7 @@ String getBlockHeight(void){
http.begin(getHeightAPI);
int httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
payload.trim();
@ -159,7 +138,7 @@ String getBTCprice(void){
http.begin(getBTCAPI);
int httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
DynamicJsonDocument doc(1024);