From 472894d0e897f86ab9009ca573dd95fce397d276 Mon Sep 17 00:00:00 2001 From: BitMaker Date: Mon, 17 Apr 2023 23:24:42 +0200 Subject: [PATCH] Previous improvements - Checking correctly JSON file before using it - Disable DFU Uart cause gives problems when don't read incoming port data. --- GenerateXMLDPI.code-workspace | 14 ++++++++++++++ huge_app.csv | 6 ++++++ platformio.ini | 7 ++++--- src/mining.cpp | 15 +++++++++++---- 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 GenerateXMLDPI.code-workspace create mode 100644 huge_app.csv diff --git a/GenerateXMLDPI.code-workspace b/GenerateXMLDPI.code-workspace new file mode 100644 index 0000000..022df91 --- /dev/null +++ b/GenerateXMLDPI.code-workspace @@ -0,0 +1,14 @@ +{ + "folders": [ + { + "path": "../../../../../../../Documents/Proyectos/Electrotec/DISPLAYS/SERIES/SERIE DP/SOFTWARE DE TESTEO/PythonScripts/GenerateXMLDPI" + }, + { + "name": "NerdMinerV2", + "path": "." + } + ], + "settings": { + "platformio-ide.useDevelopmentPIOCore": true + } +} \ No newline at end of file diff --git a/huge_app.csv b/huge_app.csv new file mode 100644 index 0000000..61254fc --- /dev/null +++ b/huge_app.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x300000, +spiffs, data, spiffs, 0x310000,0xE0000, +coredump, data, coredump,0x3F0000,0x10000, \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 6273969..c9d5f07 100644 --- a/platformio.ini +++ b/platformio.ini @@ -22,14 +22,15 @@ upload_speed = 921600 # 2 x 4.5MB app, 6.875MB SPIFFS ;board_build.partitions = large_spiffs_16MB.csv -board_build.partitions = default_8MB.csv +;board_build.partitions = default_8MB.csv +board_build.partitions = huge_app.csv ;board_build.partitions = default.csv build_flags = -D LV_LVGL_H_INCLUDE_SIMPLE -D BOARD_HAS_PSRAM - -D ARDUINO_USB_MODE=1 - -D ARDUINO_USB_CDC_ON_BOOT=1 + ;-D ARDUINO_USB_MODE=1 + ;-D ARDUINO_USB_CDC_ON_BOOT=1 -D DEBUG_MINING=1 lib_deps = https://github.com/takkaO/OpenFontRender diff --git a/src/mining.cpp b/src/mining.cpp index 2420e07..31bbb77 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -118,6 +118,7 @@ void runWorker(void *name) { Serial.println(""); Serial.printf("\n[WORKER] Started. Running %s on core %d\n", (char *)name, xPortGetCoreID()); + ;Serial.printf("### [Total Heap / Free heap]: %d / %d \n", ESP.getHeapSize(), ESP.getFreeHeap()); String ADDRESS = String(btcString); @@ -161,10 +162,7 @@ void runWorker(void *name) { Serial.print(" error: "); Serial.println(error); if((extranonce1.length() == 0) || line.length() == 0 || (error != 0)) { Serial.printf("[WORKER] %s >>>>>>>>> Work aborted\n", (char *)name); - Serial.printf("extranonce1 length: %u | line2 length: %u | error code: %u \n", - extranonce1.length(), - line.length(), - error); + Serial.printf("extranonce1 length: %u | line2 length: %u | error code: %u \n", extranonce1.length(), line.length(), error); client.stop(); doc.clear(); doc.garbageCollect(); @@ -204,6 +202,15 @@ void runWorker(void *name) { Serial.print(" ntime: "); Serial.println(ntime); Serial.print(" clean_jobs: "); Serial.println(clean_jobs); #endif + //Check if parameters where correctly received + if((job_id.length() == 0)||(prevhash.length() == 0)||(coinb2.length() == 0)||(ntime.length() == 0)) { + Serial.println(">>>>>>>>> Worker aborted"); + client.stop(); + doc.clear(); + doc.garbageCollect(); + continue; + } + doc.clear(); templates++;