Skip to content

Commit 1957175

Browse files
committed
Squashed 'gps_nmea/' changes from ecd900b..3758a8d
3758a8d upd gps 9cb005d add automatic 5v power in gps app dbd100e update gps uart 25662db fixing some big bugs 07e9c82 combine 1 d5df4d8 move base pack here REVERT: ecd900b Clean up changing baud rate logic. REVERT: bdff18e Properly initialize gps_uart struct members. REVERT: 565e93b Merge pull request #24 from dl9sec/main REVERT: cc8b253 Update README.md REVERT: e3cd903 Remove unnecessary enum identifier. REVERT: 5c70f6e Add include guard to constants.h. REVERT: 7112bef Update module compatibility information. Closes #21. REVERT: ec77166 Merge pull request #23 from ezod/4800baud REVERT: fb7946f Add 4800 baud rate. Closes #20. REVERT: a27b41c Merge pull request #22 from ezod/mph REVERT: d875fb5 Add setting for speed display in miles per hour. Closes #19. REVERT: 88e7324 Add uFBT build instructions. Closes #15. REVERT: aa8a4b7 Remove YMMV warning about NEO-6M. REVERT: 734e2c4 Add Royaltek RBT-2100LP to supported module list. REVERT: 0a86422 Add installation instructions. REVERT: dc3aa4f Ignore .clang-format autogenerated by ufbt. REVERT: b36bc47 Remove unused sdk-index-url context. REVERT: 7a45a4f Add build status badge. REVERT: 96f0f59 Add GitHub action to build FAPs for dev and release SDK. REVERT: 3972929 Add missing parenthesis. REVERT: 53c610a Fix link on issue reference. REVERT: e9317fc Add note about NEO-6M not working for some people. REVERT: f433916 Add usage section to README for new interactions. Closes #11. REVERT: 47b3e0a Remove contributing section, as it is no longer relevant. REVERT: d28dfe9 Merge pull request #10 from xMasterX/ul-updates REVERT: a9c1301 Delete minmea.h REVERT: e21c132 Delete minmea.c REVERT: 53aa016 Import minmea as a submodule and add FAP library definition. REVERT: 6147cb9 Ignore .vscode from uFBT. REVERT: 841db2d Set default baud rate to 9600. REVERT: 6128470 Merge branch 'main' into ul-updates REVERT: f6fa1e7 Apply ./fbt format (excluding third-party sources). REVERT: 606389c Add all current updates REVERT: aaea283 Add comments to serial readline loop. REVERT: 5b74829 Add support for GLL NMEA sentence. REVERT: 397a8f1 Improve context object pointer handling. REVERT: 3334056 Update mutex to new API. REVERT: e7bf036 Add link to Lab401 tutorial video by RocketGod. Closes #4. REVERT: dc9fa7a Add note about PRs for compatible module list. REVERT: b73b3c6 Remove binary from source tree; to be added to GitHub release. REVERT: d400dc6 Change app category to GPIO. REVERT: 0a524e6 Add u-blox NEO-6M to compatible module list. REVERT: e8bdc1a Add list of confirmed compatible modules. REVERT: 4ab2114 FAP: API version 11.5. REVERT: e22f4fc FAP: API version 10.1. REVERT: 502ff34 FAP: API version 7.5. REVERT: 5e08103 FAP: API version 7.2. REVERT: 123583a Add default handler to input even switch statement. REVERT: 03d8ffe Add contributing section to README. REVERT: f5dbde5 Initialize time fields to zero. REVERT: f088296 Scale down wiring diagram. REVERT: c507855 Add wiring diagram. REVERT: 4f1ed02 Expand build instructions. REVERT: 27b213d Add UI image. REVERT: 60f86ae Add color-coded LED blinks on successful NMEA message parse. REVERT: b9269b4 Improve UI layout. REVERT: 87de232 Add time fields to GPS status struct. REVERT: 1014b5d Add several more GPS fields to status struct and display. REVERT: f30f219 Code style formatting overhaul. REVERT: 47fadfc Update UART code to use new stream buffer API. Closes #1. REVERT: 75940c7 Update README with new FAP target. REVERT: 58fa5b9 Rename main app source file. REVERT: b3cd0e7 Update application manifest and add icon. REVERT: 8aff5d2 Move sources to root of repository. REVERT: 6e654f9 Mention and link minmea in README. REVERT: c4909c6 Create README. REVERT: fe98f61 Import and FAP conversion of GPS plugin from flipperzero-firmware fork. Does not build yet as stream_buffer.h API is not yet available for FAP. REVERT: 2feee6c Initial commit git-subtree-dir: gps_nmea git-subtree-split: 3758a8d
1 parent ecd900b commit 1957175

13 files changed

+972
-153
lines changed

.github/workflows/build.yml

-34
This file was deleted.

.gitignore

-57
This file was deleted.

.gitmodules

-3
This file was deleted.

README.md

+14-45
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
# GPS for Flipper Zero
22

3-
[![FAP Build](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml/badge.svg)](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml)
3+
A simple Flipper Zero application for NMEA 0183 serial GPS modules, such as the
4+
- Adafruit Ultimate GPS Breakout.
45

5-
A simple Flipper Zero application for NMEA 0183 serial GPS modules.
6-
7-
![ui](ui.png)
8-
9-
Heavy lifting (NMEA parsing) provided by [minmea].
10-
11-
## Installation
12-
13-
1. Navigate to the [FAP Build](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml)
14-
GitHub action workflow, and select the most recent run.
15-
2. The FAP is built for both the `dev` and `release` channels of the official
16-
firmware. Download the artifact corresponding to your firmware version.
17-
3. Extract `gps_nmea.fap` from the ZIP file to `apps/GPIO` on your Flipper
18-
Zero SD card.
6+
Heavy lifting (NMEA parsing) provided by minmea.
197

208
## Usage
219

2210
This is a single-screen app, and a few interactions are provided via the
2311
hardware buttons:
2412

2513
- Long press the up button to change the **baud rate**. The default baud rate
26-
is 9600, but 4800, 19200, 38400, 57600, and 115200 baud are also supported.
14+
is 9600, but 19200, 38400, 57600, and 115200 baud are also supported.
2715
- Long press the right button to change **speed units** from knots to
2816
kilometers per hour.
2917
- Press the OK button to set the **backlight** to always on mode. Press it
@@ -35,43 +23,24 @@ hardware buttons:
3523
Connect the GPS module to power and the USART using GPIO pins 9 (3.3V), 11
3624
(GND), 13 (TX), and 14 (RX), as appropriate.
3725

38-
![wiring](wiring.png)
3926

40-
See the [tutorial video](https://www.youtube.com/watch?v=5vSGFzEBp-k) from
41-
Lab401 by [RocketGod](https://github.com/RocketGod-git) for a visual guide to
27+
See the tutorial video - https://www.youtube.com/watch?v=5vSGFzEBp-k from
28+
Lab401 by RocketGod - https://github.com/RocketGod-git for a visual guide to
4229
the hardware setup.
4330

44-
### Confirmed Compatible Modules
31+
## Confirmed Compatible Modules
4532

46-
* [Adafruit Ultimate GPS Breakout]
47-
* ATGM336H
33+
* Adafruit Ultimate GPS Breakout
4834
* Beitian BN-180
49-
* Beitian BN-220
50-
* Beitian BN-280
51-
* Beitian BN-880
52-
* Beitian BK-250
53-
* Beitian BK-357
54-
* Beitian BK-880Q
55-
* Beitian BE-280
56-
* Beitian BN-280ZF
57-
* Beitian BN-357ZF
5835
* Royaltek RBT-2100LP
59-
* [u-blox NEO-6M]
60-
* [u-blox NEO-7M]
61-
* [Uputronics u-blox MAX-M8C Pico]
36+
* u-blox NEO-6M
6237

6338
If you have verified this application working with a module not listed here,
6439
please submit a PR adding it to the list.
6540

66-
## Building
67-
68-
This application can be compiled using [uFBT]. Run `ufbt` in the root directory
69-
of the repository.
41+
## Links
7042

71-
[Adafruit Ultimate GPS Breakout]: https://www.adafruit.com/product/746
72-
[minmea]: https://github.com/kosma/minmea
73-
[qFlipper]: https://flipperzero.one/update
74-
[u-blox NEO-6M]: https://www.u-blox.com/en/product/neo-6-series
75-
[u-blox NEO-7M]: https://www.u-blox.com/en/product/neo-7-series
76-
[uFBT]: https://github.com/flipperdevices/flipperzero-ufbt
77-
[Uputronics u-blox MAX-M8C Pico]: https://store.uputronics.com/index.php?route=product/product&product_id=72
43+
Original repo link - https://github.com/ezod/flipperzero-gps
44+
Adafruit Ultimate GPS Breakout: https://www.adafruit.com/product/746
45+
minmea: https://github.com/kosma/minmea
46+
u-blox NEO-6M: https://www.u-blox.com/en/product/neo-6-series

application.fam

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ App(
88
order=35,
99
fap_icon="gps_10px.png",
1010
fap_category="GPIO",
11-
fap_private_libs=[
12-
Lib(
13-
name="minmea",
14-
sources=["minmea.c"],
15-
cdefines=["timegm=mktime"],
16-
),
17-
],
11+
fap_author="@ezod & @xMasterX",
12+
fap_version="1.2",
13+
fap_description="Works with GPS modules via UART, using NMEA protocol.",
1814
)

gps.c

+19-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "constants.h"
33

44
#include <furi.h>
5+
#include <furi_hal_power.h>
56
#include <gui/gui.h>
67
#include <string.h>
78

@@ -94,6 +95,14 @@ int32_t gps_app(void* p) {
9495

9596
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
9697

98+
uint8_t attempts = 0;
99+
bool otg_was_enabled = furi_hal_power_is_otg_enabled();
100+
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
101+
furi_hal_power_enable_otg();
102+
furi_delay_ms(10);
103+
}
104+
furi_delay_ms(200);
105+
97106
GpsUart* gps_uart = gps_uart_enable();
98107

99108
gps_uart->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
@@ -159,6 +168,8 @@ int32_t gps_app(void* p) {
159168

160169
gps_uart_init_thread(gps_uart);
161170
gps_uart->changing_baudrate = true;
171+
furi_mutex_release(gps_uart->mutex);
172+
view_port_update(view_port);
162173
break;
163174
case InputKeyRight:
164175
gps_uart->speed_units++;
@@ -175,11 +186,10 @@ int32_t gps_app(void* p) {
175186
}
176187
}
177188
}
178-
179-
view_port_update(view_port);
180-
furi_mutex_release(gps_uart->mutex);
181-
182-
if(gps_uart->changing_baudrate) {
189+
if(!gps_uart->changing_baudrate) {
190+
furi_mutex_release(gps_uart->mutex);
191+
view_port_update(view_port);
192+
} else {
183193
furi_delay_ms(1000);
184194
gps_uart->changing_baudrate = false;
185195
}
@@ -194,5 +204,9 @@ int32_t gps_app(void* p) {
194204
furi_mutex_free(gps_uart->mutex);
195205
gps_uart_disable(gps_uart);
196206

207+
if(furi_hal_power_is_otg_enabled() && !otg_was_enabled) {
208+
furi_hal_power_disable_otg();
209+
}
210+
197211
return 0;
198212
}

gps_uart.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <string.h>
22

3-
#include <minmea.h>
3+
#include "minmea.h"
44
#include "gps_uart.h"
55

66
typedef enum {

img/1.png

2.21 KB
Loading

img/2.png

2.2 KB
Loading

img/3.png

2.2 KB
Loading

lib/minmea

-1
This file was deleted.

0 commit comments

Comments
 (0)