Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
2d31a9f3
Commit
2d31a9f3
authored
Mar 07, 2022
by
Eric Duminil
Browse files
Debug info
parent
9b84e999
Pipeline
#5994
failed with stage
in 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
2d31a9f3
...
...
@@ -4,7 +4,7 @@
* This example is a modified IotWebConf01Minimal.ino, with added shell commands.
*
* Simply type "help" via Serial in order to see the available commands:
> help
'help' not supported. Available commands :
ap 0/1 (Enables/disables access point).
...
...
@@ -16,25 +16,25 @@
ssid name (Sets SSID to name).
wifi 0/1 (Enables/disables WiFi).
wifi_pwd abc (Sets WiFi password to abc).
* The commands allow you to setup the thing directly via Serial:
> name my_thing
Calling : name('my_thing')
Setting Thing name to my_thing
> ssid my_wifi
Calling : ssid('my_wifi')
Setting WiFi ssid to my_wifi
> wifi_pwd my_wifi_password
Calling : wifi_pwd('my_wifi_password')
Setting WiFi password to my_wifi_password
> ap_pwd p4ssw0rd
Calling : ap_pwd('p4ssw0rd')
Setting AP password to p4ssw0rd
State changing from: 1 to 3
Connecting to [my_wifi] (password is hidden)
WiFi timeout (ms): 30000
...
...
@@ -136,12 +136,12 @@ void defineShellCommands() {
shell
::
defineCommand
(
"reset"
,
[]()
{
ESP
.
restart
();
},
F
(
"(Restarts the ESP)"
));
shell
::
defineCommand
(
"save_config"
,
[]()
{
iotWebConf
.
saveConfig
();
},
F
(
"(Saves the config to EEPROM)"
));
shell
::
defineCommand
(
"reset_config"
,
resetConfig
,
F
(
"(Resets the complete IotWeb config)"
));
shell
::
defineStringCommand
(
"ssid"
,
setSSID
,
F
(
"name (Sets SSID to name)"
));
shell
::
defineStringCommand
(
"wifi_pwd"
,
setWifiPassword
,
F
(
"abc (Sets WiFi password to abc)"
));
shell
::
defineStringCommand
(
"ap_pwd"
,
setApPassword
,
F
(
"abc (Sets AP password to abc)"
));
shell
::
defineStringCommand
(
"name"
,
setThingName
,
F
(
"abc (Sets ThingName to abc)"
));
shell
::
defineIntCommand
(
"ap"
,
apOnOff
,
F
(
"0/1 (Enables/disables access point)"
));
shell
::
defineIntCommand
(
"wifi"
,
wifiOnOff
,
F
(
"0/1 (Enables/disables WiFi)"
));
}
...
...
@@ -152,6 +152,8 @@ void setup()
Serial
.
println
();
Serial
.
println
(
"Starting up..."
);
// iotWebConf.getApTimeoutParameter()->defaultValue = "600";
// -- Initializing the configuration.
iotWebConf
.
init
();
...
...
@@ -159,7 +161,7 @@ void setup()
server
.
on
(
"/"
,
handleRoot
);
server
.
on
(
"/config"
,
[]{
iotWebConf
.
handleConfig
();
});
server
.
onNotFound
([](){
iotWebConf
.
handleNotFound
();
});
defineShellCommands
();
Serial
.
println
(
"Ready."
);
...
...
@@ -168,7 +170,9 @@ void setup()
void
loop
()
{
iotWebConf
.
doLoop
();
Serial
.
print
(
"<"
);
shell
::
checkSerialInput
();
Serial
.
print
(
">"
);
delay
(
50
);
}
...
...
@@ -346,6 +350,7 @@ namespace shell {
void
checkSerialInput
()
{
while
(
Serial
.
available
()
>
0
)
{
Serial
.
print
(
"?"
);
shell
::
processSerialInput
(
Serial
.
read
());
}
}
...
...
@@ -385,4 +390,4 @@ namespace shell {
Serial
.
println
(
F
(
"' not supported. Available commands :"
));
listAvailableCommands
();
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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