From 3c48d020084a2235d12de946736c5f3b1f40b091 Mon Sep 17 00:00:00 2001 From: Matteo Crippa Date: Sat, 4 Nov 2023 14:49:37 +0100 Subject: [PATCH] introduce new sha1 algo, refactor, linted and performances --- ESP8266_Code/ESP8266_Code.ino | 1025 +++++++++++++++++++++------------ 1 file changed, 657 insertions(+), 368 deletions(-) diff --git a/ESP8266_Code/ESP8266_Code.ino b/ESP8266_Code/ESP8266_Code.ino index ffccd876..1bb877c2 100644 --- a/ESP8266_Code/ESP8266_Code.ino +++ b/ESP8266_Code/ESP8266_Code.ino @@ -16,8 +16,8 @@ /* If optimizations cause problems, change them to -O0 (the default) NOTE: For even better optimizations also edit your Crypto.h file. On linux that file can be found in the following location: - ~/.arduino15//packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/ */ -#pragma GCC optimize ("-Ofast") + ~/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/ */ +#pragma GCC optimize("-Ofast") /* If during compilation the line below causes a "fatal error: arduinoJson.h: No such file or directory" @@ -27,16 +27,6 @@ https://github.com/revoxhere/duino-coin/issues/832 */ #include -/* If during compilation the line below causes a - "fatal error: Crypto.h: No such file or directory" - message to occur; it means that you do NOT have the - latest version of the ESP8266/Arduino Core library. - To install/upgrade it, go to the below link and - follow the instructions of the readme file: - https://github.com/esp8266/Arduino */ -#include -//#include - #include #include #include @@ -134,40 +124,40 @@ void mqttReconnect() namespace { -// Change the part in brackets to your Duino-Coin username -const char *DUCO_USER = "USERNAME"; -// Change the part in brackets to your mining key (if you have enabled it in the wallet) -const char *MINER_KEY = "MINING_KEY"; -// Change the part in brackets to your WiFi name -const char *SSID = "WIFI_NAME"; -// Change the part in brackets to your WiFi password -const char *PASSWORD = "WIFI_PASSWORD"; -// Change the part in brackets if you want to set a custom miner name (use Auto to autogenerate, None for no name) -const char *RIG_IDENTIFIER = "None"; -// Set to true to use the 160 MHz overclock mode (and not get the first share rejected) -const bool USE_HIGHER_DIFF = true; -// Set to true if you want to host the dashboard page (available on ESPs IP address) -const bool WEB_DASHBOARD = false; -// Set to true if you want to update hashrate in browser without reloading the page -const bool WEB_HASH_UPDATER = false; -// Set to false if you want to disable the onboard led blinking when finding shares -const bool LED_BLINKING = true; - -/* Do not change the lines below. These lines are static and dynamic variables - that will be used by the program for counters and measurements. */ -const char * DEVICE = "ESP8266"; -const char * POOLPICKER_URL[] = {"https://server.duinocoin.com/getPool"}; -const char * MINER_BANNER = "Official ESP8266 Miner"; -const char * MINER_VER = "3.5"; -unsigned int share_count = 0; -unsigned int port = 0; -unsigned int difficulty = 0; -float hashrate = 0; -String AutoRigName = ""; -String host = ""; -String node_id = ""; - -const char WEBSITE[] PROGMEM = R"=====( + // Change the part in brackets to your Duino-Coin username + const char DUCO_USER[] = "USERNAME"; + // Change the part in brackets to your mining key (if you have enabled it in the wallet) + const char MINER_KEY[] = "MINING_KEY"; + // Change the part in brackets to your WiFi name + const char SSID[] = "WIFI_NAME"; + // Change the part in brackets to your WiFi password + const char PASSWORD[] = "WIFI_PASSWORD"; + // Change the part in brackets if you want to set a custom miner name (use Auto to autogenerate, None for no name) + const char *RIG_IDENTIFIER = "None"; + // Set to true to use the 160 MHz overclock mode (and not get the first share rejected) + const bool USE_HIGHER_DIFF = true; + // Set to true if you want to host the dashboard page (available on ESPs IP address) + const bool WEB_DASHBOARD = false; + // Set to true if you want to update hashrate in browser without reloading the page + const bool WEB_HASH_UPDATER = false; + // Set to false if you want to disable the onboard led blinking when finding shares + const bool LED_BLINKING = true; + + /* Do not change the lines below. These lines are static and dynamic variables + that will be used by the program for counters and measurements. */ + const char *DEVICE = "ESP8266"; + const char *POOLPICKER_URL[] = {"https://server.duinocoin.com/getPool"}; + const char *MINER_BANNER = "Official ESP8266 Miner"; + const char *MINER_VER = "3.5"; + unsigned int share_count = 0; + unsigned int port = 0; + unsigned int difficulty = 0; + float hashrate = 0; + String AutoRigName = ""; + String host = ""; + String node_id = ""; + + const char WEBSITE[] PROGMEM = R"=====(