]> git.droids-corp.org - fpv.git/commitdiff
gps: add position pinning configuration
authorOlivier Matz <zer0@droids-corp.org>
Tue, 25 Nov 2014 22:20:58 +0000 (23:20 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Tue, 25 Nov 2014 22:20:58 +0000 (23:20 +0100)
imuboard/gps_venus.c

index 3c089faa437d1277ce3e3e3c0642556e94988496..0580fa7d1572d92352bd68bf6628a3d93ab635ad 100644 (file)
@@ -152,6 +152,24 @@ typedef struct {
        uint8_t attributes;
 } m_waas_t;
 
+/* 0x39 - configure position pinning */
+#define M_PINNING 0x39
+typedef struct {
+       uint8_t enable; /* 0 = default, 1 = enable, 2 = disable */
+       uint8_t attributes; /* 0 = ram, 1 = ram+flash */
+} m_pinning_t;
+
+/* 0x3B - configure position pinning */
+#define M_PINNING_PARAMS 0x3B
+typedef struct {
+       uint16_t pin_speed;
+       uint16_t pin_cnt;
+       uint16_t unpin_speed;
+       uint16_t unpin_cnt;
+       uint16_t unpin_dist;
+       uint8_t attributes; /* 0 = ram, 1 = ram+flash */
+} m_pinning_params_t;
+
 /* 0x3C - nav mode */
 #define M_NAVMODE 0x3c
 typedef struct {
@@ -265,6 +283,33 @@ void venus634_waas(void)
        return;
 }
 
+/* Configure position pinning – Enable or disable position pinning of GNSS
+ * receiver */
+void venus634_pinning(void)
+{
+       m_pinning_t pinning;
+
+       memset(&pinning, 0, sizeof(m_pinning_t));
+       pinning.enable = 2;
+       pinning.attributes = 0; /* ram */
+
+       venus634_send(M_PINNING, &pinning, sizeof(m_pinning_t));
+}
+
+/* Configure position pinning parameters */
+void venus634_pinning_params(void)
+{
+       m_pinning_params_t pinning_params;
+
+       /* just set everything to 0 */
+       memset(&pinning_params, 0, sizeof(m_pinning_params_t));
+       pinning_params.attributes = 0; /* ram */
+
+       venus634_send(M_PINNING_PARAMS, &pinning_params,
+               sizeof(m_pinning_params_t));
+}
+
+
 /* Tell we are a car instead of a pedestrian */
 void venus634_navmode(void)
 {
@@ -591,6 +636,14 @@ static void venus634_configure(void)
        venus634_waas();
        wait_ack(M_WAAS);
 
+       printf_P(PSTR("pinning..."));
+       venus634_pinning();
+       wait_ack(M_PINNING);
+
+       printf_P(PSTR("pinning parameters..."));
+       venus634_pinning_params();
+       wait_ack(M_PINNING_PARAMS);
+
        printf_P(PSTR("rate..."));
        venus634_rate();
        wait_ack(M_RATE);