-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: major code restructure and added support for esp32s3
- Loading branch information
1 parent
dfc8a55
commit 6989a46
Showing
72 changed files
with
966 additions
and
1,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/ipch | ||
.DS* |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"partitions": "default.csv", | ||
"memory_type": "opi_opi" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1", | ||
"-DBOARD_HAS_PSRAM", | ||
"-D_NEOPIXEL_PIN=38" | ||
|
||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "opi", | ||
"psram_type": "opi", | ||
"hwids": [ | ||
[ | ||
"0x303A", | ||
"0x1001" | ||
] | ||
], | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": [ | ||
"wifi", | ||
"bluetooth" | ||
], | ||
"debug": { | ||
"default_tool": "esp-builtin", | ||
"onboard_tools": [ | ||
"esp-builtin" | ||
], | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": [ | ||
"arduino", | ||
"espidf" | ||
], | ||
"platforms": [ | ||
"espressif32" | ||
], | ||
"name": "Espressif ESP32-S3-DevKitC-1-N32R8V (32 MB Flash Octal, 8 MB PSRAM Octal)", | ||
"upload": { | ||
"flash_size": "32MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 33554432, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html", | ||
"vendor": "Espressif" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"partitions": "default.csv", | ||
"memory_type": "opi_opi" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1", | ||
"-DBOARD_HAS_PSRAM", | ||
"-D_NEOPIXEL_PIN=38" | ||
|
||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "opi", | ||
"psram_type": "opi", | ||
"hwids": [ | ||
[ | ||
"0x303A", | ||
"0x1001" | ||
] | ||
], | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": [ | ||
"wifi", | ||
"bluetooth" | ||
], | ||
"debug": { | ||
"default_tool": "esp-builtin", | ||
"onboard_tools": [ | ||
"esp-builtin" | ||
], | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": [ | ||
"arduino", | ||
"espidf" | ||
], | ||
"platforms": [ | ||
"espressif32" | ||
], | ||
"name": "Espressif ESP32-S3-DevKitC-1-N32R8V (32 MB Flash Octal, 8 MB PSRAM Octal)", | ||
"upload": { | ||
"flash_size": "32MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 33554432, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html", | ||
"vendor": "Espressif" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# KNX Temperature Monitor Web Interface | ||
|
||
This directory contains two versions of the web interface for different WebSocket implementations: | ||
|
||
## 1. WebSocket with /ws prefix (index-ws.html) | ||
- Uses the standard HTTP port with a `/ws` path prefix for WebSocket connections | ||
- Suitable for ESP32 using standard WebServer | ||
- Files: | ||
- `index-ws.html`: Main HTML file | ||
- `script-ws.js`: WebSocket client implementation | ||
|
||
## 2. WebSocket on Port 81 (index-port81.html) | ||
- Uses a dedicated WebSocket server on port 81 | ||
- Suitable for ESP8266 or when using AsyncWebServer | ||
- Files: | ||
- `index-port81.html`: Main HTML file | ||
- `script-port81.js`: WebSocket client implementation | ||
|
||
## Usage | ||
1. Choose the appropriate HTML file based on your ESP device and web server implementation: | ||
- For standard WebServer with `/ws` prefix: Use `index-ws.html` | ||
- For dedicated WebSocket server on port 81: Use `index-port81.html` | ||
2. Upload the corresponding files to your device's filesystem | ||
3. Access the web interface through your device's IP address | ||
|
||
Both versions provide the same functionality: | ||
- Real-time temperature display | ||
- Connection status indication | ||
- Automatic reconnection attempts | ||
- JSON message parsing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>KNX Temperature Monitor (Port 81)</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>KNX Temperature Monitor</h1> | ||
<div class="temperature-display"> | ||
<div class="value">--.-</div> | ||
<div class="unit">°C</div> | ||
</div> | ||
<div class="status"> | ||
<div class="connection-status">Connecting...</div> | ||
</div> | ||
<div class="info">Using WebSocket port 81</div> | ||
</div> | ||
<script src="script-port81.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const temperatureValue = document.querySelector('.value'); | ||
const connectionStatus = document.querySelector('.connection-status'); | ||
let ws = null; | ||
let reconnectAttempts = 0; | ||
const maxReconnectAttempts = 5; | ||
|
||
function connect() { | ||
// Use secure WebSocket if page is served over HTTPS | ||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; | ||
const wsUrl = `${protocol}//${window.location.hostname}:81`; | ||
|
||
console.log('Connecting to WebSocket:', wsUrl); | ||
ws = new WebSocket(wsUrl); | ||
|
||
ws.onopen = () => { | ||
console.log('WebSocket connected'); | ||
connectionStatus.textContent = 'Connected'; | ||
connectionStatus.classList.add('connected'); | ||
connectionStatus.classList.remove('disconnected'); | ||
reconnectAttempts = 0; | ||
}; | ||
|
||
ws.onclose = () => { | ||
console.log('WebSocket disconnected'); | ||
connectionStatus.textContent = 'Disconnected'; | ||
connectionStatus.classList.add('disconnected'); | ||
connectionStatus.classList.remove('connected'); | ||
|
||
// Attempt to reconnect | ||
if (reconnectAttempts < maxReconnectAttempts) { | ||
reconnectAttempts++; | ||
connectionStatus.textContent = `Reconnecting (${reconnectAttempts}/${maxReconnectAttempts})...`; | ||
setTimeout(connect, 3000); | ||
} else { | ||
connectionStatus.textContent = 'Connection failed. Please refresh the page.'; | ||
} | ||
}; | ||
|
||
ws.onerror = (error) => { | ||
console.error('WebSocket error:', error); | ||
}; | ||
|
||
ws.onmessage = (event) => { | ||
console.log('WebSocket message:', event.data); | ||
try { | ||
const data = JSON.parse(event.data); | ||
if (data.temperature !== undefined) { | ||
temperatureValue.textContent = data.temperature.toFixed(1); | ||
} | ||
} catch (e) { | ||
console.error('Error parsing WebSocket message:', e); | ||
} | ||
}; | ||
} | ||
|
||
// Initial connection | ||
connect(); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.