diff --git a/config.json.dist b/config.json.dist index d65faab..8315cfb 100755 --- a/config.json.dist +++ b/config.json.dist @@ -1,4 +1,5 @@ { + "loop_activation": true, "loop_log": true, "boot_log": true, "deviceID": "XXXX", diff --git a/html/admin.html b/html/admin.html index 4f3308c..f00bb1b 100755 --- a/html/admin.html +++ b/html/admin.html @@ -60,27 +60,37 @@
- - + +
+
- - + +
+ +
+ + +
+
- -
+
- - + +
+
- - -
+ + + +
@@ -142,6 +152,29 @@ window.onload = function() { element.innerText = deviceName; }); + //get BME check + const checkbox = document.getElementById("check_bme280s"); + checkbox.checked = data.i2c_BME; + + //loop activation + const flex_loop = document.getElementById("flex_loop"); + flex_loop.checked = data.loop_activation; + + //loop logs + const flex_loop_log = document.getElementById("flex_loop_log"); + flex_loop_log.checked = data.loop_log; + + //start logs + const flex_start_log = document.getElementById("flex_start_log"); + flex_start_log.checked = data.boot_log; + + //device name + const device_name = document.getElementById("device_name"); + device_name.value = data.deviceName; + + //device ID + const device_ID = document.getElementById("device_ID"); + device_ID.value = data.deviceID.toUpperCase(); //get local RTC $.ajax({ @@ -163,6 +196,21 @@ window.onload = function() { } +function update_config(isChecked){ + console.log("Updated flex_loop:", isChecked); + $.ajax({ + url: 'launcher.php?type=update_config', + dataType: 'text', // Specify that you expect a JSON response + method: 'GET', // Use GET or POST depending on your needs + success: function(response) { + console.log(response); + }, + error: function(xhr, status, error) { + console.error('AJAX request failed:', status, error); + } + }); +} + function updateGitPull(){ console.log("Updating device (git pull)"); diff --git a/html/launcher.php b/html/launcher.php index f2ced74..dd64f65 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -1,6 +1,15 @@