2024-07-11 -
This commit is contained in:
parent
a73d0d4572
commit
4bc4c4e6c6
5
gps2.py
5
gps2.py
@ -48,13 +48,10 @@ def get_gps_position():
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
while rec_null:
|
while rec_null:
|
||||||
answer = send_at('AT+CGPSINFO','+CGPSINFO: ',1)
|
answer = send_at('AT+CGPSINFO','+CGPSINFO: ',1)
|
||||||
|
client.publish("iiot/"+ myhost +"/gps", answer, 2)
|
||||||
if 1 == answer:
|
if 1 == answer:
|
||||||
answer = 0
|
answer = 0
|
||||||
if ',,,,,,' in rec_buff:
|
if ',,,,,,' in rec_buff:
|
||||||
gps_info = extract_gps_info(rec_buff)
|
|
||||||
client.publish("iiot/" + myhost + "/gps", gps_info, 2)
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
print('GPS no está listo')
|
print('GPS no está listo')
|
||||||
rec_null = False
|
rec_null = False
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user