added default difficulty to menuconfig and got rid of the I2C pin config

This commit is contained in:
Skot Croshere 2023-05-30 20:40:39 -04:00 committed by johnny9
parent dcc74213d4
commit d23a55608c
6 changed files with 43 additions and 33 deletions

View File

@ -3,8 +3,8 @@
#include "esp_log.h"
#include "driver/i2c.h"
#define I2C_MASTER_SCL_IO CONFIG_I2C_MASTER_SCL /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO CONFIG_I2C_MASTER_SDA /*!< GPIO number used for I2C master data */
#define I2C_MASTER_SCL_IO 48 /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO 47 /*!< GPIO number used for I2C master data */
#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */
@ -120,7 +120,7 @@ bool DS4432U_set_vcore(float core_voltage) {
reg_setting = voltage_to_reg(core_voltage);
ESP_LOGI(TAG, "Test set %.3fV = 0x%02X", core_voltage, reg_setting);
ESP_LOGI(TAG, "Set BM1397 voltage = %.3fV [0x%02X]", core_voltage, reg_setting);
DS4432U_set(reg_setting); ///eek!

View File

@ -4,8 +4,8 @@
#include "EMC2101.h"
#define I2C_MASTER_SCL_IO CONFIG_I2C_MASTER_SCL /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO CONFIG_I2C_MASTER_SDA /*!< GPIO number used for I2C master data */
#define I2C_MASTER_SCL_IO 48 /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO 47 /*!< GPIO number used for I2C master data */
#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */

View File

@ -4,8 +4,8 @@
#include "INA260.h"
#define I2C_MASTER_SCL_IO CONFIG_I2C_MASTER_SCL /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO CONFIG_I2C_MASTER_SDA /*!< GPIO number used for I2C master data */
#define I2C_MASTER_SCL_IO 48 /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO 47 /*!< GPIO number used for I2C master data */
#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */

View File

@ -1,44 +1,51 @@
menu "Example Configuration"
menu "Bitaxe Configuration"
config I2C_MASTER_SCL
int "SCL GPIO Num"
default 6 if IDF_TARGET_ESP32C3
default 48 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
config BM1397_VOLTAGE
int "ASIC Core Voltage (mV)"
range 1000 1800
default 1400
help
GPIO number for I2C Master clock line.
The core voltage to set the BM1397 ASIC to.
endmenu
config I2C_MASTER_SDA
int "SDA GPIO Num"
default 5 if IDF_TARGET_ESP32C3
default 47 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
help
GPIO number for I2C Master data line.
menu "Stratum Configuration"
config EXAMPLE_STRATUM_URL
config STRATUM_URL
string "Stratum Address"
default "solo.ckpool.org"
help
The example will connect to this Stratum pool address.
config EXAMPLE_STRATUM_PORT
config STRATUM_PORT
int "Stratum Port"
range 0 65535
default 3333
help
The stratum server port to connect to.
config EXAMPLE_STRATUM_USER
config STRATUM_USER
string "Stratum username"
default ""
help
Stratum user to use with pool
config EXAMPLE_STRATUM_PW
config STRATUM_PW
string "Stratum password"
default "x"
help
Stratum password to use with pool
config STRATUM_DIFFICULTY
int "Stratum default difficulty"
range 0 4294967296
default 1000
help
A starting difficulty to use with the pool.
endmenu
menu "Example Configuration"
choice EXAMPLE_SOCKET_IP_INPUT
prompt "Socket example source"
default EXAMPLE_SOCKET_IP_INPUT_STRING

View File

@ -27,13 +27,15 @@
#include <pthread.h>
#define PORT CONFIG_EXAMPLE_STRATUM_PORT
#define STRATUM_URL CONFIG_EXAMPLE_STRATUM_URL
#define STRATUM_USER CONFIG_EXAMPLE_STRATUM_USER
#define STRATUM_PW CONFIG_EXAMPLE_STRATUM_PW
#define PORT CONFIG_STRATUM_PORT
#define STRATUM_URL CONFIG_STRATUM_URL
#define STRATUM_USER CONFIG_STRATUM_USER
#define STRATUM_PW CONFIG_STRATUM_PW
#define STRATUM_DIFFICULTY CONFIG_STRATUM_DIFFICULTY
static const char *TAG = "stratum client";
static const char *TAG = "miner";
TaskHandle_t sysTaskHandle = NULL;
TaskHandle_t serialTaskHandle = NULL;
@ -146,7 +148,7 @@ static void AsicTask(void * pvParameters)
if (nonce_diff > stratum_difficulty)
{
print_hex((uint8_t *)&job, sizeof(struct job_packet), sizeof(struct job_packet), "job: ");
//print_hex((uint8_t *)&job, sizeof(struct job_packet), sizeof(struct job_packet), "job: ");
submit_share(sock, STRATUM_USER, active_jobs[nonce.job_id]->jobid, active_jobs[nonce.job_id]->ntime,
active_jobs[nonce.job_id]->extranonce2, nonce.nonce);
}
@ -265,13 +267,12 @@ static void admin_task(void * pvParameters)
ESP_LOGI(TAG, "Extranonce: %s", extranonce_str);
ESP_LOGI(TAG, "Extranonce 2 length: %d", extranonce_2_len);
suggest_difficulty(sock, 100);
suggest_difficulty(sock, STRATUM_DIFFICULTY);
while (1)
{
char * line = receive_jsonrpc_line(sock);
ESP_LOGI(TAG, "Received line: %s", line);
ESP_LOGI(TAG, "Received line length: %d", strlen(line));
ESP_LOGI(TAG, "%s", line); //debug incoming stratum messages
stratum_method method = parse_stratum_method(line);
if (method == MINING_NOTIFY) {

View File

@ -14,6 +14,8 @@
static const char *TAG = "system";
#define BM1397_VOLTAGE CONFIG_BM1397_VOLTAGE
void init_system(void) {
//test the LEDs
@ -32,7 +34,7 @@ void init_system(void) {
ADC_init();
//DS4432U tests
DS4432U_set_vcore(1.4);
DS4432U_set_vcore(BM1397_VOLTAGE / 1000.0);
//Fan Tests
EMC2101_init();