Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 123 canned messages #296

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ Start the development server:
```bash
pnpm dev
```

### Updating Protobufs

To update to the latest protobufs go to https://buf.build/meshtastic/protobufs/sdks and select plugin version `1.10`.

The version should look something like this: `1.10.0-20240906232734-3da561588c55.1`

Where the version is *always* `1.10.0` followed by a timestamp and a commit hash. Updating to an SDK version higher than 1.10.0 has breaking changes.

Use that version to updated your `package.json` file.

*Ensure to keep the `meshtastic/js` protobufs in step with web*
167 changes: 167 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions src/components/PageComponents/ModuleConfig/CannedMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useDevice } from "@core/stores/deviceStore.js";
import { Protobuf } from "@meshtastic/js";

export const CannedMessage = (): JSX.Element => {
const { moduleConfig, setWorkingModuleConfig } = useDevice();
const { moduleConfig, cannedMessagesConfig, setWorkingModuleConfig, setWorkingCannedMessages } =
useDevice();

const onSubmit = (data: CannedMessageValidation) => {
setWorkingModuleConfig(
Expand All @@ -15,12 +16,23 @@ export const CannedMessage = (): JSX.Element => {
},
}),
);

setWorkingCannedMessages(
new Protobuf.CannedMessages.CannedMessageModuleConfig({
messages: data.messages,
}),
);
};

return (
<DynamicForm<CannedMessageValidation>
onSubmit={onSubmit}
defaultValues={moduleConfig.cannedMessage}
defaultValues={{
...moduleConfig.cannedMessage,
...{
messages: cannedMessagesConfig.messages
}
}}
fieldGroups={[
{
label: "Canned Message Settings",
Expand All @@ -32,6 +44,12 @@ export const CannedMessage = (): JSX.Element => {
label: "Module Enabled",
description: "Enable Canned Message",
},
{
type: "text",
name: "messages",
label: "Messages",
description: "Separate messages with |",
},
{
type: "toggle",
name: "rotary1Enabled",
Expand Down
Loading
Loading