This commit is contained in:
Your Name
2025-01-20 12:28:08 +01:00
parent cb600df2ef
commit 4d45e34a21
2 changed files with 73 additions and 34 deletions

View File

@@ -51,33 +51,48 @@
<main class="col-md-10 ms-sm-auto col-lg-11 offset-md-2 offset-lg-1 px-md-4"> <main class="col-md-10 ms-sm-auto col-lg-11 offset-md-2 offset-lg-1 px-md-4">
<h1 class="mt-4">Admin</h1> <h1 class="mt-4">Admin</h1>
<div class="col-lg-6 col-12">
<form>
<div class="form-check form-switch mb-2"> <div class="row mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<label class="form-check-label" for="flexSwitchCheckDefault">Loop Logs</label> <div class="col-lg-4 col-12">
</div> <h3 class="mt-4">Parameters</h3>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault"> <form>
<label class="form-check-label" for="flexSwitchCheckDefault">Boot Logs</label>
</div> <div class="form-check form-switch mb-2">
<div class="form-check mb-3"> <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault"> <label class="form-check-label" for="flexSwitchCheckDefault">Loop Logs</label>
<label class="form-check-label" for="flexCheckDefault"> </div>
Sonde temp/hum (BME280) <div class="form-check form-switch mb-2">
</label> <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
</div> <label class="form-check-label" for="flexSwitchCheckDefault">Boot Logs</label>
<div class="mb-3"> </div>
<label for="exampleInputEmail1" class="form-label">ssh tunnel port</label> <div class="form-check mb-3">
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"> <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
</div> <label class="form-check-label" for="flexCheckDefault">
<div class="mb-3"> Sonde temp/hum (BME280)
<label for="exampleInputPassword1" class="form-label">Password</label> </label>
<input type="password" class="form-control" id="exampleInputPassword1"> </div>
</div> <div class="mb-3">
<button type="submit" class="btn btn-primary">Submit</button> <label for="exampleInputEmail1" class="form-label">ssh tunnel port</label>
</form> <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<div class="col-lg-4 col-12">
<h3 class="mt-4">Updates</h3>
<button type="submit" class="btn btn-primary" onclick="updateGitPull()">Update firmware</button>
</div>
</div> </div>
</main> </main>
</div> </div>
@@ -138,6 +153,27 @@ window.onload = function() {
}) })
.catch(error => console.error('Error loading config.json:', error)); .catch(error => console.error('Error loading config.json:', error));
} }
function updateGitPull(){
console.log("Updating device (git pull)");
$.ajax({
url: 'launcher.php?type=git_pull',
method: 'GET', // Use GET or POST depending on your needs
success: function(response) {
// Handle success response if needed
console.log(response);
alert(response);
// Reload the page after the device update
location.reload(); // This will reload the page
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
}
});
}
</script> </script>
</body> </body>

View File

@@ -360,14 +360,17 @@ try:
command= f'AT+UHTTPC=0,4,"/pro_4G/data.php?sensor_id={device_id}","server_response.txt","sensordata_csv.json",4\r' command= f'AT+UHTTPC=0,4,"/pro_4G/data.php?sensor_id={device_id}","server_response.txt","sensordata_csv.json",4\r'
ser_sara.write(command.encode('utf-8')) ser_sara.write(command.encode('utf-8'))
# Wait for the +UUHTTPCR response response_SARA_3 = read_complete_response(ser_sara, timeout=5)
print("Waiting for +UUHTTPCR response...") print(response_SARA_3)
response_received = False
while not response_received: # Wait for the +UUHTTPCR response
response_SARA_3 = read_complete_response(ser_sara, timeout=5) #print("Waiting for +UUHTTPCR response...")
print(response_SARA_3) #response_received = False
if "+UUHTTPCR" in response_SARA_3: #while not response_received:
response_received = True # response_SARA_3 = read_complete_response(ser_sara, timeout=5)
# print(response_SARA_3.strip())
# if "+UUHTTPCR" in response_SARA_3:
# response_received = True
if "+UUHTTPCR" in response_SARA_3: if "+UUHTTPCR" in response_SARA_3:
print("Received +UUHTTPCR response.") print("Received +UUHTTPCR response.")