Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
portapack-mayhem
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
mcules
portapack-mayhem
Commits
65ab23fd
Commit
65ab23fd
authored
5 years ago
by
eried
Browse files
Options
Downloads
Patches
Plain Diff
Comma as separator
parent
a1501d09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
firmware/application/apps/ui_whipcalc.cpp
+4
-3
4 additions, 3 deletions
firmware/application/apps/ui_whipcalc.cpp
with
4 additions
and
3 deletions
firmware/application/apps/ui_whipcalc.cpp
+
4
−
3
View file @
65ab23fd
...
...
@@ -140,7 +140,7 @@ WhipCalcView::WhipCalcView(
for
(
size_t
pointer
=
0
;
pointer
<
antennas_file
.
size
();
pointer
++
)
{
antennas_file
.
seek
(
pointer
);
antennas_file
.
read
(
one_char
,
1
);
if
((
int
)
one_char
[
0
]
>
31
)
{
//ascii space upwards
if
((
int
)
one_char
[
0
]
>
' '
)
{
//ascii space upwards
line
+=
one_char
[
0
];
//Add it to the textline
}
else
if
(
one_char
[
0
]
==
'\n'
)
{
//New Line
...
...
@@ -181,10 +181,11 @@ WhipCalcView::WhipCalcView(
void
ui
::
WhipCalcView
::
txtline_process
(
std
::
string
&
line
)
{
if
(
line
.
find
(
"#"
)
!=
std
::
string
::
npos
)
return
;
//Line is just a comment
char
separator
=
','
;
size_t
previous
=
0
;
uint16_t
value
=
0
;
antenna_entry
new_antenna
;
size_t
current
=
line
.
find
(
" "
);
size_t
current
=
line
.
find
(
separator
);
while
(
current
!=
std
::
string
::
npos
)
{
if
(
!
previous
)
{
//first space found
new_antenna
.
label
.
assign
(
line
,
0
,
current
);
//antenna label
...
...
@@ -194,7 +195,7 @@ void ui::WhipCalcView::txtline_process(std::string& line) {
new_antenna
.
elements
.
push_back
(
value
);
//Store this new element
}
previous
=
current
+
1
;
current
=
line
.
find
(
" "
,
previous
);
//Search for next space delimiter
current
=
line
.
find
(
separator
,
previous
);
//Search for next space delimiter
}
if
(
!
previous
)
return
;
//Not even a label ? drop this antenna!
value
=
std
::
stoi
(
line
.
substr
(
previous
,
current
-
previous
));
//Last element
...
...
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