This commit is contained in:
PaulVua
2025-01-24 10:43:34 +01:00
parent 155a2bd453
commit 833ed458a7
4 changed files with 79 additions and 38 deletions

View File

@@ -60,22 +60,22 @@
<form>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flex_loop" onchange="update_config(this.checked)">
<input class="form-check-input" type="checkbox" role="switch" id="flex_loop" onchange="update_config('loop_activation',this.checked)">
<label class="form-check-label" for="flex_loop">Loop activation</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flex_loop_log">
<input class="form-check-input" type="checkbox" role="switch" id="flex_loop_log" onchange="update_config('loop_log', this.checked)">
<label class="form-check-label" for="flex_loop_log">Loop Logs</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flex_start_log">
<input class="form-check-input" type="checkbox" role="switch" id="flex_start_log" onchange="update_config('boot_log', this.checked)">
<label class="form-check-label" for="flex_start_log">Boot Logs</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" value="" id="check_bme280s">
<input class="form-check-input" type="checkbox" value="" id="check_bme280" onchange="update_config('i2c_BME', this.checked)">
<label class="form-check-label" for="check_bme280">
Sonde temp/hum (BME280)
</label>
@@ -83,7 +83,7 @@
<div class="mb-3">
<label for="device_name" class="form-label">Device Name</label>
<input type="text" class="form-control" id="device_name">
<input type="text" class="form-control" id="device_name" onchange="update_config('deviceName', this.value)">
</div>
<div class="mb-3">
@@ -91,7 +91,7 @@
<input type="text" class="form-control" id="device_ID" disabled>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
<!--<button type="submit" class="btn btn-primary">Submit</button>-->
</form>
</div>
@@ -153,7 +153,7 @@ window.onload = function() {
});
//get BME check
const checkbox = document.getElementById("check_bme280s");
const checkbox = document.getElementById("check_bme280");
checkbox.checked = data.i2c_BME;
//loop activation
@@ -196,10 +196,10 @@ window.onload = function() {
}
function update_config(isChecked){
console.log("Updated flex_loop:", isChecked);
function update_config(param, value){
console.log("Updating ",param," : ", value);
$.ajax({
url: 'launcher.php?type=update_config',
url: 'launcher.php?type=update_config&param='+param+'&value='+value,
dataType: 'text', // Specify that you expect a JSON response
method: 'GET', // Use GET or POST depending on your needs
success: function(response) {