Browse Source

add boulder example

Brennen Bearnes 1 year ago
parent
commit
b4ad89f0f2
2 changed files with 9 additions and 7 deletions
  1. 8
    6
      glitterpos.py
  2. 1
    1
      glitterpos_cfg.py

+ 8
- 6
glitterpos.py View File

@@ -32,7 +32,7 @@ CYAN = (0, 255, 255)
32 32
 BLUE = (0, 0, 255)
33 33
 PURPLE = (180, 0, 255)
34 34
 
35
-MAN_ID = 23
35
+# BOULDER_ID = 23
36 36
 
37 37
 COLOR_LOOKUP = {
38 38
     0: GREEN,
@@ -43,7 +43,11 @@ COLOR_LOOKUP = {
43 43
     5: (100, 0, 255),
44 44
     6: (0, 100, 200),
45 45
     7: (100, 50, 100),
46
-    MAN_ID: RED,
46
+    # BOULDER_ID: RED
47
+}
48
+
49
+DEFAULT_BOX_COORDS = {
50
+    # BOULDER_ID: (40.018258, -105.278457)
47 51
 }
48 52
 
49 53
 RADIO_FREQ_MHZ = 915.0
@@ -58,9 +62,7 @@ class GlitterPOS:
58 62
 
59 63
         # Our id and the dict for storing coords of other glitterpos_boxes:
60 64
         self.glitterpos_id = MY_ID
61
-        self.glitterpos_boxes = {
62
-            MAN_ID: (40.786462, -119.206686),
63
-        }
65
+        self.glitterpos_boxes = DEFAULT_BOX_COORDS
64 66
 
65 67
         # Set the RTC to an obviously bogus time for debugging purposes:
66 68
         # time_struct takes: (tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst)
@@ -216,7 +218,7 @@ class GlitterPOS:
216 218
         print('   received (raw bytes): {0}'.format(packet))
217 219
         pieces = packet.split(b':')
218 220
 
219
-        if pieces[0] != b'e':
221
+        if pieces[0] != b'e' or len(pieces) < 5:
220 222
             print('   bogus packet, bailing out')
221 223
             return
222 224
 

+ 1
- 1
glitterpos_cfg.py View File

@@ -9,4 +9,4 @@ MAG_MIN = [-0.1883, -0.16002, -0.53634]
9 9
 MAG_MAX = [0.5887, 0.72618, 0.19474]
10 10
 
11 11
 # Magnetic North - should be customized for your rough location:
12
-DECLINATION_RAD = 235.27 / 1000.0 # Black Rock City in radians
12
+DECLINATION_RAD = 0.1451 # Declination for Boulder, CO

Loading…
Cancel
Save