update
This commit is contained in:
@@ -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="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 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>
|
||||||
</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>
|
||||||
|
|||||||
@@ -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.")
|
||||||
|
|||||||
Reference in New Issue
Block a user