@@ -133,110 +133,108 @@ For advanced users who want to modify the source code, you can compile directly
133133
134134## Configuration
135135
136- WebScreen uses a JSON configuration system stored on the SD card as ` webscreen.json ` . The configuration system supports both the current modular format and legacy formats for backward compatibility:
136+ WebScreen uses a JSON configuration file stored on the SD card as ` / webscreen.json` . This file controls WiFi settings, display colors, MQTT configuration, and which JavaScript app to run.
137137
138- ### Complete Configuration Example
138+ ### Configuration Format
139+
140+ ** IMPORTANT:** The current firmware uses the following format with nested "settings" structure:
139141
140142``` json
141143{
142- "wifi" : {
143- "ssid" : " your_wifi_network" ,
144- "password" : " your_wifi_password" ,
145- "enabled" : true ,
146- "connection_timeout" : 15000 ,
147- "auto_reconnect" : true
148- },
149- "mqtt" : {
150- "broker" : " mqtt.example.com" ,
151- "port" : 1883 ,
152- "username" : " your_username" ,
153- "password" : " your_password" ,
154- "client_id" : " webscreen_001" ,
155- "enabled" : false ,
156- "keepalive" : 60
144+ "settings" : {
145+ "wifi" : {
146+ "ssid" : " your_wifi_network" ,
147+ "pass" : " your_wifi_password"
148+ },
149+ "mqtt" : {
150+ "enabled" : false
151+ }
157152 },
158- "display" : {
159- "brightness" : 200 ,
160- "rotation" : 1 ,
161- "background_color" : " #2980b9" ,
162- "foreground_color" : " #00fff1" ,
163- "auto_brightness" : false ,
164- "screen_timeout" : 300000
153+ "screen" : {
154+ "background" : " #2980b9" ,
155+ "foreground" : " #00fff1"
165156 },
166- "system" : {
167- "device_name" : " WebScreen-01" ,
168- "timezone" : " UTC-8" ,
169- "log_level" : 2 ,
170- "performance_mode" : true ,
171- "watchdog_timeout" : 30000
172- },
173- "script_file" : " /apps/weather_app.js" ,
174- "config_version" : 2 ,
175- "last_modified" : 1640995200
157+ "script" : " app.js"
176158}
177159```
178160
179161### Configuration Fields
180162
181163| Section | Field | Description | Default |
182164| ---------| -------| -------------| ---------|
183- | ** wifi** | ` ssid ` | WiFi network name | ` "" ` |
184- | | ` password ` | WiFi password | ` "" ` |
185- | | ` enabled ` | Enable WiFi connectivity | ` true ` |
186- | | ` connection_timeout ` | Connection timeout (ms) | ` 15000 ` |
187- | | ` auto_reconnect ` | Auto-reconnect on disconnect | ` true ` |
188- | ** display** | ` brightness ` | Screen brightness (0-255) | ` 200 ` |
189- | | ` rotation ` | Screen rotation (0-3) | ` 1 ` |
190- | | ` background_color ` | Background color (hex) | ` "#000000" ` |
191- | | ` foreground_color ` | Text color (hex) | ` "#FFFFFF" ` |
192- | | ` screen_timeout ` | Auto-sleep timeout (ms, 0=never) | ` 0 ` |
193- | ** system** | ` log_level ` | Logging level (0=debug, 4=fatal) | ` 2 ` |
194- | | ` performance_mode ` | Enable performance optimizations | ` false ` |
195- | | ` watchdog_timeout ` | Watchdog timeout (ms) | ` 30000 ` |
196-
197- ### Advanced Configuration
198-
199- #### Minimal Configuration
165+ | ** settings.wifi** | ` ssid ` | WiFi network name | ` "" ` |
166+ | | ` pass ` | WiFi password | ` "" ` |
167+ | ** settings.mqtt** | ` enabled ` | Enable MQTT functionality | ` false ` |
168+ | ** screen** | ` background ` | Background color (hex format) | ` "#000000" ` |
169+ | | ` foreground ` | Text/foreground color (hex) | ` "#FFFFFF" ` |
170+ | ** Root** | ` script ` | JavaScript file to execute | ` "app.js" ` |
171+
172+ ### Example Configurations
173+
174+ #### Basic WiFi Setup
200175``` json
201176{
202- "wifi" : {
203- "ssid" : " MyNetwork" ,
204- "password" : " MyPassword"
177+ "settings" : {
178+ "wifi" : {
179+ "ssid" : " MyNetwork" ,
180+ "pass" : " MyPassword"
181+ }
205182 },
206- "script_file " : " / app.js"
183+ "script " : " app.js"
207184}
208185```
209186
210- #### Performance Optimized
187+ #### Custom Colors
211188``` json
212189{
213- "display" : {
214- "brightness" : 255 ,
215- "auto_brightness" : false
190+ "settings" : {
191+ "wifi" : {
192+ "ssid" : " MyNetwork" ,
193+ "pass" : " MyPassword"
194+ }
216195 },
217- "system" : {
218- "performance_mode" : true ,
219- "log_level" : 3
220- }
196+ "screen" : {
197+ "background" : " #1a1a2e" ,
198+ "foreground" : " #eee"
199+ },
200+ "script" : " weather.js"
221201}
222202```
223203
224- #### Power Saving Mode
204+ #### With MQTT Enabled
225205``` json
226206{
227- "wifi" : {
228- "enabled" : false
207+ "settings" : {
208+ "wifi" : {
209+ "ssid" : " MyNetwork" ,
210+ "pass" : " MyPassword"
211+ },
212+ "mqtt" : {
213+ "enabled" : true
214+ }
229215 },
230- "display" : {
231- "brightness" : 100 ,
232- "screen_timeout" : 60000
233- },
234- "system" : {
235- "performance_mode" : false
216+ "script" : " mqtt_dashboard.js"
217+ }
218+ ```
219+
220+ #### Minimal Configuration (WiFi Only)
221+ ``` json
222+ {
223+ "settings" : {
224+ "wifi" : {
225+ "ssid" : " MyNetwork" ,
226+ "pass" : " MyPassword"
227+ }
236228 }
237229}
238230```
239231
232+ ** Note:** WebScreen will start in fallback mode (displaying the notification screen) if:
233+ - No ` /webscreen.json ` configuration file is found on the SD card
234+ - The JavaScript file specified in the ` script ` field doesn't exist
235+ - The SD card cannot be mounted
236+ - WiFi connection fails (when configured)
237+
240238## Architecture & Building
241239
242240### System Architecture
0 commit comments