M5Stack Core2 and GPS Module (my solution with UIFlow)
I'm using a stackable GPS unit with external antenna. Under UIFLow I've configured it to TX=14 and RX=13 and its working.
In order to get decimal return values for location data, which I need to transport into a MQTT publisher protocol, I wrote a conversion function in a “blockly” execute statement interpreted as MicroPython. Yes, yet missing some support for Altitude. Ideas for improvement of the logic are welcome.
Hope this is helpful (see the code below):
# GPS location conversion
# convert into decimal
def conversion(inp):
minus = False
parts = inp.split('.')
ddmm = parts[0]
ss = parts[1]
last_char = ss[-1]
if (last_char == 'W') or (last_char == 'S'):
minus = True
# remove last character
ss = ss[:-1]
last_two_char = ddmm[-2:]
mm = last_two_char
if len(ddmm) == 3:
dd = ddmm[:1]
if len(ddmm) == 4:
dd = ddmm[:2]
if len(ddmm) == 5:
dd = ddmm[:3]
if minus:
dd = int(dd) * -1
minf = float(mm + '.' + ss)
secsmm = minf / 60
# case South, or West invert
if minus:
deci = float(dd - secsmm)
else:
deci = float(dd + secsmm)
return deci