mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-29 11:11:45 +01:00
organize init process for Hex
This commit is contained in:
parent
8461777023
commit
a33e40c23f
@ -5,6 +5,7 @@ SRCS
|
||||
"EMC2101.c"
|
||||
"EMC2302.c"
|
||||
"TPS546.c"
|
||||
"TMP1075.c"
|
||||
"fonts.c"
|
||||
"i2c_master.c"
|
||||
"INA260.c"
|
||||
|
@ -43,9 +43,9 @@ bool TMP1075_installed(int device_index)
|
||||
esp_err_t result = ESP_OK;
|
||||
|
||||
// read the configuration register
|
||||
ESP_LOGI(TAG, "Reading configuration register");
|
||||
//ESP_LOGI(TAG, "Reading configuration register");
|
||||
ESP_ERROR_CHECK(register_read(TMP1075_I2CADDR_DEFAULT + device_index, TMP1075_CONFIG_REG, data, 2));
|
||||
ESP_LOGI(TAG, "Configuration[%d] = %02X %02X", device_index, data[0], data[1]);
|
||||
//ESP_LOGI(TAG, "Configuration[%d] = %02X %02X", device_index, data[0], data[1]);
|
||||
|
||||
return (result == ESP_OK?true:false);
|
||||
}
|
||||
@ -56,7 +56,7 @@ uint8_t TMP1075_read_temperature(int device_index)
|
||||
|
||||
ESP_ERROR_CHECK(register_read(TMP1075_I2CADDR_DEFAULT + device_index, TMP1075_TEMP_REG, data, 2));
|
||||
//ESP_LOGI(TAG, "Raw Temperature = %02X %02X", data[0], data[1]);
|
||||
ESP_LOGI(TAG, "Temperature[%d] = %d", device_index, data[0]);
|
||||
//ESP_LOGI(TAG, "Temperature[%d] = %d", device_index, data[0]);
|
||||
return data[0];
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ int TPS546_init(void)
|
||||
float vin;
|
||||
float iout;
|
||||
float vout;
|
||||
uint8_t read_mfr_revision[3];
|
||||
uint8_t read_mfr_revision[4];
|
||||
int temp;
|
||||
uint8_t comp_config[5];
|
||||
|
||||
@ -381,6 +381,7 @@ int TPS546_init(void)
|
||||
smb_read_block(PMBUS_IC_DEVICE_ID, data, 6);
|
||||
ESP_LOGI(TAG, "Device ID: %02x %02x %02x %02x %02x %02x", data[0], data[1],
|
||||
data[2], data[3], data[4], data[5]);
|
||||
/* There's two different known device IDs observed so far */
|
||||
if ( (memcmp(data, DEVICE_ID1, 6) != 0) && (memcmp(data, DEVICE_ID2, 6) != 0) )
|
||||
{
|
||||
ESP_LOGI(TAG, "ERROR- cannot find TPS546 regulator");
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "i2c_master.h"
|
||||
#include "EMC2101.h"
|
||||
#include "EMC2302.h"
|
||||
#include "TMP1075.h"
|
||||
#include "INA260.h"
|
||||
#include "adc.h"
|
||||
#include "connect.h"
|
||||
@ -96,10 +97,17 @@ static void _init_system(GlobalState * GLOBAL_STATE)
|
||||
EMC2101_set_fan_speed(1);
|
||||
break;
|
||||
case DEVICE_HEX:
|
||||
// Fan Tests
|
||||
EMC2302_init(nvs_config_get_u16(NVS_CONFIG_INVERT_FAN_POLARITY, 1));
|
||||
EMC2302_set_fan_speed(0, (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100) / 100);
|
||||
EMC2302_set_fan_speed(1, (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100) / 100);
|
||||
// Fan config - Hex has two fans
|
||||
//EMC2302_init(nvs_config_get_u16(NVS_CONFIG_INVERT_FAN_POLARITY, 1));
|
||||
//EMC2302_set_fan_speed(0, (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100) / 100);
|
||||
//EMC2302_set_fan_speed(1, (float) nvs_config_get_u16(NVS_CONFIG_FAN_SPEED, 100) / 100);
|
||||
// temperature sensors - Hex has two sensors
|
||||
if (TMP1075_installed(0)) {
|
||||
ESP_LOGI(TAG, "Temperature sensor 0: %d", TMP1075_read_temperature(0));
|
||||
}
|
||||
if (TMP1075_installed(1)) {
|
||||
ESP_LOGI(TAG, "Temperature sensor 1: %d", TMP1075_read_temperature(1));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user