Skip to content

Commit

Permalink
v0.1.36, fixed g14control plans not applying ryzenadj (clash with arm…
Browse files Browse the repository at this point in the history
…oury crate plan), fixed auto switching showing as coming soon, fixed redux issues with min to tray/taskbar
  • Loading branch information
aredden committed Jan 2, 2021
1 parent 7a49947 commit c1d2091
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 22 deletions.
40 changes: 21 additions & 19 deletions electron/src/IPCEvents/G14ControlPlans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,6 @@ export const setG14ControlPlan = async (plan: FullG14ControlPlan) => {
LOGGER.info(
'Successfully switched windows plan to target plan.'
);
if (ryzenadj) {
let { fastLimit, slowLimit, stapmLimit } = ryzenadj;
ryzenadj = Object.assign(ryzenadj, {
fastLimit:
fastLimit % 1000 === 0 ? fastLimit : fastLimit * 1000,
slowLimit:
slowLimit % 1000 === 0 ? slowLimit : slowLimit * 1000,
stapmLimit:
stapmLimit % 1000 === 0 ? stapmLimit : stapmLimit * 1000,
});
}
let ryzn = ryzenadj ? await setRyzenadj(ryzenadj) : true;
if (!ryzn) {
let final = await keepAttemptRyzenADJ(ryzenadj, 6);
if (!final) {
resolve(false);
return;
}
}
if (fanCurve) {
let { cpu, gpu, plan } = fanCurve;
let gpuCurve = gpu ? parseArrayCurve(gpu) : undefined;
Expand All @@ -223,6 +204,27 @@ export const setG14ControlPlan = async (plan: FullG14ControlPlan) => {
}
}
} else {
if (ryzenadj) {
let { fastLimit, slowLimit, stapmLimit } = ryzenadj;
ryzenadj = Object.assign(ryzenadj, {
fastLimit:
fastLimit % 1000 === 0 ? fastLimit : fastLimit * 1000,
slowLimit:
slowLimit % 1000 === 0 ? slowLimit : slowLimit * 1000,
stapmLimit:
stapmLimit % 1000 === 0
? stapmLimit
: stapmLimit * 1000,
});
}
let ryzn = ryzenadj ? await setRyzenadj(ryzenadj) : true;
if (!ryzn) {
let final = await keepAttemptRyzenADJ(ryzenadj, 6);
if (!final) {
resolve(false);
return;
}
}
LOGGER.info('Sucessfully applied G14ControlPlan');
resolve(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Content/G14Plans/AutoPowerSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class AutoPowerSwitch extends Component<Props, State> {

return (
<>
<Card title={'Auto Power Switching - Coming soon'}>
<Card title={'Auto Power Switching'}>
<Space direction="horizontal" className="powersw-container">
<div>
<label style={{ marginRight: '.5rem' }} htmlFor="checkAutoSwitch">
Expand Down
84 changes: 84 additions & 0 deletions src/Components/Content/Settings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/** @format */

.Ubsnp {
width: 11rem;
}

.jawRkx {
-moz-box-align: center;
align-items: center;
backface-visibility: hidden;
background-color: rgb(255, 66, 77);
border-radius: 9999px;
border: 1px solid rgb(255, 66, 77);
box-sizing: border-box;
color: rgb(255, 255, 255) !important;
cursor: pointer;
display: inline-flex;
font-size: 0.875rem !important;
font-weight: 500;
height: unset;
-moz-box-pack: center;
justify-content: center;
padding: 0.46875rem 1rem;
position: relative;
pointer-events: unset;
text-align: center;
text-decoration: none;
text-transform: none;
transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1) 0s;
user-select: none;
white-space: unset;
width: 100%;

.cPWiv {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 2000;
flex-direction: column;
-moz-box-pack: center;
justify-content: center;
-moz-box-align: center;
align-items: center;
display: none;
}

.crxLyS {
-moz-box-align: center;
align-items: center;
display: flex;
-moz-box-pack: center;
justify-content: center;
visibility: visible;
}

.iAwAuh {
align-self: center;
-moz-box-align: center;
align-items: center;
display: inline-flex;
filter: none;
cursor: unset;
vertical-align: unset;
height: unset;
width: unset;
}

.iQIUpy,
.iQIUpy svg {
height: 1rem;
width: 1rem;
}

.iQIUpy {
display: flex;
}

.hCtHOK {
height: 1px;
width: 0.5rem;
}
}
64 changes: 64 additions & 0 deletions src/Components/Content/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { store, updateROGKey, updateShortcuts } from '../../Store/ReduxStore';
import { capitalize } from 'lodash';
import ReactMarkdown from 'react-markdown';
import StartMinimized from './Settings/StartMinimized';
import './Settings.scss';

interface Props {}

Expand Down Expand Up @@ -324,6 +325,69 @@ to perform well, I decided to embark on making a new version, and this is the re
<Card title={'About G14ControlV2'}>
<ReactMarkdown>{aboutmkd}</ReactMarkdown>
<Space>
<div className="fpvra8-0 Ubsnp">
<button
className="sc-fzoiQi jawRkx"
color="primary"
tabIndex={0}
type="button"
onClick={(e) => {
e.preventDefault();
window.shell.openExternal(
'https://www.patreon.com/bePatron?u=34282440'
);
}}>
<div tabIndex={-1} className="sc-fznJRM cPWiv">
<svg
aria-label="Loading"
viewBox="0 0 64 64"
className="sc-fzqBZW bhSJWO">
<circle
cx="32"
cy="32"
style={{ background: 'white' }}
r="32"
className="sc-fzqNJr gmvqCk"></circle>
<circle
color="light"
cx="32"
style={{ background: 'white' }}
cy="32"
r="32"
stroke-linecap="round"
className="sc-fzoyAV tgcnf"></circle>
</svg>
</div>
<div className="sc-fznxsB crxLyS">
<div className="sc-fznyAO iAwAuh">
<span className="sc-fzplWN iQIUpy">
<svg
viewBox="0 0 569 546"
xmlns="http://www.w3.org/2000/svg">
<g>
<circle
cx="362.589996"
cy="204.589996"
style={{ background: 'white' }}
data-fill="1"
id="Oval"
r="204.589996"></circle>
<rect
data-fill="2"
height="545.799988"
style={{ background: 'white' }}
id="Rectangle"
width="100"
x="0"
y="0"></rect>
</g>
</svg>
</span>
</div>
<div className="sc-fznWqX hCtHOK"></div>Become a patron
</div>
</button>
</div>
<button
onClick={(e) => {
e.preventDefault();
Expand Down
21 changes: 19 additions & 2 deletions src/Store/ReduxStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const createRootReducer = (initialState: G14Config) => {
rogKey: state.current.rogKey,
batteryLimit: state.current.batteryLimit,
shortcuts: state.current.shortcuts,
minToTray: state.current.minToTray,
},
});
state = newState;
Expand Down Expand Up @@ -255,6 +256,7 @@ const createRootReducer = (initialState: G14Config) => {
batteryLimit: action.payload,
batteryLimitStatus: state.current.batteryLimitStatus,
shortcuts: state.current.shortcuts,
minToTray: state.current.minToTray,
},
});
state = newState;
Expand All @@ -270,14 +272,21 @@ const createRootReducer = (initialState: G14Config) => {
batteryLimit: state.current.batteryLimit,
batteryLimitStatus: action.payload,
shortcuts: state.current.shortcuts,
minToTray: state.current.minToTray,
},
});
state = newState;
return state;
});

reducer.addCase(updateROGKey, (state, action) => {
let { ryzenadj, fanCurve, batteryLimit, shortcuts } = state.current;
let {
ryzenadj,
fanCurve,
batteryLimit,
shortcuts,
minToTray,
} = state.current;
let newState: G14Config = Object.assign(state, {
current: {
ryzenadj,
Expand All @@ -289,6 +298,7 @@ const createRootReducer = (initialState: G14Config) => {
func: action.payload.func,
armouryCrate: action.payload.armouryCrate,
},
minToTray,
},
});
state = newState;
Expand All @@ -300,7 +310,13 @@ const createRootReducer = (initialState: G14Config) => {
return state;
});
reducer.addCase(updateArmouryPlan, (state, action) => {
let { ryzenadj, batteryLimit, shortcuts, rogKey } = state.current;
let {
ryzenadj,
batteryLimit,
shortcuts,
rogKey,
minToTray,
} = state.current;
let newState: G14Config = Object.assign(state, {
current: {
ryzenadj,
Expand All @@ -311,6 +327,7 @@ const createRootReducer = (initialState: G14Config) => {
batteryLimit,
shortcuts,
rogKey,
minToTray,
},
armouryPlan: action.payload,
});
Expand Down

0 comments on commit c1d2091

Please sign in to comment.