Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #78 from ricaun/develop
Browse files Browse the repository at this point in the history
Update to 3.0
  • Loading branch information
ricaun authored Feb 1, 2022
2 parents d55eef0 + 92a5fb9 commit 564118f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
29 changes: 14 additions & 15 deletions DuinoCoin_Esp_Async_Master/DuinoCoin_Clients.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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)
{
Expand Down
12 changes: 6 additions & 6 deletions DuinoCoin_Esp_Async_Master/DuinoCoin_Esp_Async_Master.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ESP8266WiFi.h> // Include WiFi library
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 564118f

Please sign in to comment.