mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-03-28 17:43:05 +01:00
Update limits after gathered data
This commit is contained in:
File diff suppressed because one or more lines are too long
2
frontend/dist/index.html
vendored
2
frontend/dist/index.html
vendored
@@ -13,7 +13,7 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<script type="module" crossorigin src="/assets/index-04feYCZ_.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-6T32T4ZI.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DaLCXB8p.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -4,10 +4,12 @@ import { Button } from './ui/button';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
// MeshCore message size limits (empirically determined from LoRa packet constraints)
|
||||
// Total text budget is ~150 bytes. DMs use full budget; channels include "sender: " prefix.
|
||||
const DM_HARD_LIMIT = 150;
|
||||
const DM_WARNING_THRESHOLD = 140; // Multi-hop delivery may be impacted
|
||||
const CHANNEL_WARNING_THRESHOLD = 120; // Conservative limit for channels
|
||||
// Direct delivery allows ~156 bytes; multi-hop requires buffer for path growth.
|
||||
// Channels include "sender: " prefix in the encrypted payload.
|
||||
const DM_HARD_LIMIT = 156; // Max for direct delivery
|
||||
const DM_WARNING_THRESHOLD = 140; // Conservative for multi-hop
|
||||
const CHANNEL_HARD_LIMIT = 156; // Base limit before sender overhead
|
||||
const CHANNEL_WARNING_THRESHOLD = 120; // Conservative for multi-hop
|
||||
const CHANNEL_DANGER_BUFFER = 8; // Red zone starts this many chars before hard limit
|
||||
|
||||
interface MessageInputProps {
|
||||
@@ -51,9 +53,9 @@ export const MessageInput = forwardRef<MessageInputHandle, MessageInputProps>(
|
||||
hardLimit: DM_HARD_LIMIT,
|
||||
};
|
||||
} else if (conversationType === 'channel') {
|
||||
// Channel hard limit = 150 - senderName.length - 2 (for ": " separator)
|
||||
// Channel hard limit = 156 - senderName.length - 2 (for ": " separator)
|
||||
const nameLen = senderName?.length ?? 10;
|
||||
const hardLimit = Math.max(1, DM_HARD_LIMIT - nameLen - 2);
|
||||
const hardLimit = Math.max(1, CHANNEL_HARD_LIMIT - nameLen - 2);
|
||||
return {
|
||||
warningAt: CHANNEL_WARNING_THRESHOLD,
|
||||
dangerAt: Math.max(1, hardLimit - CHANNEL_DANGER_BUFFER),
|
||||
@@ -72,7 +74,7 @@ export const MessageInput = forwardRef<MessageInputHandle, MessageInputProps>(
|
||||
|
||||
const len = text.length;
|
||||
if (len >= limits.hardLimit) {
|
||||
return { limitState: 'error', warningMessage: 'likely rejected by radio' };
|
||||
return { limitState: 'error', warningMessage: 'likely truncated by radio' };
|
||||
}
|
||||
if (len >= limits.dangerAt) {
|
||||
return { limitState: 'danger', warningMessage: 'may impact multi-repeater hop delivery' };
|
||||
|
||||
Reference in New Issue
Block a user