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">
<h1 class="mt-4">Admin</h1>
<div class="col-lg-6 col-12">
<form>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<label class="form-check-label" for="flexSwitchCheckDefault">Loop Logs</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<label class="form-check-label" for="flexSwitchCheckDefault">Boot Logs</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Sonde temp/hum (BME280)
</label>
</div>
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">ssh tunnel port</label>
<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 class="row mb-3">
<div class="col-lg-4 col-12">
<h3 class="mt-4">Parameters</h3>
<form>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<label class="form-check-label" for="flexSwitchCheckDefault">Loop Logs</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
<label class="form-check-label" for="flexSwitchCheckDefault">Boot Logs</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Sonde temp/hum (BME280)
</label>
</div>
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">ssh tunnel port</label>
<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>
</main>
</div>
@@ -138,6 +153,27 @@ window.onload = function() {
})
.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>
</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'
ser_sara.write(command.encode('utf-8'))
# Wait for the +UUHTTPCR response
print("Waiting for +UUHTTPCR response...")
response_received = False
while not response_received:
response_SARA_3 = read_complete_response(ser_sara, timeout=5)
print(response_SARA_3)
if "+UUHTTPCR" in response_SARA_3:
response_received = True
response_SARA_3 = read_complete_response(ser_sara, timeout=5)
print(response_SARA_3)
# Wait for the +UUHTTPCR response
#print("Waiting for +UUHTTPCR response...")
#response_received = False
#while not response_received:
# 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:
print("Received +UUHTTPCR response.")