mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-06-02 15:32:30 +02:00
ApolloMiner v2 [WIP]
This commit is contained in:
parent
f6cfbcdb97
commit
8aedb9f47a
@ -100,7 +100,7 @@ eval "$NVM_DIR_LINE"
|
|||||||
eval "$NVM_SOURCE_LINE"
|
eval "$NVM_SOURCE_LINE"
|
||||||
|
|
||||||
# Change ownership of /usr/local/nvm to user "futurebit"
|
# Change ownership of /usr/local/nvm to user "futurebit"
|
||||||
sudo chown -R futurebit /usr/local/nvm
|
chown -R futurebit /usr/local/nvm
|
||||||
echo -e "${GREEN} ---> Changed ownership of /usr/local/nvm to futurebit${NC}"
|
echo -e "${GREEN} ---> Changed ownership of /usr/local/nvm to futurebit${NC}"
|
||||||
|
|
||||||
# Install Node.js version 21 using nvm
|
# Install Node.js version 21 using nvm
|
||||||
|
@ -43,40 +43,28 @@ const generate = async function (pools = null, settings = null ) {
|
|||||||
|
|
||||||
const mainPool = _.minBy(pools, 'index');
|
const mainPool = _.minBy(pools, 'index');
|
||||||
|
|
||||||
|
// Get miner mode
|
||||||
|
let minerMode = settings.minerMode;
|
||||||
|
|
||||||
let minerMode = 0,
|
// Get fan settings
|
||||||
frequency = 40;
|
|
||||||
|
|
||||||
switch (settings.minerMode) {
|
|
||||||
case 'eco':
|
|
||||||
minerMode = 1
|
|
||||||
voltage = 48
|
|
||||||
frequency = 30
|
|
||||||
break;
|
|
||||||
case 'balanced':
|
|
||||||
minerMode = 2
|
|
||||||
voltage = 60
|
|
||||||
frequency = 40
|
|
||||||
break;
|
|
||||||
case 'turbo':
|
|
||||||
minerMode = 3
|
|
||||||
voltage = 75
|
|
||||||
frequency = 50
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
minerMode = 0
|
|
||||||
voltage = settings.voltage
|
|
||||||
frequency = settings.frequency
|
|
||||||
}
|
|
||||||
|
|
||||||
const fanLow = (settings.fan_low && settings.fan_low !== 40) ? `-fan_temp_low ${settings.fan_low}` : null;
|
const fanLow = (settings.fan_low && settings.fan_low !== 40) ? `-fan_temp_low ${settings.fan_low}` : null;
|
||||||
const fanHigh = (settings.fan_high && settings.fan_high !== 60) ? `-fan_temp_hi ${settings.fan_high}` : null;
|
const fanHigh = (settings.fan_high && settings.fan_high !== 60) ? `-fan_temp_hi ${settings.fan_high}` : null;
|
||||||
|
|
||||||
|
// Get pool url
|
||||||
const poolUrl = mainPool.url.replace(/^.*\/\//, '');
|
const poolUrl = mainPool.url.replace(/^.*\/\//, '');
|
||||||
|
|
||||||
const [poolHost, poolPort] = poolUrl.split(':');
|
const [poolHost, poolPort] = poolUrl.split(':');
|
||||||
|
|
||||||
let minerConfig = `-host ${poolHost} -port ${poolPort} -user ${mainPool.username} -pswd ${mainPool.password} -brd_ocp ${voltage} -osc ${frequency}`;
|
// Parse miner configuration
|
||||||
|
let minerConfig = `-host ${poolHost} -port ${poolPort} -user ${mainPool.username} -pswd ${mainPool.password}`;
|
||||||
|
|
||||||
|
// Add custom configuration if needed
|
||||||
|
if (settings.minerMode === 'custom') {
|
||||||
|
minerConfig += ` -brd_ocp ${settings.voltage} -osc ${settings.frequency}`;
|
||||||
|
minerMode = 'config';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add fan configuration if needed
|
||||||
if (fanLow) minerConfig += ` ${fanLow}`;
|
if (fanLow) minerConfig += ` ${fanLow}`;
|
||||||
if (fanHigh) minerConfig += ` ${fanHigh}`;
|
if (fanHigh) minerConfig += ` ${fanHigh}`;
|
||||||
|
|
||||||
@ -86,8 +74,9 @@ const generate = async function (pools = null, settings = null ) {
|
|||||||
// Write all configuration file
|
// Write all configuration file
|
||||||
// Conf dir
|
// Conf dir
|
||||||
await fsPromises.mkdir(confDir, { recursive: true });
|
await fsPromises.mkdir(confDir, { recursive: true });
|
||||||
// Conf file
|
// Conf files
|
||||||
await fsPromises.writeFile(confDir + '/miner_config', minerConfig);
|
await fsPromises.writeFile(confDir + '/miner_config', minerConfig);
|
||||||
|
await fsPromises.writeFile(confDir + '/mode', minerMode);
|
||||||
console.log('Configuration saved');
|
console.log('Configuration saved');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error saving configuration files');
|
console.log('Error saving configuration files');
|
||||||
|
Loading…
Reference in New Issue
Block a user