Files
crosspoint-reader/platformio.ini

63 lines
1.6 KiB
INI
Raw Normal View History

2025-12-08 23:13:33 +11:00
[platformio]
default_envs = default
2025-12-03 22:00:29 +11:00
2026-01-13 00:56:21 +11:00
[crosspoint]
2026-01-15 01:01:47 +11:00
version = 0.14.0
2026-01-13 00:56:21 +11:00
2025-12-08 23:13:33 +11:00
[base]
2025-12-23 12:16:42 +11:00
platform = espressif32 @ 6.12.0
2025-12-03 22:00:29 +11:00
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 115200
upload_speed = 921600
check_tool = cppcheck
check_flags = --enable=all --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=unmatchedSuppression --suppress=*:*/.pio/* --inline-suppr
check_skip_packages = yes
2025-12-03 22:00:29 +11:00
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_upload.offset_address = 0x10000
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
-DMINIZ_NO_ZLIB_COMPATIBLE_NAMES=1
-DEINK_DISPLAY_SINGLE_BUFFER_MODE=1
-DDISABLE_FS_H_WARNING=1
2025-12-08 23:13:33 +11:00
# https://libexpat.github.io/doc/api/latest/#XML_GE
-DXML_GE=0
-DXML_CONTEXT_BYTES=1024
-std=c++2a
# Enable UTF-8 long file names in SdFat
-DUSE_UTF8_LONG_NAMES=1
2025-12-03 22:00:29 +11:00
2025-12-08 23:13:33 +11:00
; Board configuration
board_build.flash_mode = dio
board_build.flash_size = 16MB
board_build.partitions = partitions.csv
Add connect to Wifi and File Manager Webserver (#41) ## Summary - **What is the goal of this PR?** Implements wireless EPUB file management via a built-in web server, enabling users to upload, browse, organize, and delete EPUB files from any device on the same WiFi network without needing a computer cable connection. - **What changes are included?** - **New Web Server** ([`CrossPointWebServer.cpp`](src/CrossPointWebServer.cpp), [`CrossPointWebServer.h`](src/CrossPointWebServer.h)): - HTTP server on port 80 with a responsive HTML/CSS interface - Home page showing device status (version, IP, free memory) - File Manager with folder navigation and breadcrumb support - EPUB file upload with progress tracking - Folder creation and file/folder deletion - XSS protection via HTML escaping - Hidden system folders (`.` prefixed, "System Volume Information", "XTCache") - **WiFi Screen** ([`WifiScreen.cpp`](src/screens/WifiScreen.cpp), [`WifiScreen.h`](src/screens/WifiScreen.h)): - Network scanning with signal strength indicators - Visual indicators for encrypted (`*`) and saved (`+`) networks - State machine managing: scanning, network selection, password entry, connecting, save/forget prompts - 15-second connection timeout handling - Integration with web server (starts on connect, stops on exit) - **WiFi Credential Storage** ([`WifiCredentialStore.cpp`](src/WifiCredentialStore.cpp), [`WifiCredentialStore.h`](src/WifiCredentialStore.h)): - Persistent storage in `/sd/.crosspoint/wifi.bin` - XOR obfuscation for stored passwords (basic protection against casual reading) - Up to 8 saved networks with add/remove/update operations - **On-Screen Keyboard** ([`OnScreenKeyboard.cpp`](src/screens/OnScreenKeyboard.cpp), [`OnScreenKeyboard.h`](src/screens/OnScreenKeyboard.h)): - Reusable QWERTY keyboard component with shift support - Special keys: Shift, Space, Backspace, Done - Support for password masking mode - **Settings Screen Integration** ([`SettingsScreen.h`](src/screens/SettingsScreen.h)): - Added WiFi action to navigate to the new WiFi screen - **Documentation** ([`docs/webserver.md`](docs/webserver.md)): - Comprehensive user guide covering WiFi setup, web interface usage, file management, troubleshooting, and security notes - See this for more screenshots! - Working "displays the right way in GitHub" on my repo: https://github.com/olearycrew/crosspoint-reader/blob/feature/connect-to-wifi/docs/webserver.md **Video demo** https://github.com/user-attachments/assets/283e32dc-2d9f-4ae2-848e-01f41166a731 ## Additional Context - **Security considerations**: The web server has no authentication—anyone on the same WiFi network can access files. This is documented as a limitation, recommending use only on trusted private networks. Password obfuscation in the credential store is XOR-based, not cryptographically secure. - **Memory implications**: The web server and WiFi stack consume significant memory. The implementation properly cleans up (stops server, disconnects WiFi, sets `WIFI_OFF` mode) when exiting the WiFi screen to free resources. - **Async operations**: Network scanning and connection use async patterns with FreeRTOS tasks to prevent blocking the UI. The display task handles rendering on a dedicated thread with mutex protection. - **Browser compatibility**: The web interface uses standard HTML5/CSS3/JavaScript and is tested to work with all modern browsers on desktop and mobile. --------- Co-authored-by: Dave Allie <dave@daveallie.com>
2025-12-19 09:05:43 -05:00
extra_scripts =
pre:scripts/build_html.py
2025-12-03 22:00:29 +11:00
; Libraries
lib_deps =
BatteryMonitor=symlink://open-x4-sdk/libs/hardware/BatteryMonitor
2025-12-06 12:35:41 +11:00
InputManager=symlink://open-x4-sdk/libs/hardware/InputManager
EInkDisplay=symlink://open-x4-sdk/libs/display/EInkDisplay
SDCardManager=symlink://open-x4-sdk/libs/hardware/SDCardManager
ArduinoJson @ 7.4.2
QRCode @ 0.0.1
Turbocharge WiFi uploads with WebSocket + watchdog stability (#364) ## Summary * **What is the goal of this PR?** Fix WiFi file transfer stability issues (especially crashes during uploads) and improve upload speed via WebSocket binary protocol. File transfers now don't really crash as much, if they do it recovers and speed has gone form 50KB/s to 300+KB/s. * **What changes are included?** - **WebSocket upload support** - Adds WebSocket binary protocol for file uploads, achieving faster speeds 335 KB/s vs HTTP multipart) - **Watchdog stability fixes** - Adds `esp_task_wdt_reset()` calls throughout upload path to prevent watchdog timeouts during: - File creation (FAT allocation can be slow) - SD card write operations - HTTP header parsing - WebSocket chunk processing - **4KB write buffering** - Batches SD card writes to reduce I/O overhead - **WiFi health monitoring** - Detects WiFi disconnection in STA mode and exits gracefully - **Improved handleClient loop** - 500 iterations with periodic watchdog resets and button checks for responsiveness - **Progress bar improvements** - Fixed jumping/inaccurate progress by capping local progress at 95% until server confirms completion - **Exit button responsiveness** - Button now checked inside the handleClient loop every 64 iterations - **Reduced exit delays** - Decreased shutdown delays from ~850ms to ~140ms **Files changed:** - `platformio.ini` - Added WebSockets library dependency - `CrossPointWebServer.cpp/h` - WebSocket server, upload buffering, watchdog resets - `CrossPointWebServerActivity.cpp` - WiFi monitoring, improved loop, button handling - `FilesPage.html` - WebSocket upload JavaScript with HTTP fallback ## Additional Context - WebSocket uses 4KB chunks with backpressure management to prevent ESP32 buffer overflow - Falls back to HTTP automatically if WebSocket connection fails - The main bottleneck now is SD card write speed (~44% of transfer time), not WiFi - STA mode was more prone to crashes than AP mode due to external network factors; WiFi health monitoring helps detect and handle disconnections gracefully --- ### AI Usage Did you use AI tools to help write this code? _**YES**_ Claude did it ALL, I have no idea what I am doing, but my books transfer fast now. --------- Co-authored-by: Claude <noreply@anthropic.com>
2026-01-14 12:11:28 +00:00
links2004/WebSockets @ ^2.4.1
2025-12-08 23:13:33 +11:00
[env:default]
extends = base
build_flags =
${base.build_flags}
2026-01-13 00:56:21 +11:00
-DCROSSPOINT_VERSION=\"${crosspoint.version}-dev\"
2025-12-08 23:13:33 +11:00
[env:gh_release]
extends = base
build_flags =
${base.build_flags}
2026-01-13 00:56:21 +11:00
-DCROSSPOINT_VERSION=\"${crosspoint.version}\"