wip
This commit is contained in:
@@ -376,30 +376,33 @@ def main() -> NoReturn:
|
||||
stop_download_event.set()
|
||||
pm.send('gpsLocation', msg)
|
||||
|
||||
# Custom GPS tracking by brian
|
||||
current_time = time.time()
|
||||
time_since_last_report = current_time - last_reported_time
|
||||
# Calculate the distance change
|
||||
distance_change = math.sqrt((gps.latitude - (last_reported_latitude or 0))**2 +
|
||||
(gps.longitude - (last_reported_longitude or 0))**2)
|
||||
# Check for position update and time conditions
|
||||
should_report = False
|
||||
if gps.speed < 2:
|
||||
if time_since_last_report >= 1 and distance_change >= MIN_DISTANCE_CHANGE:
|
||||
should_report = True
|
||||
else:
|
||||
if time_since_last_report >= 30 and distance_change >= MIN_DISTANCE_CHANGE:
|
||||
should_report = True
|
||||
try:
|
||||
# Custom GPS tracking by brian
|
||||
current_time = time.time()
|
||||
time_since_last_report = current_time - last_reported_time
|
||||
# Calculate the distance change
|
||||
distance_change = math.sqrt((gps.latitude - (last_reported_latitude or 0))**2 +
|
||||
(gps.longitude - (last_reported_longitude or 0))**2)
|
||||
|
||||
# Execute reporting if conditions are met
|
||||
if should_report:
|
||||
# Check for position update and time conditions
|
||||
should_report = False
|
||||
if gps.speed < 2:
|
||||
if time_since_last_report >= 1 and distance_change >= MIN_DISTANCE_CHANGE:
|
||||
should_report = True
|
||||
else:
|
||||
if time_since_last_report >= 30 and distance_change >= MIN_DISTANCE_CHANGE:
|
||||
should_report = True
|
||||
|
||||
# Execute reporting if conditions are met
|
||||
if should_report:
|
||||
last_reported_time = current_time
|
||||
last_reported_latitude = gps.latitude
|
||||
last_reported_longitude = gps.longitude
|
||||
if os.path.exists("/data/brian/gps_tracking.sh"):
|
||||
# Update the last reported time and location
|
||||
subprocess.run(["bash", "/data/brian/gps_tracking.sh", str(gps.latitude), str(gps.longitude)])
|
||||
|
||||
# Update the last reported time and location
|
||||
subprocess.run(["bash", "/data/brian/gps_tracking.sh", str(gps.latitude), str(gps.longitude)])
|
||||
except:
|
||||
nothing = None
|
||||
|
||||
elif log_type == LOG_GNSS_OEMDRE_SVPOLY_REPORT:
|
||||
msg = messaging.new_message('qcomGnss', valid=True)
|
||||
|
||||
Reference in New Issue
Block a user