aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspv <spv@spv.sh>2025-07-29 18:35:09 -0400
committerspv <spv@spv.sh>2025-07-29 18:35:09 -0400
commit636632b1d03f14c45911c1051d39ff01bd6f118a (patch)
treef889a18e83aa33f4f993aac87d0bfebf2d2f308c
parentf9edc4b39a99df397007100e13ebaf7cf2e48373 (diff)
wait for gps fix, use file extensions, make the logging all professional-like
-rw-r--r--.gitignore2
-rwxr-xr-xsrc/dirty_hack.sh (renamed from src/dirty_hack)0
-rw-r--r--src/log_shit.py12
-rwxr-xr-xsrc/setup.sh13
-rwxr-xr-xsrc/skid.sh10
-rwxr-xr-xsrc/wait_for_fix.sh14
6 files changed, 44 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index f493e93..c50a43d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+log
+
*.log
*.swp
diff --git a/src/dirty_hack b/src/dirty_hack.sh
index 67691a3..67691a3 100755
--- a/src/dirty_hack
+++ b/src/dirty_hack.sh
diff --git a/src/log_shit.py b/src/log_shit.py
index a60711f..7e5da43 100644
--- a/src/log_shit.py
+++ b/src/log_shit.py
@@ -16,20 +16,20 @@ except:
print("fake file.")
sys.exit(-1)
-print("file: %s\n\
-how often: %f\n\
-how long: %f" % (log_file, how_often, time_to_do_it))
+print("[i] file: %s\n\
+[i] how often: %f\n\
+[i] how long: %f" % (log_file, how_often, time_to_do_it))
start = time.time()
now = time.time
-print("we out here, yo", flush=True)
+print("[i] we out here, yo", flush=True)
while (start + time_to_do_it) > now():
# print("we out here, yo", flush=True)
- lat, lon, alt = [float(x) for x in subprocess.getoutput("src/dirty_hack").split(",")]
+ lat, lon, alt = [float(x) for x in subprocess.getoutput("src/dirty_hack.sh").split(",")]
- print("%f: %f, %f, %f" % (time.time_ns() / (10**9), lat, lon, alt))
+ print("[i] %f: %f, %f, %f" % (time.time_ns() / (10**9), lat, lon, alt))
f.write("%f: %f, %f, %f\n" % (time.time_ns() / (10**9), lat, lon, alt))
f.flush()
diff --git a/src/setup.sh b/src/setup.sh
new file mode 100755
index 0000000..c329f76
--- /dev/null
+++ b/src/setup.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env zsh
+
+echo '[*] enabling gps-raw & agps-msb'
+printf '[i] mmcli: '
+mmcli -m any --location-enable-{gps-raw,agps-msb}
+
+echo '[*] fixing refresh rate'
+printf '[i] mmcli: '
+mmcli -m any --location-set-gps-refresh-rate 1
+
+echo '[*] enabling signal'
+printf '[i] mmcli: '
+mmcli -m any --location-set-enable-signal \ No newline at end of file
diff --git a/src/skid.sh b/src/skid.sh
index 5671560..07cc305 100755
--- a/src/skid.sh
+++ b/src/skid.sh
@@ -4,9 +4,17 @@ clear
read
figlet gps_haxx
+echo '============================================='
sleep 1
-echo doing it.
+echo '[*] setting up...'
+
+src/setup.sh
+src/wait_for_fix.sh
+
+sleep 1
+
+echo '[*] doing it.'
python3 src/log_shit.py `date +%s`.log 1 600 \ No newline at end of file
diff --git a/src/wait_for_fix.sh b/src/wait_for_fix.sh
new file mode 100755
index 0000000..ab83968
--- /dev/null
+++ b/src/wait_for_fix.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env zsh
+
+function got_fix {
+ mmcli -m any --location-get |
+ grep -q GPS &&
+ echo 'true'
+}
+
+while [ "`got_fix`" != 'true' ]; do
+ echo "[i] waiting for fix..."
+ sleep 1
+done
+
+echo "[*] got it." \ No newline at end of file