Skip to content

Commit e824174

Browse files
authored
Merge pull request cjkas#13 from shailensobhee/main
minor edits to see the GPIO pins on ESP32-C6-WROOM-1
2 parents 2ca1b8b + 3b6e1d1 commit e824174

15 files changed

Lines changed: 495 additions & 59 deletions

.gitignore

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
1+
# IDE and Tooling
12
.theia/
3+
.vscode/
4+
.claude/
5+
.pio/
26
debug_custom.json
7+
debug.cfg
8+
9+
# Hardware / SVD Files
310
esp32.vsd
411
esp32s3.svd
5-
debug.cfg
612

7-
SomfyController.ino.XIAO_ESP32S3.bin
8-
SomfyController.ino.esp32c3.bin
9-
SomfyController.ino.esp32s2.bin
10-
.vscode/
11-
.pio/
12-
.claude/
13-
data/
13+
# Build, Logs and Output Folders
1414
build/
15-
coredump_report.txt
16-
coredump.bin
15+
data/
1716
logs/
17+
managed_components/
18+
19+
# ESP-IDF Specific
20+
sdkconfig
21+
sdkconfig.old
22+
sdkconfig.*
23+
24+
# Binary and Archive Files
25+
*.elf
1826
elf_archive/
27+
coredump_report.txt
28+
coredump.bin
29+
30+
# Project Specific / Generated Source
1931
src/SomfyController.ino.cpp
32+
33+
# Ignore Somfy INO/Bin files
34+
SomfyController.ino.XIAO_ESP32S3.bin
35+
SomfyController.ino.esp32c3.bin
36+
SomfyController.ino.esp32s2.bin
37+
38+
# Temporary and Backup Files
39+
*.orig
40+
*.bak

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cmake_minimum_required(VERSION 3.16.0)
2+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
3+
project(ESPSomfy-RTS)

app_version.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
Import("env")
3+
4+
# Define the folder and filename
5+
DATA_FOLDER = "data-src"
6+
FILENAME = "appversion"
7+
8+
# Construct the full path: /your/project/path/data-src/appversion
9+
project_dir = env.get("PROJECT_DIR")
10+
version_file_path = os.path.join(project_dir, DATA_FOLDER, FILENAME)
11+
12+
# Default fallback if something goes wrong
13+
version = "0.0.0"
14+
15+
if os.path.exists(version_file_path):
16+
try:
17+
with open(version_file_path, "r") as f:
18+
version = f.read().strip()
19+
# Clean output for the PlatformIO console
20+
print(f"--- SUCCESS: Found version {version} in {version_file_path} ---")
21+
except Exception as e:
22+
print(f"--- ERROR: could not read version file: {e} ---")
23+
else:
24+
print(f"--- ERROR: File NOT FOUND at {version_file_path} ---")
25+
26+
# Apply to the build environment
27+
# We use escaped quotes so C++ treats it as a string literal "vX.X.X"
28+
full_version_str = f'\\"v{version}\\"'
29+
30+
env.Append(CPPDEFINES=[
31+
("FW_VERSION", full_version_str)
32+
])

data-src/index.js

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
//var hst = '192.168.1.208';
2-
var hst = '192.168.1.152';
3-
//var hst = '192.168.1.159';
1+
/**
2+
* hst is a development convenience variable: it's a hardcoded IP address used when the HTML file is opened directly
3+
* from the filesystem (i.e., file:// protocol) rather than served from the ESP32.
4+
* Adapt the IP accordingly based on your router configuration.
5+
**/
6+
var hst = '192.168.178.20';
47
var _rooms = [{ roomId: 0, name: 'Home' }];
58

69
var errors = [
@@ -1268,9 +1271,27 @@ class Security {
12681271
}
12691272
var security = new Security();
12701273

1274+
// let appVersion = 'v3.0.11'; // Default placeholder
1275+
async function getAppVersion() {
1276+
try {
1277+
const response = await fetch('/appversion');
1278+
if (!response.ok) throw new Error('File not found');
1279+
1280+
const data = await response.text();
1281+
appVersion = `v${data.trim()}`;
1282+
1283+
console.log("Loaded Version:", appVersion);
1284+
// Trigger any UI updates here
1285+
} catch (error) {
1286+
console.error("Error loading App version:", error);
1287+
appVersion = 'v3.0.11'; // Default placeholder
1288+
}
1289+
return appVersion;
1290+
}
1291+
12711292
class General {
12721293
initialized = false;
1273-
appVersion = 'v3.0.11';
1294+
appVersion = getAppVersion();
12741295
reloadApp = false;
12751296
init() {
12761297
if (this.initialized) return;
@@ -2795,16 +2816,17 @@ class Somfy {
27952816
document.getElementById('divLinkedShadeList').innerHTML = divCfg;
27962817
}
27972818
pinMaps = [
2798-
{ name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] },
2819+
{ name: '', maxPins: 39, inputs: [], outputs: [] },
27992820
{ name: 's2', maxPins: 46, inputs: [0, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 45], outputs: [0, 19, 20, 26, 27, 28, 29, 30, 31, 32, 45, 46]},
28002821
{ name: 's3', maxPins: 48, inputs: [19, 20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32], outputs: [19, 20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32] },
2801-
{ name: 'c3', maxPins: 21, inputs: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], outputs: [11, 12, 13, 14, 15, 16, 17, 21] }
2822+
{ name: 'c3', maxPins: 21, inputs: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], outputs: [11, 12, 13, 14, 15, 16, 17, 21] },
2823+
{ name: 'c6', maxPins: 23, inputs: [], outputs: [] }
28022824
];
28032825

28042826
loadPins(type, sel, opt) {
28052827
while (sel.firstChild) sel.removeChild(sel.firstChild);
28062828
let cm = document.getElementById('divContainer').getAttribute('data-chipmodel');
2807-
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] };
2829+
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [], outputs: [] };
28082830
//console.log({ cm: cm, pm: pm });
28092831
for (let i = 0; i <= pm.maxPins; i++) {
28102832
if (type.includes('in') && pm.inputs.includes(i)) continue;
@@ -4815,3 +4837,15 @@ class Firmware {
48154837
}
48164838
var firmware = new Firmware();
48174839

4840+
window.addEventListener('load', async () => {
4841+
// 1. Initialize your main application logic
4842+
// await init();
4843+
4844+
// 2. Fetch and display the app version
4845+
appVersion = await getAppVersion();
4846+
const spanAppVersion = document.getElementById('spanAppVersion');
4847+
spanAppVersion.innerText = `${appVersion.trim()}`;
4848+
4849+
console.log("Application fully loaded and version updated.");
4850+
});
4851+

0 commit comments

Comments
 (0)