Skip to content

Commit

Permalink
Added fan curve page popover with info & some configuration modificat…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
aredden committed Jan 9, 2021
1 parent 808a325 commit a2c5703
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 6 deletions.
7 changes: 2 additions & 5 deletions electron/src/IPCEvents/ConfigLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ export const buildPath = async () => {
LOGGER.error('Failed to fix configuration.');
dialog.showErrorBox(
'Configuration Error',
'Both local and appdata configuration could not be validated, please reinstall G14ControlV2 to fix.'
'Both local and appdata configuration could not be validated, could be an issue with G14Control, give logs to the developer or open an issue on github.'
);
persistConfig = false;
}
}
}
Expand All @@ -153,10 +154,6 @@ export const buildPath = async () => {
if (ok) {
LOGGER.info('Using appdata persistent config.');
FINAL_CFG_LOC = APPDATA_CONFIG;
let config = JSON.parse(
((await loadConfig()) as Buffer).toString()
) as G14Config;
validateConfig(config);
} else {
LOGGER.info('Using local config.');
FINAL_CFG_LOC = LOCAL_CFG;
Expand Down
24 changes: 24 additions & 0 deletions src/Components/Content/FanCurve.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,27 @@
right: 0px;
top: 20px;
}

.fc-modal-btn {
border: 1px solid gray !important;
width: 1.5rem;
height: 1.5rem;
margin-left: 1rem;
font-size: 13px;
border-radius: 1rem;
color: black;
text-align: center;
line-height: 1.2;
background-color: silver;
position: absolute;
top: 1.7rem;
left: 24rem;
&:focus {
border: 1px solid gray !important;
outline: none;
}
&:hover {
background-color: darken(silver, 10);
cursor: pointer;
}
}
10 changes: 9 additions & 1 deletion src/Components/Content/FanCurve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from '../../Store/ReduxStore';
import Select from './FanCurve/Select';
import './FanCurve.scss';
import { FanCurveModal } from './FanCurve/FanCurvePopper';
interface Props {}

interface State {
Expand Down Expand Up @@ -320,7 +321,14 @@ export default class FanCurve extends Component<Props, State> {
<div>
<PageHeader
title="Fan Curve Editor"
subTitle="Modify fan speed configuration."
subTitle={
<>
<div style={{ width: '20rem', display: 'flex' }}>
Modify fan speed configuration.
</div>
<FanCurveModal />
</>
}
style={{ width: '100%', height: '6rem' }}>
<div className="curveplan-container">
<Select
Expand Down
87 changes: 87 additions & 0 deletions src/Components/Content/FanCurve/FanCurvePopper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/** @format */

import { List } from 'antd';
import React, { Component } from 'react';
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import ReactMarkdown from 'react-markdown';
import Modal from 'antd/lib/modal/Modal';
interface Props {}
interface State {
visible: boolean;
}

interface ModalContainerProps {
clickIt: () => void;
}

class ModalContainer extends Component<ModalContainerProps> {
render() {
let acplan = `**Armoury Crate Plans**
\n
* You can change an Armoury Crate plan without ever touching the "Apply" button.
All you need to do is choose a different radio button, exactly the same as with Armoury Crate itself.
* If you want to create a custom fan curve, it needs to also have an Armoury Crate plan associated with it.
It will use whatever Armoury Crate plan is currently selected in the Armoury Crate plan box.
* If a fan curve is currently applied, and you change the Armoury Crate plan, it will overwrite the fan curve
and use the standard fan curve for the selected Armoury Crate plan.
* Armoury Crate plans will actually do more than set a fan curve, for instance, the "Silent" plan will actually
throttle the CPU wattages set by ryzenadj / CPU Tuning, by about 20%. The "Windows" plan is actually exactly
the same as the "Performance" plan, but in Armoury Crate it also sets the windows plan to "Balanced". In this app
it doesn't actually do anything different than the "Performance" plan. I'm not as sure about the "Turbo" plan, but
I assume it does some other tweaks under the hood, or it just sets a more aggressive default fan curve. \n
**Custom Fan Curves**\n
* If the custom fan curves dropdown title is blank, that means no fan curve is selected.
* To select a curve, click the dropdown and select a custom fan curve.
* Selecting a fan curve will not apply it, for that you need to click the "Apply" button.
* Any changes made to the fan curve before applying the plan will apply the modifications to the selected plan
when you click "Apply", including modifications to the selected Armoury Crate plan.`;

return (
<div onClick={this.props.clickIt}>
<List style={{ display: 'block', maxWidth: '100%' }}>
<List.Item
style={{ display: 'block', fontSize: '1.2vw' }}
title="yes">
<ReactMarkdown>{acplan}</ReactMarkdown>
</List.Item>
</List>
</div>
);
}
}

export class FanCurveModal extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = { visible: false };
}

clickModal = () => {
this.setState({ visible: !this.state.visible });
};

render() {
return (
<>
<Modal
title="Fan Curve Editor Info"
onOk={() => this.setState({ visible: !this.state.visible })}
onCancel={() => this.setState({ visible: !this.state.visible })}
width={'90vw'}
footer={null}
visible={this.state.visible}
cancelButtonProps={{ style: { display: 'none' } }}>
<ModalContainer clickIt={this.clickModal} />
</Modal>

<button
className="fc-modal-btn"
onClick={() => this.setState({ visible: !this.state.visible })}>
{' '}
<FontAwesomeIcon width="14px" icon={faQuestion}></FontAwesomeIcon>
</button>
</>
);
}
}

0 comments on commit a2c5703

Please sign in to comment.