1.3.x updates

This commit is contained in:
Sacha Weatherstone
2022-05-08 23:07:40 +10:00
parent d84d7d94cc
commit 6ba94fcadc
24 changed files with 1597 additions and 1543 deletions
+82 -11
View File
@@ -4,11 +4,15 @@ import { Button } from '@components/generic/button/Button';
import { Card } from '@components/generic/Card';
import { connection } from '@core/connection';
import { useAppSelector } from '@hooks/useAppSelector';
import { Protobuf } from '@meshtastic/meshtasticjs';
export const Debug = (): JSX.Element => {
const hardwareInfo = useAppSelector(
(state) => state.meshtastic.radio.hardware,
);
const myNodeNum = useAppSelector(
(state) => state.meshtastic.radio.hardware.myNodeNum,
);
const node = useAppSelector((state) =>
state.meshtastic.nodes.find(
(node) => node.data.num === hardwareInfo.myNodeNum,
@@ -20,26 +24,93 @@ export const Debug = (): JSX.Element => {
<Card className="flex-grow">
<div className="grid grid-cols-4 gap-4">
<Button
onClick={async (): Promise<void> => {
await connection.configure();
onClick={(): void => {
void connection.configure();
}}
>
Configure
</Button>
<Button
onClick={async (): Promise<void> => {
await connection.getPreferences();
}}
>
Get Preferences
</Button>
<Button
onClick={async (): Promise<void> => {
await connection.getAllChannels();
onClick={(): void => {
void connection.getAllChannels();
}}
>
Get All Channels
</Button>
<Button
onClick={(): void => {
const packet = Protobuf.AdminMessage.create({
variant: {
oneofKind: 'getConfigRequest',
getConfigRequest:
Protobuf.AdminMessage_ConfigType.LORA_CONFIG,
},
});
void connection.sendPacket(
Protobuf.AdminMessage.toBinary(packet),
Protobuf.PortNum.ADMIN_APP,
myNodeNum,
true,
0,
true,
false,
async (num) => {
return await Promise.resolve();
},
);
}}
>
Get All Config
</Button>
<Button
onClick={(): void => {
void connection.getConfig(
Protobuf.AdminMessage_ConfigType.DISPLAY_CONFIG,
async (id) => {
console.log(`RESPONSE - ${id}`);
return Promise.resolve();
},
);
}}
>
Get Display Config
</Button>
<Button
onClick={(): void => {
void connection.getConfig(
Protobuf.AdminMessage_ConfigType.LORA_CONFIG,
async (id) => {
console.log(`RESPONSE - ${id}`);
return Promise.resolve();
},
);
}}
>
Get LoRa Config
</Button>
<Button
onClick={(): void => {
void connection.setConfig(
Protobuf.Config.create({
payloadVariant: {
oneofKind: 'lora',
lora: Protobuf.Config_LoRaConfig.create({
modemPreset:
Protobuf.Config_LoRaConfig_ModemPreset.MidSlow,
}),
},
}),
async (id) => {
console.log(`RESPONSE - ${id}`);
return Promise.resolve();
},
);
}}
>
Set LoRa Config
</Button>
</div>
</Card>
</div>
+3 -3
View File
@@ -22,15 +22,15 @@ export const Logs = (): JSX.Element => {
[Types.Emitter.sendText]: 'text-rose-500',
[Types.Emitter.sendPacket]: 'text-pink-500',
[Types.Emitter.sendRaw]: 'text-fuchsia-500',
[Types.Emitter.setPreferences]: 'text-purple-500',
[Types.Emitter.confirmSetPreferences]: 'text-violet-500',
[Types.Emitter.setConfig]: 'text-purple-500',
[Types.Emitter.confirmSetConfig]: 'text-violet-500',
[Types.Emitter.setOwner]: 'text-indigo-500',
[Types.Emitter.setChannel]: 'text-blue-500',
[Types.Emitter.confirmSetChannel]: 'text-sky-500',
[Types.Emitter.deleteChannel]: 'text-cyan-500',
[Types.Emitter.getChannel]: 'text-teal-500',
[Types.Emitter.getAllChannels]: 'text-emerald-500',
[Types.Emitter.getPreferences]: 'text-green-500',
[Types.Emitter.getConfig]: 'text-green-500',
[Types.Emitter.getOwner]: 'text-lime-500',
[Types.Emitter.configure]: 'text-yellow-500',
[Types.Emitter.handleFromRadio]: 'text-amber-500',