Add : cut power to the GPS module if gps_enable if False to save battery
This commit is contained in:
parent
b08a56b204
commit
403ff7f550
@ -50,6 +50,7 @@ import gc, os
|
||||
import time, rtc
|
||||
from busio import I2C, UART
|
||||
from analogio import AnalogIn
|
||||
from digitalio import DigitalInOut, Direction
|
||||
|
||||
from adafruit_bme280 import Adafruit_BME280_I2C
|
||||
from adafruit_gps import GPS
|
||||
@ -237,13 +238,20 @@ bme280 = Adafruit_BME280_I2C(i2c, address=0x76)
|
||||
# Battery voltage
|
||||
vbat = AnalogIn(board.D9, )
|
||||
|
||||
gps_en_pin = DigitalInOut(board.A5)
|
||||
gps_en_pin.direction = Direction.OUTPUT
|
||||
|
||||
# GPS on FeatherWing board
|
||||
gps_en_pin.value = not gps_enable
|
||||
if gps_enable:
|
||||
gps_uart = UART(board.TX, board.RX, baudrate=9600, timeout=3000)
|
||||
gps = GPS(gps_uart)
|
||||
# Turn on the basic GGA and RMC info
|
||||
gps.send_command('PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
|
||||
gps.send_command('PMTK220,1000') # 1000 ms refresh rate
|
||||
else:
|
||||
print("GPS dis")
|
||||
gps_en_pin = False
|
||||
|
||||
# Integrated Neopixel
|
||||
if data_to_neopixel:
|
||||
|
Loading…
Reference in New Issue
Block a user