Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
meshtastic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOTA
meshtastic
Commits
1d951b02
Commit
1d951b02
authored
1 year ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
'Fix' for string split w/regex, debug log, temporary crappy delay.
parent
57e02c60
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/device.ts
+3
-1
3 additions, 1 deletion
src/lib/device.ts
with
3 additions
and
1 deletion
src/lib/device.ts
+
3
−
1
View file @
1d951b02
...
...
@@ -15,7 +15,7 @@ export function getRandomId(): number {
}
function
chunkText
(
str
:
string
):
string
[]
{
const
arr
=
str
.
trim
().
split
(
/
(\s
+
)
/
);
const
arr
=
str
.
trim
().
split
(
/
(\s
+
)
/
.
source
);
// .source as hack to work around some polyfill shenanigans w/RegExp & String.split
const
ret
:
string
[]
=
[];
let
s
:
string
=
''
;
// @ts-expect-error shut up
...
...
@@ -399,12 +399,14 @@ export default abstract class Device extends js.global.EventEmitter {
}:
ITextMessageParams
):
void
{
const
msgs
=
chunkText
(
text
);
for
(
const
msg
of
msgs
)
{
if
(
this
.
debug
)
this
.
log
(
sbbsdefs
.
LOG_DEBUG
,
`Sending text:
${
msg
}
`
);
// @ts-expect-error It's fucken ambient okay?
const
enc
=
new
TextEncoder
();
const
payload
=
enc
.
encode
(
msg
);
if
(
payload
.
length
>
MAX_PAYLOAD
)
this
.
error
(
`sendText: payload length
${
payload
.
length
}
exceeds maximum (
${
MAX_PAYLOAD
}
)`
);
const
res
=
this
.
sendPacket
({
payload
,
portNum
:
protobuf
.
Portnums
.
PortNum
.
TEXT_MESSAGE_APP
,
to
,
channel
,
wantAck
,
ackHandler
,
replyId
,
hopLimit
});
if
(
!
res
)
this
.
error
(
`failed to send text message`
);
js
.
global
.
mswait
(
100
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment