Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
8dfc9f69
Commit
8dfc9f69
authored
Apr 18, 2021
by
Eric Duminil
Browse files
Adding console output while typing
parent
08d9755a
Pipeline
#2836
passed with stage
in 1 minute and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/sensor_console.cpp
View file @
8dfc9f69
...
...
@@ -86,6 +86,7 @@ namespace sensor_console {
static
unsigned
int
input_pos
=
0
;
switch
(
input_byte
)
{
case
'\n'
:
// end of text
Serial
.
println
();
input_line
[
input_pos
]
=
0
;
runCommand
(
input_line
);
input_pos
=
0
;
...
...
@@ -95,12 +96,17 @@ namespace sensor_console {
case
'\b'
:
// backspace
if
(
input_pos
>
0
)
{
input_pos
--
;
Serial
.
print
(
F
(
"
\b
\b
"
));
}
break
;
default:
if
(
input_pos
==
0
)
{
Serial
.
print
(
F
(
"> "
));
}
// keep adding if not full ... allow for terminating null byte
if
(
input_pos
<
(
MAX_COMMAND_SIZE
-
1
))
{
input_line
[
input_pos
++
]
=
input_byte
;
Serial
.
print
((
char
)
input_byte
);
}
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment