Skip to content

Commit 6017f3f

Browse files
committed
Update LED meanings so easier to understand
1 parent 6fbc568 commit 6017f3f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

device/main.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def write_coords(filename, time, lat, lon, alt, hdop):
6767
f.write(json.dumps(d))
6868
f.write("\n")
6969
f.close()
70+
rgb.green(0x88)
71+
rgb.red(0x88)
72+
time.sleep(1)
73+
rgb.green_off()
74+
rgb.red_off()
7075

7176
rgb = RgbWrapper() #Setup LED for debug output
7277
sd_en = False #Whether to try to write to SD card
@@ -101,13 +106,12 @@ def write_coords(filename, time, lat, lon, alt, hdop):
101106
app_eui = binascii.unhexlify(config.APP_EUI)
102107
app_key = binascii.unhexlify(config.APP_KEY)
103108
lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=config.JOIN_TIMEOUT)
104-
rgb.blue(0xFF)
105109

106110
while not lora.has_joined():
107111
time.sleep(1.25)
108112
rgb.blue(0x88)
109113
time.sleep(1.25)
110-
rgb.blue(0xFF)
114+
rgb.blue_off()
111115
if sd_en: #No point in trying to get a GPS fix if no SD card as nowhere to store it
112116
if (chrono.read() - last_gps_reading) > config.GPS_READ_INTERVAL:
113117
print("Performing a GPS read to log to SD")
@@ -161,15 +165,12 @@ def write_coords(filename, time, lat, lon, alt, hdop):
161165
rgb.red_on()
162166
time.sleep(0.2)
163167
rgb.red_off()
168+
sd_en = False #Stop trying to write to SD card
164169
time.sleep(0.5)
165170
rgb.green_off()
166171
time.sleep(config.POST_MESSAGE_SLEEP)
167172
else: #No GPS fix
168173
if fix:
169174
print("Lost GPS")
170175
fix = False
171-
rgb.red_on()
172-
time.sleep(1)
173-
rgb.red_off()
174-
time.sleep(1)
175-
rgb.red_on()
176+

0 commit comments

Comments
 (0)