diff --git a/DuinoCoin_Esp_Async_Master/DuinoCoin_Clients.ino b/DuinoCoin_Esp_Async_Master/DuinoCoin_Clients.ino index 3d26f36..eedfcc4 100644 --- a/DuinoCoin_Esp_Async_Master/DuinoCoin_Clients.ino +++ b/DuinoCoin_Esp_Async_Master/DuinoCoin_Clients.ino @@ -23,10 +23,10 @@ #define END_TOKEN '\n' #define SEP_TOKEN ',' -#define HASHRATE_FORCE true -#define HASHRATE_SPEED 195.0 +#define HASHRATE_FORCE false +#define HASHRATE_SPEED 258.0 -String host = "51.158.182.90"; +String host = ""; int port = 6000; void SetHostPort(String h, int p) @@ -234,7 +234,7 @@ void clients_waitRequestJob(byte i) Serial.println(clientBuffer); // Not a Valid Job -> Request Again - if (clientBuffer.indexOf(',') == -1) + if (clientBuffer.indexOf(SEP_TOKEN) == -1) { clients_stop(i); return; @@ -262,27 +262,26 @@ void clients_sendJobDone(byte i) StreamString response; response.print(responseJob); - int job = response.readStringUntil(',').toInt(); - int time = response.readStringUntil(',').toInt(); - String id = response.readStringUntil('\n'); + int job = response.readStringUntil(SEP_TOKEN).toInt(); + int time = response.readStringUntil(SEP_TOKEN).toInt(); + String id = response.readStringUntil(END_TOKEN); float HashRate = job / (time * .000001f); - if (HASHRATE_FORCE) // Force HashRate to slow down + if (HASHRATE_FORCE) // Force HashRate { Serial.print("[" + String(i) + "]"); - Serial.println("Slow down HashRate: " + String(HashRate, 2)); + Serial.println("Force HashRate: " + String(HashRate, 2)); HashRate = HASHRATE_SPEED + random(-50, 50) / 100.0; } - if (id.length() > 0) id = "," + id; + if (id.length() > 0) id = SEP_TOKEN + id; - String identifier = String(rigIdentifier) + "-" + String(i); + String identifier = String(rigIdentifier) + " " + "[" +String(i) + "]"; - clients[i].print(String(job) + "," + String(HashRate, 2) + "," + MINER + "," + String(identifier) + id); + clients[i].print(String(job) + SEP_TOKEN + String(HashRate, 2) + SEP_TOKEN + MINER + SEP_TOKEN + String(identifier) + id); Serial.print("[" + String(i) + "]"); - Serial.println(String(job) + "," + String(HashRate, 2) + "," + MINER + "," + String(identifier) + id); - //Serial.println("Job Done: (" + String(job) + ")" + " Hashrate: " + String(HashRate)); + Serial.println(String(job) + SEP_TOKEN + String(HashRate, 2) + SEP_TOKEN+ MINER + SEP_TOKEN + String(identifier) + id); clients_state(i, DUINO_STATE_JOB_DONE_WAIT); } @@ -303,7 +302,7 @@ void clients_waitFeedbackJobDone(byte i) clients_state(i, DUINO_STATE_JOB_REQUEST); - if (clientBuffer == "BAD") + if (clientBuffer.indexOf("BAD") != -1) { if (clientsBadJob[i]++ > 3) { diff --git a/DuinoCoin_Esp_Async_Master/DuinoCoin_Esp_Async_Master.ino b/DuinoCoin_Esp_Async_Master/DuinoCoin_Esp_Async_Master.ino index 603cb94..581b7b4 100644 --- a/DuinoCoin_Esp_Async_Master/DuinoCoin_Esp_Async_Master.ino +++ b/DuinoCoin_Esp_Async_Master/DuinoCoin_Esp_Async_Master.ino @@ -13,10 +13,10 @@ void Wire_send(byte address, String message); String wire_readLine(int address); boolean wire_runEvery(unsigned long interval); -const char* ssid = ""; // Change this to your WiFi SSID -const char* password = ""; // Change this to your WiFi password -const char* ducouser = "ricaun"; // Change this to your Duino-Coin username -const char* rigIdentifier = "AVR-I2C"; // Change this if you want a custom miner name +const char* ssid = ""; // Change this to your WiFi SSID +const char* password = ""; // Change this to your WiFi password +const char* ducouser = "ricaun"; // Change this to your Duino-Coin username +const char* rigIdentifier = "AVR I²C v3.0"; // Change this if you want a custom miner name #if ESP8266 #include // Include WiFi library @@ -37,13 +37,13 @@ const char* rigIdentifier = "AVR-I2C"; // Change this if you want a custom mine #if ESP8266 #define LED_BUILTIN 2 -#define MINER "AVR I2C v2.7.3" +#define MINER "AVR I²C v3.0" #define JOB "AVR" #endif #if ESP32 #define LED_BUILTIN 2 -#define MINER "AVR I2C v2.7.3" +#define MINER "AVR I²C v3.0" #define JOB "AVR" #endif diff --git a/README.md b/README.md index caea02a..c0fc2c8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Using the I2C communication to connect all the boards and make a scalable commun ## Version -DuinoCoinI2C -> DuinoCoin Version 2.7.3 +DuinoCoinI2C -> DuinoCoin Version 3.0 # Arduino - Slave