Skip to content

Commit 0d83d7f

Browse files
authored
feat: Add WiFi CLI for runtime (re-)configuration (#12)
* feat: Add WiFi CLI for runtime (re-)configuration * readme: update * fix sa * cleanup
1 parent d18d0bd commit 0d83d7f

File tree

13 files changed

+450
-172
lines changed

13 files changed

+450
-172
lines changed

.github/workflows/package_main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ jobs:
6363
run: |
6464
# zip up just the files we uploaded for the release
6565
zip_name="wireless-debug-display-${{ matrix.build.name }}_$(git describe --tags --dirty).zip"
66-
cd ${{ matrix.build.path }}
6766
zip -r -j $zip_name build/*.bin build/*.elf build/bootloader/bootloader.bin build/partition_table/partition-table.bin build/flasher_args.json build/flash_args
68-
echo "artifact_path=${{ matrix.build.path }}/$zip_name" >> "$GITHUB_ENV"
67+
echo "artifact_path=$zip_name" >> "$GITHUB_ENV"
6968
7069
- name: Attach files to release
7170
uses: softprops/action-gh-release@v2

README.md

Lines changed: 125 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,32 @@ will print the data to a text log for display.
88

99
https://github.com/esp-cpp/wireless-debug-display/assets/213467/f835922f-e17f-4f76-95ee-5d6585e84656
1010

11-
## Configuration
12-
13-
You'll need to configure the build using `idf.py set-target <esp32 or esp32s3>`
14-
and then `idf.py menuconfig` to then set the `Wireless Debug Display
15-
Configuration` which allows you to set which hardware you want to run it on, as
16-
well as the WiFi Access Point connection information (ssid/password). It also
17-
allows customization of the port of the UDP server that the debug display is
18-
running.
19-
20-
## Use
11+
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
12+
**Table of Contents**
13+
14+
- [Wireless Debug Display](#wireless-debug-display)
15+
- [Description](#description)
16+
- [Use](#use)
17+
- [Program](#program)
18+
- [Configure](#configure)
19+
- [Sending Data to the Display](#sending-data-to-the-display)
20+
- [Commands](#commands)
21+
- [Plotting](#plotting)
22+
- [Logging](#logging)
23+
- [Development](#development)
24+
- [Environment](#environment)
25+
- [Build and Flash](#build-and-flash)
26+
- [Output](#output)
27+
- [Console Logs:](#console-logs)
28+
- [Python script:](#python-script)
29+
- [ESP32-WROVER-KIT](#esp32-wrover-kit)
30+
- [LILYGO T-DECK](#lilygo-t-deck)
31+
- [ESP32-S3-BOX](#esp32-s3-box)
32+
- [ESP32-S3-BOX-3](#esp32-s3-box-3)
33+
34+
<!-- markdown-toc end -->
35+
36+
## Description
2137

2238
This code receives string data from a UDP server. It will parse that string data
2339
and determine which of the following three types of data it is:
@@ -44,6 +60,86 @@ discovery using mDNS.
4460
send messages or a file to the debug display. NOTE: zeroconf may not be
4561
installed / accessible within the python environment used by ESP-IDF.
4662

63+
## Use
64+
65+
You must first program your hardware. Afterwards, you can configure it via a USB
66+
connection using its built-in CLI.
67+
68+
### Program
69+
70+
Download the release `programmer` executable from the latest [releases
71+
page](https://github.com/esp-cpp/wireless-debug-display/releases) for `windows`,
72+
`macos`, or `linux` - depending on which computer you want to use to perform the
73+
one-time programming. There are a few programmers pre-built for the
74+
`ESP-BOX`, the `LilyGo T-Deck`, or the `ESP32-Wrover-Kit`.
75+
76+
1. Download the programmer
77+
2. Unzip it
78+
3. Double click the `exe` (if windows), or open a terminal and execute it from
79+
the command line `./wireless-debug-display-<hardware>_programmer_v2.0.0_macos.bin`,
80+
where hardware is one of `esp-box` or `t-deck` or `wrover-kit`.
81+
82+
### Configure
83+
84+
To configure it, simply connect it to your computer via USB and open the serial
85+
port in a terminal (e.g. `screen`, `PuTTY`, etc.) at 115200 baud. Once there,
86+
you can use it as you would any other CLI - and the `help` command will provide
87+
info about the commands available.
88+
89+
Any SSID/Password you set will be securely saved in the board's NVS, which is
90+
managed by the ESP-IDF WiFi subsystem.
91+
92+
![CleanShot 2025-06-25 at 09 42 28](https://github.com/user-attachments/assets/680f2dbc-e75a-4359-8e18-752df31c42bd)
93+
94+
```console
95+
sta> help
96+
Commands available:
97+
- help
98+
This help message
99+
- exit
100+
Quit the session
101+
- log <verbosity>
102+
Set the log verbosity for the wifi sta.
103+
- connect
104+
Connect to a WiFi network with the given SSID and password.
105+
- connect <ssid> <password>
106+
Connect to a WiFi network with the given SSID and password.
107+
- disconnect
108+
Disconnect from the current WiFi network.
109+
- ssid
110+
Get the current SSID (Service Set Identifier) of the WiFi connection.
111+
- rssi
112+
Get the current RSSI (Received Signal Strength Indicator) of the WiFi connection.
113+
- ip
114+
Get the current IP address of the WiFi connection.
115+
- connected
116+
Check if the WiFi is connected.
117+
- mac
118+
Get the current MAC address of the WiFi connection.
119+
- bssid
120+
Get the current BSSID (MAC addressof the access point) of the WiFi connection.
121+
- channel
122+
Get the current WiFi channel of the connection.
123+
- config
124+
Get the current WiFi configuration.
125+
- scan <int>
126+
Scan for available WiFi networks.
127+
- memory
128+
Display minimum free memory.
129+
- switch_tab
130+
Switch to the next tab in the display.
131+
- clear_info
132+
Clear the Info display.
133+
- clear_plots
134+
Clear the Plot display.
135+
- clear_logs
136+
Clear the Log display.
137+
- push_data <data>
138+
Push data to the display.
139+
- push_info <info>
140+
Push info to the display.
141+
```
142+
47143
## Sending Data to the Display
48144

49145
This display is designed to receive data from any other device on the network,
@@ -97,7 +193,25 @@ All other text is treated as a log and written out to the log
97193
window. Note, we do not wrap lines, so any text that would go off the
98194
edge of the screen is simply not rendered.
99195

100-
## Build and Flash
196+
## Development
197+
198+
You'll need to configure the build using `idf.py set-target <esp32 or esp32s3>`
199+
and then `idf.py menuconfig` to then set the `Wireless Debug Display
200+
Configuration` which allows you to set which hardware you want to run it on, as
201+
well as the WiFi Access Point connection information (ssid/password). It also
202+
allows customization of the port of the UDP server that the debug display is
203+
running.
204+
205+
### Environment
206+
207+
This project is an ESP-IDF project, currently [ESP-IDF
208+
v.5.4](https://github.com/espressif/esp-idf).
209+
210+
For information about setting up `ESP-IDF v5.4`, please see [the official
211+
ESP-IDF getting started
212+
documentation](https://docs.espressif.com/projects/esp-idf/en/v5.4/esp32s3/get-started/index.html).
213+
214+
### Build and Flash
101215

102216
Build the project and flash it to the board, then run monitor tool to view serial output:
103217

components/gui/include/graph_window.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class GraphWindow : public Window {
1818
void add_data(const std::string &plot_name, int new_data);
1919
void remove_plot(const std::string &plot_name);
2020

21+
lv_obj_t *get_lv_obj(void) { return wrapper_; }
22+
23+
void invalidate() {
24+
if (wrapper_) {
25+
lv_obj_invalidate(wrapper_);
26+
}
27+
}
28+
2129
protected:
2230
lv_chart_series_t *create_plot(const std::string &plotName);
2331
lv_chart_series_t *get_plot(const std::string &plotName);

components/gui/include/gui.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class Gui {
5252

5353
void switch_tab();
5454

55+
void clear_plots();
56+
void clear_logs();
57+
5558
void push_data(const std::string &data);
5659
std::string pop_data();
5760

components/gui/include/text_window.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ class TextWindow : public Window {
1414
void clear_logs(void);
1515
void add_log(const std::string &log_text);
1616

17+
lv_obj_t *get_lv_obj(void) { return log_container_; }
18+
19+
void invalidate() {
20+
if (log_container_) {
21+
lv_obj_invalidate(log_container_);
22+
}
23+
}
24+
1725
private:
1826
std::string log_text_{""};
1927
lv_obj_t *log_container_{nullptr};

components/gui/src/graph_window.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void GraphWindow::clear_plots(void) {
118118
while (lv_spangroup_get_child(legend_, 0)) {
119119
lv_spangroup_delete_span(legend_, lv_spangroup_get_child(legend_, 0));
120120
}
121+
// invalidate
122+
invalidate();
121123
}
122124

123125
void GraphWindow::add_data(const std::string &plotName, int newData) {

components/gui/src/gui.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ void Gui::clear_info() {
6262
info_window_.clear_logs();
6363
}
6464

65+
void Gui::clear_plots() {
66+
std::lock_guard<std::recursive_mutex> lk{mutex_};
67+
plot_window_.clear_plots();
68+
}
69+
70+
void Gui::clear_logs() {
71+
std::lock_guard<std::recursive_mutex> lk{mutex_};
72+
log_window_.clear_logs();
73+
}
74+
6575
void Gui::add_info(const std::string &info) {
6676
std::lock_guard<std::recursive_mutex> lk{mutex_};
6777
info_window_.add_log(info);

components/gui/src/text_window.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ void TextWindow::init(lv_obj_t *parent, size_t width, size_t height) {
1414
}
1515

1616
void TextWindow::clear_logs(void) {
17-
// clear all the logs off the page
18-
lv_obj_clean(log_container_);
17+
// set the string to the display
18+
lv_label_set_text(log_container_, "");
1919
// now empty the string
2020
log_text_.clear();
21+
// invalidate
22+
invalidate();
2123
}
2224

2325
void TextWindow::add_log(const std::string &log_text) {

0 commit comments

Comments
 (0)