Go Down

Topic: [SOLVED] sim908 return bad speed (Read 754 times) previous topic - next topic

xload

Sep 11, 2014, 11:39 am Last Edit: Sep 15, 2014, 10:58 am by xload Reason: 1
Hello,

I'm reading the sim908 GPS info with getPar functionfrom gsmlib, that internally send an AT+CGPSINF=0 command , all works fine but the speed is always under 60 kph (before convert knots to kph), what is the problem? there is a sim908 problem?

Code: [Select]

char GPSGSM::getPar(char *str_long, char *str_lat, char *str_alt, char *str_time, char *str_num, char *str_speed)
{
  char ret_val=0;
  char *p_char;
  char *p_char1;
  gsm.SimpleWriteln("AT+CGPSINF=0");
  gsm.WaitResp(5000, 100, "OK");
  if(gsm.IsStringReceived("OK"))
     ret_val=1;
     
  //longitude
  p_char = strchr((char *)(gsm.comm_buf),',');
  p_char1 = p_char+1;  //we are on the first char of longitude
  p_char = strchr((char *)(p_char1), ',');
  if (p_char != NULL) {
         *p_char = 0;
   }
  strcpy(str_long, (char *)(p_char1));
 
  // latitude
  p_char++;
  p_char1 = strchr((char *)(p_char), ',');
  if (p_char1 != NULL) {
         *p_char1 = 0;
   }  
  strcpy(str_lat, (char *)(p_char));
 
  // altitude
  p_char1++;
  p_char = strchr((char *)(p_char1), ',');
  if (p_char != NULL) {
         *p_char = 0;
   }  
  strcpy(str_alt, (char *)(p_char1));
 
  // UTC time
  p_char++;
  p_char1 = strchr((char *)(p_char), ',');
  if (p_char1 != NULL) {
         *p_char1 = 0;
   }  
  strcpy(str_time, (char *)(p_char));  

  // TTFF
  p_char1++;
  p_char = strchr((char *)(p_char1), ',');
  if (p_char != NULL) {
         *p_char = 0;
   }  

  // num
  p_char++;
  p_char1 = strchr((char *)(p_char), ',');
  if (p_char1 != NULL) {
         *p_char1 = 0;
   }  
       strcpy(str_num, (char *)(p_char));

  // speed
  p_char1++;
  p_char = strchr((char *)(p_char1), ',');
  if (p_char != NULL) {
         *p_char = 0;
   }      
  strcpy(str_speed, (char *)(p_char1));  
 
  return ret_val;
}


The fastest retuned value was  29.340792 knots, arround  54.34 kph, but real speed was near 120 kph.

Best regards.

PaulS

Rather than parsing the GPS data, just try printing it. You may not be getting the correct field.
The art of getting good answers lies in asking good questions.

xload

Problem solved  AT+CGPSINF=0 returns velocity in meters/second not in knots.

Go Up