Skip to content

Commit d51d90c

Browse files
committed
Fix for spaces in wifi SSIDs and passwords
and some build issues Fixes #3
1 parent adbcf96 commit d51d90c

16 files changed

Lines changed: 58 additions & 53 deletions

AGENTS.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ You do **not** need to flash the ESP32 to test UI changes! The project includes
3939
- `src/network/` - WiFi setup, Spoolman API clients, and Webhook/U1 HTTP request handling.
4040
- `src/serial/` - CLI interface via the USB serial port for device configuration.
4141
- `src/power/` - Battery voltage monitoring (ADC) and sleep management heuristics.
42-
- `docs/` - User-facing documentation and hardware setup guides.
43-
- `scripts/` - Python pre/post scripts for PlatformIO (e.g., binary copying, version injection).
42+
- `docs/` - User-facing documentation and hardware setup guides. **This is the source of truth.** Do not edit `web/docs/` directly.
43+
- `scripts/` - Python pre/post scripts for PlatformIO, and bash scripts like `copy_docs.sh` to sync docs to the `web/` folder.
4444
- `simulator/` - Mock data and configs for the native UI simulator.
4545

4646
## 6. Global Rules & Code Conventions
@@ -57,6 +57,7 @@ You do **not** need to flash the ESP32 to test UI changes! The project includes
5757
## 8. Agentic Workflow
5858
1. Read the user's prompt carefully.
5959
2. If UI changes are requested, modify `src/ui/`, build the `simulator` environment, and run it to verify.
60-
3. Keep `notes.md` updated if you complete tasks or find new known issues.
61-
4. Keep `AGENTS.md` updated if the project architecture, dependencies, hardware integrations, or core guidelines change.
62-
5. If a task involves complex logic, use your `brainstorming` skill before writing code.
60+
3. **Documentation:** The files in `docs/` and the root `README.md` are the source of truth. If you edit them, you MUST run `./scripts/copy_docs.sh` to update the `web/` directory. Do not edit `web/docs/` or `web/README.md` directly.
61+
4. Keep `notes.md` updated if you complete tasks or find new known issues.
62+
5. Keep `AGENTS.md` updated if the project architecture, dependencies, hardware integrations, or core guidelines change.
63+
6. If a task involves complex logic, use your `brainstorming` skill before writing code.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ You can flash the firmware and set up your Wi-Fi directly from your PC browser (
6565
The device stores settings in non-volatile memory (NVS). Type `help` in the Serial Terminal to see all available commands.
6666

6767
### 1. Settings
68-
- `set wifi YourWiFiName YourWiFiPassword` (Set your WiFi credentials)
68+
- `set wifi_ssid YourWiFiName` (Set your WiFi network name)
69+
- `set wifi_pass YourWiFiPassword` (Set your WiFi password)
6970
- `set webhook http://your-hook-url/webhook?spool={spool_id}&tool={toolhead}` (Set your webhook URL)
7071
- `set spoolman http://your-spoolman-ip:8000` (Set your Spoolman URL)
7172
- `set u1_host your-u1-ip:7125` (Enable Snapmaker U1 loading)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.0
1+
1.9.1

docs/CONFIGURATION.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ CheapSpoolDisplay can be configured via a Serial Terminal (115200 baud) when con
1010
| :--- | :--- |
1111
| `help` | Show available commands |
1212
| `get config` | Show current configuration values |
13-
| `set wifi <ssid> <password>` | Special command to set Wi-Fi credentials |
13+
| `set wifi_ssid <ssid>` | Set Wi-Fi network name |
14+
| `set wifi_pass <password>` | Set Wi-Fi network password |
1415
| `set spoolman http://<ip>:<port>` | Set the Spoolman server URL |
1516
| `set webhook http://...` | Set the webhook URL |
1617
| `set u1_host <ip>:<port>` | Set the Snapmaker U1 host URL |
@@ -37,7 +38,8 @@ This setting also applies a specific gamma correction table to fix the washed-ou
3738

3839
### Wi-Fi
3940

40-
`set wifi SSID PASSWORD`
41+
`set wifi_ssid SSID`
42+
`set wifi_pass PASSWORD`
4143

4244
**Note:** The device will only connect to Wi-Fi when needed (e.g., for Spoolman or Webhooks). You can optionally configure the connection timeout limit using:
4345
`set wifi_timeout <seconds>` (Default: 60)
@@ -106,7 +108,8 @@ Configures how many seconds the device must be idle before entering deep sleep (
106108

107109
```bash
108110
# Set Wi-Fi
109-
set wifi MySSID MySecretPassword
111+
set wifi_ssid MySSID
112+
set wifi_pass MySecretPassword
110113

111114
# Configure Spoolman
112115
set spoolman http://192.168.1.50:8000

docs/QUICKSTART.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ See [CONFIGURATION.md](CONFIGURATION.md) for details.
3131
* the **Web Installer** (click **Logs & Console**)
3232
* any **Serial Terminal** (115200 baud)
3333
2. Configuration Commands:
34-
* `set wifi <SSID> <PASSWORD>` to configure your wireless network
34+
* `set wifi_ssid <SSID>` to set your network name
35+
* `set wifi_pass <PASSWORD>` to set your network password
3536
* `set tag_format <openspool|openprinttag|opentag3d|ask>` to set your preferred NFC format
3637
* `set spoolman <URL>` to enable Spoolman enrichment (e.g., `http://192.168.1.50:8000`)
3738
* `set u1_host <IP_OR_HOSTNAME>:7125` to enable Snapmaker U1 loading

docs/SPOOLMAN_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To enable Spoolman enrichment, you must configure your Spoolman server URL via t
2121

2222
## Requirements
2323

24-
- **Wi-Fi**: The device must be configured with a valid SSID and Password (`set wifi ...`).
24+
- **Wi-Fi**: The device must be configured with a valid SSID and Password (`set wifi_ssid ...` and `set wifi_pass ...`).
2525
- **NFC Tag**: The tag must include a `spool_id` (OpenSpool format).
2626
- **Spoolman API**: The device will attempt to reach `${SPOOLMAN_URL}/api/v1/spool/${SPOOL_ID}`.
2727

scripts/convert_logo.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
Import("env")
22

33
import os
4-
from PIL import Image
4+
try:
5+
from PIL import Image
6+
except ImportError:
7+
print("Pre-Build: Pillow not found. Installing via uv...")
8+
env.Execute('"$PYTHONEXE" -m uv pip install Pillow')
9+
from PIL import Image
510

611
def generate_logo():
712
input_path = "web/logo.png"

simulator/program

-8.56 KB
Binary file not shown.

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "ui/DisplayUI.h"
66

77
#include "config/ConfigManager.h"
8-
#include "network/NetworkManager.h"
8+
#include "network/AppNetworkManager.h"
99

1010
#ifndef USE_SDL2
1111
#include "nfc/NFCReader.h"
@@ -81,7 +81,7 @@ void loop() {
8181
PowerManager::tick();
8282

8383
// WiFi idle timeout
84-
NetworkManager::tick();
84+
AppNetworkManager::tick();
8585

8686
// If display is off and screen gets touched, wake it up
8787
if (PowerManager::isDisplayOff() && ts.getTouch().zRaw > 0) {
@@ -98,7 +98,7 @@ void loop() {
9898

9999
// Poll WiFi state; update UI only on change
100100
static bool lastWifiState = false;
101-
bool wifiNow = NetworkManager::isWiFiConnected();
101+
bool wifiNow = AppNetworkManager::isWiFiConnected();
102102
if (wifiNow != lastWifiState) {
103103
lastWifiState = wifiNow;
104104
DisplayUI::updateWiFiStatus(wifiNow);
@@ -298,7 +298,7 @@ void loop() {
298298
(!currentSpoolData.spool_id.empty() || !currentSpoolData.lot_nr.empty())) {
299299
DisplayUI::showFetchingOverlay();
300300
lv_timer_handler(); // Force overlay render before blocking
301-
NetworkManager::fetchSpoolmanData(currentSpoolData);
301+
AppNetworkManager::fetchSpoolmanData(currentSpoolData);
302302
DisplayUI::hideFetchingOverlay();
303303
}
304304

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "NetworkManager.h"
1+
#include "AppNetworkManager.h"
22
#include "../config/ConfigManager.h"
33
#include "../data/OpenSpool.h"
44
#include "WebhookFormatter.h"
@@ -21,7 +21,7 @@ static bool ensureWiFi() {
2121
lastNetworkActivity = millis();
2222
return true;
2323
}
24-
NetworkManager::connectWiFi();
24+
AppNetworkManager::connectWiFi();
2525
if (WiFi.status() == WL_CONNECTED)
2626
lastNetworkActivity = millis();
2727
return (WiFi.status() == WL_CONNECTED);
@@ -30,7 +30,7 @@ static bool ensureWiFi() {
3030
#endif
3131
}
3232

33-
void NetworkManager::tick() {
33+
void AppNetworkManager::tick() {
3434
#ifndef USE_SDL2
3535
if (WiFi.status() == WL_CONNECTED &&
3636
millis() - lastNetworkActivity > WIFI_IDLE_TIMEOUT_MS) {
@@ -40,15 +40,15 @@ void NetworkManager::tick() {
4040
#endif
4141
}
4242

43-
bool NetworkManager::isWiFiConnected() {
43+
bool AppNetworkManager::isWiFiConnected() {
4444
#ifndef USE_SDL2
4545
return WiFi.status() == WL_CONNECTED;
4646
#else
4747
return true;
4848
#endif
4949
}
5050

51-
void NetworkManager::connectWiFi() {
51+
void AppNetworkManager::connectWiFi() {
5252
#ifndef USE_SDL2
5353
std::string ssid = ConfigManager::getWifiSSID();
5454
std::string pass = ConfigManager::getWifiPass();
@@ -100,7 +100,7 @@ static size_t HeaderCallback(void *contents, size_t size, size_t nmemb, void *us
100100
}
101101
#endif
102102

103-
bool NetworkManager::sendWebhookPayload(const OpenSpoolData &data,
103+
bool AppNetworkManager::sendWebhookPayload(const OpenSpoolData &data,
104104
int toolhead_id) {
105105
std::string spool_id = data.spool_id;
106106
std::string url = ConfigManager::getWebhook();
@@ -262,7 +262,7 @@ bool NetworkManager::sendWebhookPayload(const OpenSpoolData &data,
262262
#endif
263263
}
264264

265-
bool NetworkManager::fetchSpoolmanData(OpenSpoolData &data) {
265+
bool AppNetworkManager::fetchSpoolmanData(OpenSpoolData &data) {
266266
std::string baseUrl = ConfigManager::getSpoolmanUrl();
267267
if (baseUrl.empty()) {
268268
return false;
@@ -319,7 +319,7 @@ bool NetworkManager::fetchSpoolmanData(OpenSpoolData &data) {
319319
return false;
320320
}
321321

322-
bool NetworkManager::fetchSpoolmanByExternalId(OpenSpoolData &data) {
322+
bool AppNetworkManager::fetchSpoolmanByExternalId(OpenSpoolData &data) {
323323
std::string baseUrl = ConfigManager::getSpoolmanUrl();
324324
if (baseUrl.empty() || data.hardware_uid.empty()) {
325325
return false;
@@ -378,7 +378,7 @@ bool NetworkManager::fetchSpoolmanByExternalId(OpenSpoolData &data) {
378378
return false;
379379
}
380380

381-
bool NetworkManager::fetchSpoolmanList(int page, int limit, std::vector<SpoolmanItem>& items, int& total_count) {
381+
bool AppNetworkManager::fetchSpoolmanList(int page, int limit, std::vector<SpoolmanItem>& items, int& total_count) {
382382
std::string baseUrl = ConfigManager::getSpoolmanUrl();
383383
if (baseUrl.empty()) {
384384
return false;

0 commit comments

Comments
 (0)