Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Updated display splash and fixed some add-on spacing (#19)
Browse files Browse the repository at this point in the history
Updated display splash to Enable/Disable and just display the splash image loaded.
  • Loading branch information
arntsonl authored Feb 13, 2023
1 parent 55738ab commit 6d0fd09
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 63 deletions.
85 changes: 49 additions & 36 deletions src/Pages/AddonsConfigPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export default function AddonsConfigPage() {
id="AnalogInputOptions"
hidden={!values.AnalogInputEnabled}>
<p>Available pins: {ANALOG_PINS.join(", ")}</p>
<Col>
<Row class="mb-3">
<FormSelect
label="Analog Stick X Pin"
name="analogAdcPinX"
Expand All @@ -339,7 +339,7 @@ export default function AddonsConfigPage() {
>
{ANALOG_PINS.map((i) => <option key={`analogPins-option-${i}`} value={i}>{i}</option>)}
</FormSelect>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -356,7 +356,7 @@ export default function AddonsConfigPage() {
<div
id="TurboInputOptions"
hidden={!values.TurboInputEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="Turbo Pin"
name="turboPin"
Expand Down Expand Up @@ -393,7 +393,7 @@ export default function AddonsConfigPage() {
min={2}
max={30}
/>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -410,7 +410,7 @@ export default function AddonsConfigPage() {
<div
id="JSliderInputOptions"
hidden={!values.JSliderInputEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="Slider LS Pin"
name="sliderLSPin"
Expand All @@ -435,7 +435,7 @@ export default function AddonsConfigPage() {
min={-1}
max={29}
/>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -452,7 +452,7 @@ export default function AddonsConfigPage() {
<div
id="ReverseInputOptions"
hidden={!values.ReverseInputEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="Reverse Input Pin"
name="reversePin"
Expand All @@ -477,6 +477,8 @@ export default function AddonsConfigPage() {
min={-1}
max={29}
/>
</Row>
<Row class="mb-3">
<FormSelect
label="Reverse Up"
name="reverseActionUp"
Expand Down Expand Up @@ -525,7 +527,7 @@ export default function AddonsConfigPage() {
>
{REVERSE_ACTION.map((o, i) => <option key={`reverseActionRight-option-${i}`} value={o.value}>{o.label}</option>)}
</FormSelect>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -542,7 +544,7 @@ export default function AddonsConfigPage() {
<div
id="I2CAnalog1219InputOptions"
hidden={!values.I2CAnalog1219InputEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="I2C Analog ADS1219 SDA Pin"
name="i2cAnalog1219SDAPin"
Expand Down Expand Up @@ -590,6 +592,8 @@ export default function AddonsConfigPage() {
onChange={handleChange}
min={100000}
/>
</Row>
<Row class="mb-3">
<FormControl
label="I2C Analog ADS1219 Address"
name="i2cAnalog1219Address"
Expand All @@ -601,7 +605,7 @@ export default function AddonsConfigPage() {
onChange={handleChange}
maxLength={4}
/>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -618,9 +622,9 @@ export default function AddonsConfigPage() {
<div
id="DualDirectionalInputOptions"
hidden={!values.DualDirectionalInputEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="Dual Directional Up Pin"
label="Dual Up Pin"
name="dualDirUpPin"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
Expand All @@ -632,7 +636,7 @@ export default function AddonsConfigPage() {
max={29}
/>
<FormControl type="number"
label="Dual Directional Down Pin"
label="Dual Down Pin"
name="dualDirDownPin"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
Expand All @@ -644,7 +648,7 @@ export default function AddonsConfigPage() {
max={29}
/>
<FormControl type="number"
label="Dual Directional Left Pin"
label="Dual Left Pin"
name="dualDirLeftPin"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
Expand All @@ -656,7 +660,7 @@ export default function AddonsConfigPage() {
max={29}
/>
<FormControl type="number"
label="Dual Directional Right Pin"
label="Dual Right Pin"
name="dualDirRightPin"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
Expand All @@ -667,25 +671,34 @@ export default function AddonsConfigPage() {
min={-1}
max={29}
/>
<Form.Group className="row mb-3">
<Form.Label>Dual Directional D-Pad Mode</Form.Label>
<div className="col-sm-3">
<Form.Select name="dualDirDpadMode" className="form-select-sm" value={values.dualDirDpadMode} onChange={handleChange} isInvalid={errors.dualDirDpadMode}>
{DUAL_STICK_MODES.map((o, i) => <option key={`button-dualDirDpadMode-option-${i}`} value={o.value}>{o.label}</option>)}
</Form.Select>
<Form.Control.Feedback type="invalid">{errors.dualDirDpadMode}</Form.Control.Feedback>
</div>
</Form.Group>
<Form.Group className="row mb-3">
<Form.Label>Dual Directional Combination Mode</Form.Label>
<div className="col-sm-3">
<Form.Select name="dualDirCombineMode" className="form-select-sm" value={values.dualDirCombineMode} onChange={handleChange} isInvalid={errors.dualDirCombineMode}>
{DUAL_COMBINE_MODES.map((o, i) => <option key={`button-dualDirCombineMode-option-${i}`} value={o.value}>{o.label}</option>)}
</Form.Select>
<Form.Control.Feedback type="invalid">{errors.dualDirCombineMode}</Form.Control.Feedback>
</div>
</Form.Group>
</Col>
</Row>
<Row class="mb-3">
<FormSelect
label="Dual D-Pad Mode"
name="dualDirDpadMode"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
value={values.dualDirDpadMode}
error={errors.dualDirDpadMode}
isInvalid={errors.dualDirDpadMode}
onChange={handleChange}
>
{DUAL_STICK_MODES.map((o, i) => <option key={`button-dualDirDpadMode-option-${i}`} value={o.value}>{o.label}</option>)}
</FormSelect>

<FormSelect
label="Combination Mode"
name="dualDirCombineMode"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
value={values.dualDirCombineMode}
error={errors.dualDirCombineMode}
isInvalid={errors.dualDirCombineMode}
onChange={handleChange}
>
{DUAL_COMBINE_MODES.map((o, i) => <option key={`button-dualDirCombineMode-option-${i}`} value={o.value}>{o.label}</option>)}
</FormSelect>
</Row>
</div>
<FormCheck
label="Enabled"
Expand All @@ -702,7 +715,7 @@ export default function AddonsConfigPage() {
<div
id="BuzzerSpeakerAddonOptions"
hidden={!values.BuzzerSpeakerAddonEnabled}>
<Col>
<Row class="mb-3">
<FormControl type="number"
label="Buzzer Pin"
name="buzzerPin"
Expand All @@ -727,7 +740,7 @@ export default function AddonsConfigPage() {
min={0}
max={100}
/>
</Col>
</Row>
</div>
<FormCheck
label="Enabled"
Expand Down
27 changes: 0 additions & 27 deletions src/Pages/DisplayConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ const SPLASH_MODES = [
{ label: 'Disabled', value: 3 }, // NOSPLASH
];

const SPLASH_CHOICES = [
{ label: 'Main', value: 0 }, // MAIN
{ label: 'X', value: 1 }, // X
{ label: 'Y', value: 2 }, // Y
{ label: 'Z', value: 3 }, // Z
{ label: 'Custom', value: 4 }, // CUSTOM
{ label: 'Legacy', value: 5 }, // LEGACY
];

const DISPLAY_SAVER_TIMEOUT_CHOICES = [
{ label: 'Off', value: 0 },
{ label: '1 minute', value: 1 },
Expand All @@ -89,7 +80,6 @@ const defaultValues = {
buttonLayout: 0,
buttonLayoutRight: 3,
splashMode: 3,
splashChoice: 0,
splashImage: Array(16*64).fill(0), // 128 columns represented by bytes so 16 and 64 rows
invertSplash: false,
displaySaverTimeout: 0,
Expand All @@ -111,7 +101,6 @@ const schema = yup.object().shape({
buttonLayout: yup.number().required().oneOf(BUTTON_LAYOUTS.map(o => o.value)).label('Button Layout Left'),
buttonLayoutRight: yup.number().required().oneOf(BUTTON_LAYOUTS_RIGHT.map(o => o.value)).label('Button Layout Right'),
splashMode: yup.number().required().oneOf(SPLASH_MODES.map(o => o.value)).label('Splash Screen'),
splashChoice: yup.number().required().oneOf(SPLASH_CHOICES.map(o => o.value)).label('Splash Screen Choice'),
displaySaverTimeout: yup.number().required().oneOf(DISPLAY_SAVER_TIMEOUT_CHOICES.map(o => o.value)).label('Display Saver'),
});

Expand Down Expand Up @@ -144,8 +133,6 @@ const FormContext = () => {
values.buttonLayoutRight = parseInt(values.buttonLayoutRight);
if (!!values.splashMode)
values.splashMode = parseInt(values.splashMode);
if (!!values.splashChoice)
values.splashChoice = parseInt(values.splashChoice);
}, [values, setValues]);

return null;
Expand Down Expand Up @@ -360,20 +347,6 @@ export default function DisplayConfigPage() {
>
{SPLASH_MODES.map((o, i) => <option key={`splashMode-option-${i}`} value={o.value}>{o.label}</option>)}
</FormSelect>
<FormSelect
label="Splash Choice"
name="splashChoice"
className="form-select-sm"
groupClassName="col-sm-3 mb-3"
value={values.splashChoice}
error={errors.splashChoice}
isInvalid={errors.splashChoice}
onChange={handleChange}
>
{SPLASH_CHOICES.map((o, i) => <option key={`splashChoice-option-${i}`} value={o.value}>{o.label}</option>)}
</FormSelect>
</Row>
<Row className="mb-3">
<FormSelect
label="Display Saver Timeout"
name="displaySaverTimeout"
Expand Down

0 comments on commit 6d0fd09

Please sign in to comment.