update
This commit is contained in:
@@ -216,6 +216,8 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout
|
|||||||
# Open and read the JSON file
|
# Open and read the JSON file
|
||||||
try:
|
try:
|
||||||
# Send the command to request data (e.g., data for 60 seconds)
|
# Send the command to request data (e.g., data for 60 seconds)
|
||||||
|
print("SART LOOP")
|
||||||
|
print("Getting NPM values")
|
||||||
ser_NPM.write(b'\x81\x12\x6D')
|
ser_NPM.write(b'\x81\x12\x6D')
|
||||||
|
|
||||||
# Read the response
|
# Read the response
|
||||||
@@ -242,6 +244,7 @@ try:
|
|||||||
|
|
||||||
# Sonde BME280 connected
|
# Sonde BME280 connected
|
||||||
if bme_280_config:
|
if bme_280_config:
|
||||||
|
print("Getting BME280 values")
|
||||||
#on récupère les infos du BME280 et on les ajoute au payload_csv
|
#on récupère les infos du BME280 et on les ajoute au payload_csv
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c, address=0x76)
|
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c, address=0x76)
|
||||||
@@ -314,7 +317,7 @@ try:
|
|||||||
print(f"No serial connection for {name}")
|
print(f"No serial connection for {name}")
|
||||||
|
|
||||||
# Getting the LTE Signal
|
# Getting the LTE Signal
|
||||||
print("-> Getting signal <-")
|
print("-> Getting LTE signal <-")
|
||||||
ser_sara.write(b'AT+CSQ\r')
|
ser_sara.write(b'AT+CSQ\r')
|
||||||
response2 = read_complete_response(ser_sara)
|
response2 = read_complete_response(ser_sara)
|
||||||
print("Response:")
|
print("Response:")
|
||||||
@@ -349,7 +352,7 @@ try:
|
|||||||
ser_sara.write(csv_string.encode())
|
ser_sara.write(csv_string.encode())
|
||||||
response_SARA_2 = read_complete_response(ser_sara)
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
if need_to_log:
|
if need_to_log:
|
||||||
print("Write to memory:")
|
print("Write data to memory:")
|
||||||
print(response_SARA_2)
|
print(response_SARA_2)
|
||||||
|
|
||||||
#3. Send to endpoint (with device ID)
|
#3. Send to endpoint (with device ID)
|
||||||
@@ -357,12 +360,10 @@ 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'))
|
||||||
|
|
||||||
print("Waiting for +UUHTTPCR response...")
|
|
||||||
response_received = False
|
|
||||||
while not response_received:
|
|
||||||
response_SARA_3 = read_complete_response(ser_sara, timeout=5)
|
response_SARA_3 = read_complete_response(ser_sara, timeout=5)
|
||||||
print(response_SARA_3)
|
print(response_SARA_3)
|
||||||
if "+UUHTTPCR" in response_SARA_3:
|
if "+UUHTTPCR" in response_SARA_3:
|
||||||
|
print("Received +UUHTTPCR response.")
|
||||||
response_received = True
|
response_received = True
|
||||||
|
|
||||||
# Les types de réponse
|
# Les types de réponse
|
||||||
|
|||||||
Reference in New Issue
Block a user