IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Arduino Discussion :

Bibliothèque Warning lors de compilation


Sujet :

Arduino

  1. #1
    Membre à l'essai Avatar de vidalv
    Homme Profil pro
    Retraité
    Inscrit en
    Janvier 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Janvier 2010
    Messages : 15
    Points : 18
    Points
    18
    Par défaut Bibliothèque Warning lors de compilation
    Bonjour,
    j'utilise la bibliothèque TinyGPS++ de http://arduiniana.org/libraries/tinygpsplus/
    Lors de la validation j'ai l'erreur suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    C:\Users\VINCENT\Documents\Arduino\libraries\TinyGPSPlus-1.0.2b\src\TinyGPS++.cpp: In member function 'bool TinyGPSPlus::encode(char)':
    C:\Users\VINCENT\Documents\Arduino\libraries\TinyGPSPlus-1.0.2b\src\TinyGPS++.cpp:63:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
         parity ^= (uint8_t)c;
         ~~~~~~~^~~~~~~~~~~~~
    C:\Users\VINCENT\Documents\Arduino\libraries\TinyGPSPlus-1.0.2b\src\TinyGPS++.cpp:64:3: note: here
       case '\r':
       ^~~~
    Comment corriger et comprendre d’où viens le problème ?

    TinyGPS++.h
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    /*
    TinyGPS++ - a small GPS library for Arduino providing universal NMEA parsing
    Based on work by and "distanceBetween" and "courseTo" courtesy of Maarten Lamers.
    Suggestion to add satellites, courseTo(), and cardinal() by Matt Monson.
    Location precision improvements suggested by Wayne Holder.
    Copyright (C) 2008-2013 Mikal Hart
    All rights reserved.
     
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
     
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
     
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
     
    #ifndef __TinyGPSPlus_h
    #define __TinyGPSPlus_h
     
    #if defined(ARDUINO) && ARDUINO >= 100
    #include "Arduino.h"
    #else
    #include "WProgram.h"
    #endif
    #include <limits.h>
     
    #define _GPS_VERSION "1.0.2" // software version of this library
    #define _GPS_MPH_PER_KNOT 1.15077945
    #define _GPS_MPS_PER_KNOT 0.51444444
    #define _GPS_KMPH_PER_KNOT 1.852
    #define _GPS_MILES_PER_METER 0.00062137112
    #define _GPS_KM_PER_METER 0.001
    #define _GPS_FEET_PER_METER 3.2808399
    #define _GPS_MAX_FIELD_SIZE 15
     
    struct RawDegrees
    {
       uint16_t deg;
       uint32_t billionths;
       bool negative;
    public:
       RawDegrees() : deg(0), billionths(0), negative(false)
       {}
    };
     
    struct TinyGPSLocation
    {
       friend class TinyGPSPlus;
    public:
       bool isValid() const    { return valid; }
       bool isUpdated() const  { return updated; }
       uint32_t age() const    { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
       const RawDegrees &rawLat()     { updated = false; return rawLatData; }
       const RawDegrees &rawLng()     { updated = false; return rawLngData; }
       double lat();
       double lng();
     
       TinyGPSLocation() : valid(false), updated(false)
       {}
     
    private:
       bool valid, updated;
       RawDegrees rawLatData, rawLngData, rawNewLatData, rawNewLngData;
       uint32_t lastCommitTime;
       void commit();
       void setLatitude(const char *term);
       void setLongitude(const char *term);
    };
     
    struct TinyGPSDate
    {
       friend class TinyGPSPlus;
    public:
       bool isValid() const       { return valid; }
       bool isUpdated() const     { return updated; }
       uint32_t age() const       { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
     
       uint32_t value()           { updated = false; return date; }
       uint16_t year();
       uint8_t month();
       uint8_t day();
     
       TinyGPSDate() : valid(false), updated(false), date(0)
       {}
     
    private:
       bool valid, updated;
       uint32_t date, newDate;
       uint32_t lastCommitTime;
       void commit();
       void setDate(const char *term);
    };
     
    struct TinyGPSTime
    {
       friend class TinyGPSPlus;
    public:
       bool isValid() const       { return valid; }
       bool isUpdated() const     { return updated; }
       uint32_t age() const       { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
     
       uint32_t value()           { updated = false; return time; }
       uint8_t hour();
       uint8_t minute();
       uint8_t second();
       uint8_t centisecond();
     
       TinyGPSTime() : valid(false), updated(false), time(0)
       {}
     
    private:
       bool valid, updated;
       uint32_t time, newTime;
       uint32_t lastCommitTime;
       void commit();
       void setTime(const char *term);
    };
     
    struct TinyGPSDecimal
    {
       friend class TinyGPSPlus;
    public:
       bool isValid() const    { return valid; }
       bool isUpdated() const  { return updated; }
       uint32_t age() const    { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
       int32_t value()         { updated = false; return val; }
     
       TinyGPSDecimal() : valid(false), updated(false), val(0)
       {}
     
    private:
       bool valid, updated;
       uint32_t lastCommitTime;
       int32_t val, newval;
       void commit();
       void set(const char *term);
    };
     
    struct TinyGPSInteger
    {
       friend class TinyGPSPlus;
    public:
       bool isValid() const    { return valid; }
       bool isUpdated() const  { return updated; }
       uint32_t age() const    { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
       uint32_t value()        { updated = false; return val; }
     
       TinyGPSInteger() : valid(false), updated(false), val(0)
       {}
     
    private:
       bool valid, updated;
       uint32_t lastCommitTime;
       uint32_t val, newval;
       void commit();
       void set(const char *term);
    };
     
    struct TinyGPSSpeed : TinyGPSDecimal
    {
       double knots()    { return value() / 100.0; }
       double mph()      { return _GPS_MPH_PER_KNOT * value() / 100.0; }
       double mps()      { return _GPS_MPS_PER_KNOT * value() / 100.0; }
       double kmph()     { return _GPS_KMPH_PER_KNOT * value() / 100.0; }
    };
     
    struct TinyGPSCourse : public TinyGPSDecimal
    {
       double deg()      { return value() / 100.0; }
    };
     
    struct TinyGPSAltitude : TinyGPSDecimal
    {
       double meters()       { return value() / 100.0; }
       double miles()        { return _GPS_MILES_PER_METER * value() / 100.0; }
       double kilometers()   { return _GPS_KM_PER_METER * value() / 100.0; }
       double feet()         { return _GPS_FEET_PER_METER * value() / 100.0; }
    };
     
    struct TinyGPSHDOP : TinyGPSDecimal
    {
       double hdop() { return value() / 100.0; }
    };
     
    class TinyGPSPlus;
    class TinyGPSCustom
    {
    public:
       TinyGPSCustom() {};
       TinyGPSCustom(TinyGPSPlus &gps, const char *sentenceName, int termNumber);
       void begin(TinyGPSPlus &gps, const char *_sentenceName, int _termNumber);
     
       bool isUpdated() const  { return updated; }
       bool isValid() const    { return valid; }
       uint32_t age() const    { return valid ? millis() - lastCommitTime : (uint32_t)ULONG_MAX; }
       const char *value()     { updated = false; return buffer; }
     
    private:
       void commit();
       void set(const char *term);
     
       char stagingBuffer[_GPS_MAX_FIELD_SIZE + 1];
       char buffer[_GPS_MAX_FIELD_SIZE + 1];
       unsigned long lastCommitTime;
       bool valid, updated;
       const char *sentenceName;
       int termNumber;
       friend class TinyGPSPlus;
       TinyGPSCustom *next;
    };
     
    class TinyGPSPlus
    {
    public:
      TinyGPSPlus();
      bool encode(char c); // process one character received from GPS
      TinyGPSPlus &operator << (char c) {encode(c); return *this;}
     
      TinyGPSLocation location;
      TinyGPSDate date;
      TinyGPSTime time;
      TinyGPSSpeed speed;
      TinyGPSCourse course;
      TinyGPSAltitude altitude;
      TinyGPSInteger satellites;
      TinyGPSHDOP hdop;
     
      static const char *libraryVersion() { return _GPS_VERSION; }
     
      static double distanceBetween(double lat1, double long1, double lat2, double long2);
      static double courseTo(double lat1, double long1, double lat2, double long2);
      static const char *cardinal(double course);
     
      static int32_t parseDecimal(const char *term);
      static void parseDegrees(const char *term, RawDegrees &deg);
     
      uint32_t charsProcessed()   const { return encodedCharCount; }
      uint32_t sentencesWithFix() const { return sentencesWithFixCount; }
      uint32_t failedChecksum()   const { return failedChecksumCount; }
      uint32_t passedChecksum()   const { return passedChecksumCount; }
     
    private:
      enum {GPS_SENTENCE_GPGGA, GPS_SENTENCE_GPRMC, GPS_SENTENCE_OTHER};
     
      // parsing state variables
      uint8_t parity;
      bool isChecksumTerm;
      char term[_GPS_MAX_FIELD_SIZE];
      uint8_t curSentenceType;
      uint8_t curTermNumber;
      uint8_t curTermOffset;
      bool sentenceHasFix;
     
      // custom element support
      friend class TinyGPSCustom;
      TinyGPSCustom *customElts;
      TinyGPSCustom *customCandidates;
      void insertCustom(TinyGPSCustom *pElt, const char *sentenceName, int index);
     
      // statistics
      uint32_t encodedCharCount;
      uint32_t sentencesWithFixCount;
      uint32_t failedChecksumCount;
      uint32_t passedChecksumCount;
     
      // internal utilities
      int fromHex(char a);
      bool endOfTermHandler();
    };
     
    #endif // def(__TinyGPSPlus_h)
    TinyGPS++.cpp
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    /*
    TinyGPS++ - a small GPS library for Arduino providing universal NMEA parsing
    Based on work by and "distanceBetween" and "courseTo" courtesy of Maarten Lamers.
    Suggestion to add satellites, courseTo(), and cardinal() by Matt Monson.
    Location precision improvements suggested by Wayne Holder.
    Copyright (C) 2008-2013 Mikal Hart
    All rights reserved.
     
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
     
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
     
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
     
    #include "TinyGPS++.h"
     
    #include <string.h>
    #include <ctype.h>
    #include <stdlib.h>
     
    #define _GPRMCterm   "GPRMC"
    #define _GPGGAterm   "GPGGA"
    #define _GNRMCterm   "GNRMC"
    #define _GNGGAterm   "GNGGA"
     
    TinyGPSPlus::TinyGPSPlus()
      :  parity(0)
      ,  isChecksumTerm(false)
      ,  curSentenceType(GPS_SENTENCE_OTHER)
      ,  curTermNumber(0)
      ,  curTermOffset(0)
      ,  sentenceHasFix(false)
      ,  customElts(0)
      ,  customCandidates(0)
      ,  encodedCharCount(0)
      ,  sentencesWithFixCount(0)
      ,  failedChecksumCount(0)
      ,  passedChecksumCount(0)
    {
      term[0] = '\0';
    }
     
    //
    // public methods
    //
     
    bool TinyGPSPlus::encode(char c)
    {
      ++encodedCharCount;
     
      switch(c)
      {
      case ',': // term terminators
        parity ^= (uint8_t)c;
      case '\r':
      case '\n':
      case '*':
        {
          bool isValidSentence = false;
          if (curTermOffset < sizeof(term))
          {
            term[curTermOffset] = 0;
            isValidSentence = endOfTermHandler();
          }
          ++curTermNumber;
          curTermOffset = 0;
          isChecksumTerm = c == '*';
          return isValidSentence;
        }
        break;
     
      case '$': // sentence begin
        curTermNumber = curTermOffset = 0;
        parity = 0;
        curSentenceType = GPS_SENTENCE_OTHER;
        isChecksumTerm = false;
        sentenceHasFix = false;
        return false;
     
      default: // ordinary characters
        if (curTermOffset < sizeof(term) - 1)
          term[curTermOffset++] = c;
        if (!isChecksumTerm)
          parity ^= c;
        return false;
      }
     
      return false;
    }
     
    //
    // internal utilities
    //
    int TinyGPSPlus::fromHex(char a)
    {
      if (a >= 'A' && a <= 'F')
        return a - 'A' + 10;
      else if (a >= 'a' && a <= 'f')
        return a - 'a' + 10;
      else
        return a - '0';
    }
     
    // static
    // Parse a (potentially negative) number with up to 2 decimal digits -xxxx.yy
    int32_t TinyGPSPlus::parseDecimal(const char *term)
    {
      bool negative = *term == '-';
      if (negative) ++term;
      int32_t ret = 100 * (int32_t)atol(term);
      while (isdigit(*term)) ++term;
      if (*term == '.' && isdigit(term[1]))
      {
        ret += 10 * (term[1] - '0');
        if (isdigit(term[2]))
          ret += term[2] - '0';
      }
      return negative ? -ret : ret;
    }
     
    // static
    // Parse degrees in that funny NMEA format DDMM.MMMM
    void TinyGPSPlus::parseDegrees(const char *term, RawDegrees &deg)
    {
      uint32_t leftOfDecimal = (uint32_t)atol(term);
      uint16_t minutes = (uint16_t)(leftOfDecimal % 100);
      uint32_t multiplier = 10000000UL;
      uint32_t tenMillionthsOfMinutes = minutes * multiplier;
     
      deg.deg = (int16_t)(leftOfDecimal / 100);
     
      while (isdigit(*term))
        ++term;
     
      if (*term == '.')
        while (isdigit(*++term))
        {
          multiplier /= 10;
          tenMillionthsOfMinutes += (*term - '0') * multiplier;
        }
     
      deg.billionths = (5 * tenMillionthsOfMinutes + 1) / 3;
      deg.negative = false;
    }
     
    #define COMBINE(sentence_type, term_number) (((unsigned)(sentence_type) << 5) | term_number)
     
    // Processes a just-completed term
    // Returns true if new sentence has just passed checksum test and is validated
    bool TinyGPSPlus::endOfTermHandler()
    {
      // If it's the checksum term, and the checksum checks out, commit
      if (isChecksumTerm)
      {
        byte checksum = 16 * fromHex(term[0]) + fromHex(term[1]);
        if (checksum == parity)
        {
          passedChecksumCount++;
          if (sentenceHasFix)
            ++sentencesWithFixCount;
     
          switch(curSentenceType)
          {
          case GPS_SENTENCE_GPRMC:
            date.commit();
            time.commit();
            if (sentenceHasFix)
            {
               location.commit();
               speed.commit();
               course.commit();
            }
            break;
          case GPS_SENTENCE_GPGGA:
            time.commit();
            if (sentenceHasFix)
            {
              location.commit();
              altitude.commit();
            }
            satellites.commit();
            hdop.commit();
            break;
          }
     
          // Commit all custom listeners of this sentence type
          for (TinyGPSCustom *p = customCandidates; p != NULL && strcmp(p->sentenceName, customCandidates->sentenceName) == 0; p = p->next)
             p->commit();
          return true;
        }
     
        else
        {
          ++failedChecksumCount;
        }
     
        return false;
      }
     
      // the first term determines the sentence type
      if (curTermNumber == 0)
      {
        if (!strcmp(term, _GPRMCterm) || !strcmp(term, _GNRMCterm))
          curSentenceType = GPS_SENTENCE_GPRMC;
        else if (!strcmp(term, _GPGGAterm) || !strcmp(term, _GNGGAterm))
          curSentenceType = GPS_SENTENCE_GPGGA;
        else
          curSentenceType = GPS_SENTENCE_OTHER;
     
        // Any custom candidates of this sentence type?
        for (customCandidates = customElts; customCandidates != NULL && strcmp(customCandidates->sentenceName, term) < 0; customCandidates = customCandidates->next);
        if (customCandidates != NULL && strcmp(customCandidates->sentenceName, term) > 0)
           customCandidates = NULL;
     
        return false;
      }
     
      if (curSentenceType != GPS_SENTENCE_OTHER && term[0])
        switch(COMBINE(curSentenceType, curTermNumber))
      {
        case COMBINE(GPS_SENTENCE_GPRMC, 1): // Time in both sentences
        case COMBINE(GPS_SENTENCE_GPGGA, 1):
          time.setTime(term);
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 2): // GPRMC validity
          sentenceHasFix = term[0] == 'A';
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 3): // Latitude
        case COMBINE(GPS_SENTENCE_GPGGA, 2):
          location.setLatitude(term);
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 4): // N/S
        case COMBINE(GPS_SENTENCE_GPGGA, 3):
          location.rawNewLatData.negative = term[0] == 'S';
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 5): // Longitude
        case COMBINE(GPS_SENTENCE_GPGGA, 4):
          location.setLongitude(term);
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 6): // E/W
        case COMBINE(GPS_SENTENCE_GPGGA, 5):
          location.rawNewLngData.negative = term[0] == 'W';
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 7): // Speed (GPRMC)
          speed.set(term);
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 8): // Course (GPRMC)
          course.set(term);
          break;
        case COMBINE(GPS_SENTENCE_GPRMC, 9): // Date (GPRMC)
          date.setDate(term);
          break;
        case COMBINE(GPS_SENTENCE_GPGGA, 6): // Fix data (GPGGA)
          sentenceHasFix = term[0] > '0';
          break;
        case COMBINE(GPS_SENTENCE_GPGGA, 7): // Satellites used (GPGGA)
          satellites.set(term);
          break;
        case COMBINE(GPS_SENTENCE_GPGGA, 8): // HDOP
          hdop.set(term);
          break;
        case COMBINE(GPS_SENTENCE_GPGGA, 9): // Altitude (GPGGA)
          altitude.set(term);
          break;
      }
     
      // Set custom values as needed
      for (TinyGPSCustom *p = customCandidates; p != NULL && strcmp(p->sentenceName, customCandidates->sentenceName) == 0 && p->termNumber <= curTermNumber; p = p->next)
        if (p->termNumber == curTermNumber)
             p->set(term);
     
      return false;
    }
     
    /* static */
    double TinyGPSPlus::distanceBetween(double lat1, double long1, double lat2, double long2)
    {
      // returns distance in meters between two positions, both specified
      // as signed decimal-degrees latitude and longitude. Uses great-circle
      // distance computation for hypothetical sphere of radius 6372795 meters.
      // Because Earth is no exact sphere, rounding errors may be up to 0.5%.
      // Courtesy of Maarten Lamers
      double delta = radians(long1-long2);
      double sdlong = sin(delta);
      double cdlong = cos(delta);
      lat1 = radians(lat1);
      lat2 = radians(lat2);
      double slat1 = sin(lat1);
      double clat1 = cos(lat1);
      double slat2 = sin(lat2);
      double clat2 = cos(lat2);
      delta = (clat1 * slat2) - (slat1 * clat2 * cdlong);
      delta = sq(delta);
      delta += sq(clat2 * sdlong);
      delta = sqrt(delta);
      double denom = (slat1 * slat2) + (clat1 * clat2 * cdlong);
      delta = atan2(delta, denom);
      return delta * 6372795;
    }
     
    double TinyGPSPlus::courseTo(double lat1, double long1, double lat2, double long2)
    {
      // returns course in degrees (North=0, West=270) from position 1 to position 2,
      // both specified as signed decimal-degrees latitude and longitude.
      // Because Earth is no exact sphere, calculated course may be off by a tiny fraction.
      // Courtesy of Maarten Lamers
      double dlon = radians(long2-long1);
      lat1 = radians(lat1);
      lat2 = radians(lat2);
      double a1 = sin(dlon) * cos(lat2);
      double a2 = sin(lat1) * cos(lat2) * cos(dlon);
      a2 = cos(lat1) * sin(lat2) - a2;
      a2 = atan2(a1, a2);
      if (a2 < 0.0)
      {
        a2 += TWO_PI;
      }
      return degrees(a2);
    }
     
    const char *TinyGPSPlus::cardinal(double course)
    {
      static const char* directions[] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"};
      int direction = (int)((course + 11.25f) / 22.5f);
      return directions[direction % 16];
    }
     
    void TinyGPSLocation::commit()
    {
       rawLatData = rawNewLatData;
       rawLngData = rawNewLngData;
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSLocation::setLatitude(const char *term)
    {
       TinyGPSPlus::parseDegrees(term, rawNewLatData);
    }
     
    void TinyGPSLocation::setLongitude(const char *term)
    {
       TinyGPSPlus::parseDegrees(term, rawNewLngData);
    }
     
    double TinyGPSLocation::lat()
    {
       updated = false;
       double ret = rawLatData.deg + rawLatData.billionths / 1000000000.0;
       return rawLatData.negative ? -ret : ret;
    }
     
    double TinyGPSLocation::lng()
    {
       updated = false;
       double ret = rawLngData.deg + rawLngData.billionths / 1000000000.0;
       return rawLngData.negative ? -ret : ret;
    }
     
    void TinyGPSDate::commit()
    {
       date = newDate;
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSTime::commit()
    {
       time = newTime;
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSTime::setTime(const char *term)
    {
       newTime = (uint32_t)TinyGPSPlus::parseDecimal(term);
    }
     
    void TinyGPSDate::setDate(const char *term)
    {
       newDate = atol(term);
    }
     
    uint16_t TinyGPSDate::year()
    {
       updated = false;
       uint16_t year = date % 100;
       return year + 2000;
    }
     
    uint8_t TinyGPSDate::month()
    {
       updated = false;
       return (date / 100) % 100;
    }
     
    uint8_t TinyGPSDate::day()
    {
       updated = false;
       return date / 10000;
    }
     
    uint8_t TinyGPSTime::hour()
    {
       updated = false;
       return time / 1000000;
    }
     
    uint8_t TinyGPSTime::minute()
    {
       updated = false;
       return (time / 10000) % 100;
    }
     
    uint8_t TinyGPSTime::second()
    {
       updated = false;
       return (time / 100) % 100;
    }
     
    uint8_t TinyGPSTime::centisecond()
    {
       updated = false;
       return time % 100;
    }
     
    void TinyGPSDecimal::commit()
    {
       val = newval;
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSDecimal::set(const char *term)
    {
       newval = TinyGPSPlus::parseDecimal(term);
    }
     
    void TinyGPSInteger::commit()
    {
       val = newval;
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSInteger::set(const char *term)
    {
       newval = atol(term);
    }
     
    TinyGPSCustom::TinyGPSCustom(TinyGPSPlus &gps, const char *_sentenceName, int _termNumber)
    {
       begin(gps, _sentenceName, _termNumber);
    }
     
    void TinyGPSCustom::begin(TinyGPSPlus &gps, const char *_sentenceName, int _termNumber)
    {
       lastCommitTime = 0;
       updated = valid = false;
       sentenceName = _sentenceName;
       termNumber = _termNumber;
       memset(stagingBuffer, '\0', sizeof(stagingBuffer));
       memset(buffer, '\0', sizeof(buffer));
     
       // Insert this item into the GPS tree
       gps.insertCustom(this, _sentenceName, _termNumber);
    }
     
    void TinyGPSCustom::commit()
    {
       strcpy(this->buffer, this->stagingBuffer);
       lastCommitTime = millis();
       valid = updated = true;
    }
     
    void TinyGPSCustom::set(const char *term)
    {
       strncpy(this->stagingBuffer, term, sizeof(this->stagingBuffer));
    }
     
    void TinyGPSPlus::insertCustom(TinyGPSCustom *pElt, const char *sentenceName, int termNumber)
    {
       TinyGPSCustom **ppelt;
     
       for (ppelt = &this->customElts; *ppelt != NULL; ppelt = &(*ppelt)->next)
       {
          int cmp = strcmp(sentenceName, (*ppelt)->sentenceName);
          if (cmp < 0 || (cmp == 0 && termNumber < (*ppelt)->termNumber))
             break;
       }
     
       pElt->next = *ppelt;
       *ppelt = pElt;
    }
    Merci pour les suggestions.

    Vincent.

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonsoir,

    Cet avertissement (pas erreur) indique le potentiel oubli d'un break; après ta ligne parity ^= (uint8_t)c;, qui conduirait également à l'exécution du code des case qui suivent.
    Si cette omission est bien volontaire, tu peux l'indiquer au compilateur en ajoutant l'attribut [[fallthrough]] :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
        parity ^= (uint8_t)c;
        [[fallthrough]];
      case '\r':
    Dernière modification par Invité ; 07/01/2020 à 19h02.

  3. #3
    Membre à l'essai Avatar de vidalv
    Homme Profil pro
    Retraité
    Inscrit en
    Janvier 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Janvier 2010
    Messages : 15
    Points : 18
    Points
    18
    Par défaut
    Bonjour,

    Alors là, Bravo !

    Pour trouver une solution à ce type de message il faut vraiment un expert, heureusement que les forums
    comme celui-ci regorges de spécialistes ....

    Ce qui me désole un peu c'est que les Bibliothèques mise à disposition ne soient pas correctement testées par leurs auteurs
    ou qui comme moi ne connaissent pas "les Us et coutumes" de la programmation...

    Bon je classe le Post en Résolu.

    Encore merci !!!

    Vincent.

  4. #4
    Expert confirmé

    Homme Profil pro
    mad scientist :)
    Inscrit en
    Septembre 2019
    Messages
    2 711
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : mad scientist :)

    Informations forums :
    Inscription : Septembre 2019
    Messages : 2 711
    Points : 5 390
    Points
    5 390
    Par défaut
    Salut

    Citation Envoyé par vidalv Voir le message
    Ce qui me désole un peu c'est que les Bibliothèques mise à disposition ne soient pas correctement testées par leurs auteurs
    ou qui comme moi ne connaissent pas "les Us et coutumes" de la programmation...
    Les bibliothèques sont écrites par des bénévoles dont bon nombre ne sont pas des professionnels du domaine... leur code est en open source donc Il faut aussi les aider (et toute la communauté) quand vous trouvez ce genre de cas en ouvrant une PULL REQUEST dans github ou en signalant un bug

    Dans le cas présent il ne faut pas oublier aussi que l’attribut [[fallthrough]]; n’est dispo dans le langage que depuis C++17 et que la librairie existait avant, et compile sans doute sur de plus vieilles versions

  5. #5
    Membre à l'essai Avatar de vidalv
    Homme Profil pro
    Retraité
    Inscrit en
    Janvier 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Retraité
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Janvier 2010
    Messages : 15
    Points : 18
    Points
    18
    Par défaut
    Merci Jay M, ce que tu dits n'est pas faux, mais il est difficile de faire le tri dans l'ensemble des solutions proposées.
    Ce n'est quand même pas évident d’interpréter les retours de compilation et de connaitre les subtilités du langage !
    Je vais poster la solution sur le Github correspondant.
    Vincent.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 3
    Dernier message: 19/03/2009, 10h56
  2. warning lors de la compilation
    Par salseropom dans le forum C
    Réponses: 6
    Dernier message: 04/12/2006, 10h46
  3. JDBC warning lors de la compilation
    Par kichemans dans le forum JDBC
    Réponses: 5
    Dernier message: 27/12/2005, 15h40
  4. Warnings lors de la compilation
    Par polo54 dans le forum C
    Réponses: 5
    Dernier message: 07/02/2003, 09h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo