added vCore to log output
This commit is contained in:
parent
df42d18944
commit
1545cfabb4
@ -66,8 +66,9 @@ void tDisplay_MinerScreen(unsigned long mElapsed)
|
||||
// Print background screen
|
||||
background.pushImage(0, 0, MinerWidth, MinerHeight, MinerScreen);
|
||||
#ifdef NERD_NOS
|
||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s GH/s, %s °C\n",
|
||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str(), data.currentTemperature.c_str());
|
||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s GH/s, vCore: %smV, temp: %s °C\n",
|
||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str(),
|
||||
data.vcore.c_str(), data.currentTemperature.c_str());
|
||||
#else
|
||||
Serial.printf(">>> Completed %s share(s), %s Khashes, avg. hashrate %s KH/s\n",
|
||||
data.completedShares.c_str(), data.totalKHashes.c_str(), data.currentHashRate.c_str());
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include "driver/adc.h"
|
||||
#include "esp_adc_cal.h"
|
||||
|
||||
#define ADC_CHANNEL ADC1_CHANNEL_1 // GPIO2 corresponds to ADC1 channel 1 on ESP32-S3
|
||||
#define NTC_CHANNEL ADC1_CHANNEL_1 // 10k NTC
|
||||
#define VCORE_CHANNEL ADC1_CHANNEL_2 // vcore voltage
|
||||
#define BETA 3380 // Beta value of the thermistor
|
||||
#define R0 10000 // Resistance at 25°C (10kΩ)
|
||||
#define ADC_MAX 4095 // Max ADC value for 12-bit resolution
|
||||
@ -15,7 +16,9 @@ static esp_adc_cal_characteristics_t adc1_chars;
|
||||
void nerdnos_adc_init() {
|
||||
// Configure the ADC
|
||||
adc1_config_width(ADC_WIDTH_BIT_12); // Set ADC width (12-bit)
|
||||
adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN_DB_11); // Set attenuation to read the full range of 0 to 3.3V
|
||||
adc1_config_channel_atten(NTC_CHANNEL, ADC_ATTEN_DB_11); // Set attenuation to read the full range of 0 to 3.3V
|
||||
adc1_config_channel_atten(VCORE_CHANNEL, ADC_ATTEN_DB_11); // Set attenuation to read the full range of 0 to 3.3V
|
||||
|
||||
|
||||
// Characterize ADC at given attenuation
|
||||
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, 0, &adc1_chars);
|
||||
@ -23,7 +26,7 @@ void nerdnos_adc_init() {
|
||||
|
||||
float nerdnos_get_temperature() {
|
||||
// Convert the raw ADC value to a voltage using esp_adc_cal
|
||||
uint32_t voltage_mv = esp_adc_cal_raw_to_voltage(adc1_get_raw(ADC_CHANNEL), &adc1_chars); // Voltage in millivolts
|
||||
uint32_t voltage_mv = esp_adc_cal_raw_to_voltage(adc1_get_raw(NTC_CHANNEL), &adc1_chars); // Voltage in millivolts
|
||||
|
||||
// Convert millivolts to volts
|
||||
float voltage = voltage_mv / 1000.0;
|
||||
@ -46,3 +49,8 @@ float nerdnos_get_temperature() {
|
||||
|
||||
return temperature_celsius;
|
||||
}
|
||||
|
||||
float nerdnos_get_vcore() {
|
||||
return esp_adc_cal_raw_to_voltage(adc1_get_raw(VCORE_CHANNEL), &adc1_chars);
|
||||
}
|
||||
|
||||
|
@ -2,3 +2,4 @@
|
||||
|
||||
void nerdnos_adc_init();
|
||||
float nerdnos_get_temperature();
|
||||
float nerdnos_get_vcore();
|
||||
|
@ -248,6 +248,10 @@ String getCurrentHashRate(unsigned long mElapsed) {
|
||||
String getCurrentTemperature() {
|
||||
return String(nerdnos_get_temperature(), 2);
|
||||
}
|
||||
|
||||
String getCurrentVCore() {
|
||||
return String(nerdnos_get_vcore(), 2);
|
||||
}
|
||||
#else
|
||||
String getCurrentHashRate(unsigned long mElapsed)
|
||||
{
|
||||
@ -257,6 +261,10 @@ String getCurrentHashRate(unsigned long mElapsed)
|
||||
String getCurrentTemperature() {
|
||||
return String(0.0, 2);
|
||||
}
|
||||
|
||||
String getCurrentVCore() {
|
||||
return String(0.0, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
mining_data getMiningData(unsigned long mElapsed)
|
||||
@ -279,6 +287,7 @@ mining_data getMiningData(unsigned long mElapsed)
|
||||
data.totalKHashes = totalKHashes;
|
||||
data.currentHashRate = getCurrentHashRate(mElapsed);
|
||||
data.currentTemperature = getCurrentTemperature();
|
||||
data.vcore = getCurrentVCore();
|
||||
data.templates = templates;
|
||||
data.bestDiff = best_diff_string;
|
||||
data.timeMining = timeMining;
|
||||
|
@ -74,6 +74,7 @@ typedef struct {
|
||||
String temp;
|
||||
String currentTime;
|
||||
String currentTemperature;
|
||||
String vcore;
|
||||
}mining_data;
|
||||
|
||||
typedef struct {
|
||||
|
Loading…
Reference in New Issue
Block a user