Browse Source

Update external notification settings

pull/66/head
Sacha Weatherstone 4 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 <Input
type="number" type="number"
label="Output MS" label="Output MS"
description="Max transmit power in dBm" description="Description"
suffix="ms" suffix="ms"
disabled={!moduleEnabled} disabled={!moduleEnabled}
{...register("outputMs", { {...register("outputMs", {
@ -90,12 +90,30 @@ export const ExternalNotification = (): JSX.Element => {
<Input <Input
type="number" type="number"
label="Output" label="Output"
description="Max transmit power in dBm" description="Description"
disabled={!moduleEnabled} disabled={!moduleEnabled}
{...register("output", { {...register("output", {
valueAsNumber: true 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 <Controller
name="active" name="active"
control={control} control={control}
@ -113,7 +131,31 @@ export const ExternalNotification = (): JSX.Element => {
control={control} control={control}
render={({ field: { value, ...rest } }) => ( render={({ field: { value, ...rest } }) => (
<Toggle <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" description="Description"
checked={value} checked={value}
{...rest} {...rest}
@ -125,7 +167,31 @@ export const ExternalNotification = (): JSX.Element => {
control={control} control={control}
render={({ field: { value, ...rest } }) => ( render={({ field: { value, ...rest } }) => (
<Toggle <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" description="Description"
checked={value} checked={value}
{...rest} {...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> </Form>
); );
}; };

22
src/validation/moduleConfig/externalNotification.ts

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

Loading…
Cancel
Save