From 4d45e34a21a4117b81ed9c957871185146305b6a Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 Jan 2025 12:28:08 +0100 Subject: [PATCH] update --- html/admin.html | 88 +++++++++++++++++++++++++++++------------ loop/1_NPM/send_data.py | 19 +++++---- 2 files changed, 73 insertions(+), 34 deletions(-) diff --git a/html/admin.html b/html/admin.html index 009897b..e0c5dd2 100755 --- a/html/admin.html +++ b/html/admin.html @@ -51,33 +51,48 @@

Admin

-
-
+ +
+ +
+

Parameters

+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+

Updates

+ + + + +
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
@@ -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); + } + }); + } diff --git a/loop/1_NPM/send_data.py b/loop/1_NPM/send_data.py index c4e490f..8107bf1 100755 --- a/loop/1_NPM/send_data.py +++ b/loop/1_NPM/send_data.py @@ -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.")