Open 3nd0y opened 4 years ago
Hi, i use lib which ported from yours. But unfortunately i couldn't extract some string like $SPDDT or $SPDBT.
Here simple code:
#include "mbed.h" #include "millis.h" #include "SDFileSystem.h" #include "TinyGPSplus.h" #define GPS_BAUDRATE 9600 #define DEBUG_BAUDRATE 115200 Serial sonar(PB_10,PB_11); // tx, rx Serial gps(PA_9,PA_10); // tx, rx Serial pc(PA_2,PA_3); // tx, rx TinyGPSPlus tgps,tsonar; TinyGPSCustom csonar(tsonar,"SDDBT",2); TinyGPSCustom c2sonar(tsonar,"SDDPT",1); Ticker wrDataTick; bool read_gps(bool debug=false) { char ch; bool stat; if(gps.readable()) { ch = gps.getc(); if(debug)pc.putc(ch); stat = tgps.encode(ch); } return stat; } bool read_sonar(bool debug=false){ char ch; bool stat; if(sonar.readable()){ ch=sonar.getc(); stat=tsonar.encode(ch); if(debug)pc.putc(ch); } return stat; } int main() { millisStart(); gps.baud(GPS_BAUDRATE); pc.baud(DEBUG_BAUDRATE); while(1) { if(read_sonar()){ printf("\nis Sonar Updated? %d and valid? %d\n",csonar.isUpdated(), csonar.isValid()); printf("Char Depth processed: %d, failed checksum: %d\n",tsonar.charsProcessed(), tsonar.failedChecksum()); printf("Sonar = %s\n",csonar.value()); printf("Sonar 1 = %s\n\n",c2sonar.value()); } if(read_gps()){ printf("is GPS updated? %d and valid? %d\n", tgps.location.isUpdated(), tgps.location.isValid()); printf("Char GPS processed: %d, failed checksum: %d\n",tgps.charsProcessed(), tgps.failedChecksum()); } } return 0; }
This is what i got: is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 = is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18 is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 =
This is what i got: is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 =
is GPS updated? 0 and valid? 0 Char GPS processed: 3229, failed checksum: 18
is Sonar Updated? 0 and valid? 0 Char Depth processed: 4520, failed checksum: 109 Sonar = Sonar 1 =
So why it's never update and i can't obtain value via Tinygps custom?
Hi, i use lib which ported from yours. But unfortunately i couldn't extract some string like $SPDDT or $SPDBT.
Here simple code:
So why it's never update and i can't obtain value via Tinygps custom?