mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-07 17:23:05 +02:00
Phase 6: Radio config + path hash mode
This commit is contained in:
@@ -47,6 +47,7 @@ export function SettingsRadioSection({
|
||||
const [bw, setBw] = useState('');
|
||||
const [sf, setSf] = useState('');
|
||||
const [cr, setCr] = useState('');
|
||||
const [pathHashMode, setPathHashMode] = useState('0');
|
||||
const [gettingLocation, setGettingLocation] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [rebooting, setRebooting] = useState(false);
|
||||
@@ -77,6 +78,7 @@ export function SettingsRadioSection({
|
||||
setBw(String(config.radio.bw));
|
||||
setSf(String(config.radio.sf));
|
||||
setCr(String(config.radio.cr));
|
||||
setPathHashMode(String(config.path_hash_mode));
|
||||
}, [config]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -159,6 +161,8 @@ export function SettingsRadioSection({
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsedPathHashMode = parseInt(pathHashMode, 10);
|
||||
|
||||
return {
|
||||
name,
|
||||
lat: parsedLat,
|
||||
@@ -170,6 +174,11 @@ export function SettingsRadioSection({
|
||||
sf: parsedSf,
|
||||
cr: parsedCr,
|
||||
},
|
||||
...(config.path_hash_mode_supported &&
|
||||
!isNaN(parsedPathHashMode) &&
|
||||
parsedPathHashMode !== config.path_hash_mode
|
||||
? { path_hash_mode: parsedPathHashMode }
|
||||
: {}),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -427,6 +436,33 @@ export function SettingsRadioSection({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.path_hash_mode_supported && (
|
||||
<>
|
||||
<Separator />
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="path-hash-mode">Path Hash Mode</Label>
|
||||
<select
|
||||
id="path-hash-mode"
|
||||
value={pathHashMode}
|
||||
onChange={(e) => setPathHashMode(e.target.value)}
|
||||
className="w-full h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
||||
>
|
||||
<option value="0">1 byte (default)</option>
|
||||
<option value="1">2 bytes</option>
|
||||
<option value="2">3 bytes</option>
|
||||
</select>
|
||||
<div className="rounded-md border border-amber-500/50 bg-amber-500/10 p-3 text-xs text-amber-200">
|
||||
<p className="font-semibold mb-1">Compatibility Warning</p>
|
||||
<p>
|
||||
ALL nodes along a message's route — your radio, every repeater, and the
|
||||
recipient — must be running firmware that supports the selected mode. Messages
|
||||
sent with 2-byte or 3-byte hops will be dropped by any node on older firmware.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className="text-sm text-destructive" role="alert">
|
||||
{error}
|
||||
|
||||
@@ -174,6 +174,8 @@ const baseConfig = {
|
||||
tx_power: 17,
|
||||
max_tx_power: 22,
|
||||
radio: { freq: 910.525, bw: 62.5, sf: 7, cr: 5 },
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
};
|
||||
|
||||
const baseSettings = {
|
||||
|
||||
@@ -202,6 +202,8 @@ describe('App search jump target handling', () => {
|
||||
tx_power: 17,
|
||||
max_tx_power: 22,
|
||||
radio: { freq: 910.525, bw: 62.5, sf: 7, cr: 5 },
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
});
|
||||
mocks.api.getSettings.mockResolvedValue({
|
||||
max_radio_contacts: 200,
|
||||
|
||||
@@ -158,6 +158,8 @@ describe('App startup hash resolution', () => {
|
||||
tx_power: 17,
|
||||
max_tx_power: 22,
|
||||
radio: { freq: 910.525, bw: 62.5, sf: 7, cr: 5 },
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
});
|
||||
mocks.api.getSettings.mockResolvedValue({
|
||||
max_radio_contacts: 200,
|
||||
|
||||
@@ -41,6 +41,8 @@ function createConfig(overrides: Partial<RadioConfig> = {}): RadioConfig {
|
||||
tx_power: 10,
|
||||
max_tx_power: 20,
|
||||
radio: { freq: 915, bw: 250, sf: 10, cr: 8 },
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ const baseConfig: RadioConfig = {
|
||||
sf: 7,
|
||||
cr: 5,
|
||||
},
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
};
|
||||
|
||||
const baseHealth: HealthStatus = {
|
||||
|
||||
@@ -13,6 +13,8 @@ export interface RadioConfig {
|
||||
tx_power: number;
|
||||
max_tx_power: number;
|
||||
radio: RadioSettings;
|
||||
path_hash_mode: number;
|
||||
path_hash_mode_supported: boolean;
|
||||
}
|
||||
|
||||
export interface RadioConfigUpdate {
|
||||
@@ -21,6 +23,7 @@ export interface RadioConfigUpdate {
|
||||
lon?: number;
|
||||
tx_power?: number;
|
||||
radio?: RadioSettings;
|
||||
path_hash_mode?: number;
|
||||
}
|
||||
|
||||
export interface FanoutStatusEntry {
|
||||
|
||||
Reference in New Issue
Block a user