Browse Source

Update external notification settings

pull/66/head
Sacha Weatherstone 3 years ago
parent
commit
b1f86466f0
  1. 83
      src/components/PageComponents/ModuleConfig/ExternalNotification.tsx
  2. 22
      src/validation/moduleConfig/externalNotification.ts

83
src/components/PageComponents/ModuleConfig/ExternalNotification.tsx

@ -80,7 +80,7 @@ export const ExternalNotification = (): JSX.Element => {
<Input
type="number"
label="Output MS"
description="Max transmit power in dBm"
description="Description"
suffix="ms"
disabled={!moduleEnabled}
{...register("outputMs", {
@ -90,12 +90,30 @@ export const ExternalNotification = (): JSX.Element => {
<Input
type="number"
label="Output"
description="Max transmit power in dBm"
description="Description"
disabled={!moduleEnabled}
{...register("output", {
valueAsNumber: true
})}
/>
<Input
type="number"
label="Output Vibrate"
description="Description"
disabled={!moduleEnabled}
{...register("outputVibra", {
valueAsNumber: true
})}
/>
<Input
type="number"
label="Output Buzzer"
description="Description"
disabled={!moduleEnabled}
{...register("outputBuzzer", {
valueAsNumber: true
})}
/>
<Controller
name="active"
control={control}
@ -113,7 +131,31 @@ export const ExternalNotification = (): JSX.Element => {
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Message"
label="Alert Message"
description="Description"
checked={value}
{...rest}
/>
)}
/>
<Controller
name="alertMessageVibra"
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Alert Message Vibrate"
description="Description"
checked={value}
{...rest}
/>
)}
/>
<Controller
name="alertMessageBuzzer"
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Alert Message Buzzer"
description="Description"
checked={value}
{...rest}
@ -125,7 +167,31 @@ export const ExternalNotification = (): JSX.Element => {
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Bell"
label="Alert Bell"
description="Description"
checked={value}
{...rest}
/>
)}
/>
<Controller
name="alertBellVibra"
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Alert Bell Vibrate"
description="Description"
checked={value}
{...rest}
/>
)}
/>
<Controller
name="alertBellBuzzer"
control={control}
render={({ field: { value, ...rest } }) => (
<Toggle
label="Alert Bell Buzzer"
description="Description"
checked={value}
{...rest}
@ -144,6 +210,15 @@ export const ExternalNotification = (): JSX.Element => {
/>
)}
/>
<Input
type="number"
label="Nag Timeout"
description="Description"
disabled={!moduleEnabled}
{...register("nagTimeout", {
valueAsNumber: true
})}
/>
</Form>
);
};

22
src/validation/moduleConfig/externalNotification.ts

@ -5,6 +5,7 @@ import type { Protobuf } from "@meshtastic/meshtasticjs";
export class ExternalNotificationValidation
implements Protobuf.ModuleConfig_ExternalNotificationConfig
{
@IsBoolean()
enabled: boolean;
@IsInt()
@ -13,15 +14,36 @@ export class ExternalNotificationValidation
@IsInt()
output: number;
@IsInt()
outputVibra: number;
@IsInt()
outputBuzzer: number;
@IsBoolean()
active: boolean;
@IsBoolean()
alertMessage: boolean;
@IsBoolean()
alertMessageVibra: boolean
@IsBoolean()
alertMessageBuzzer: boolean
@IsBoolean()
alertBell: boolean;
@IsBoolean()
alertBellVibra: boolean;
@IsBoolean()
alertBellBuzzer: boolean;
@IsBoolean()
usePwm: boolean;
@IsInt()
nagTimeout: number;
}

Loading…
Cancel
Save