RePhone Tracking Error in dtostrf library

Hello everyone, someone has programmed a Rephone Geo Kit from Seeedstudio.com I am programming in Arduino ID version 1.6.0 the program makes my RePhone restart every time I make a GET request.

I’m trying to do a project in which I want to send the latitude, longitude and battery data to a PHP page on my server, but when making a GET request my rephone restarts.

The problem I think I get for the dtostrf library

Any solution?

#include <Lhttps.h>
#include <LGPS.h>
#include <LBattery.h>
#include “string.h”
#include <stdio.h>

char server[80] = "http://servidordeprueba.xyz/Datos.php?";
char TEST_URL[256] = {0};
char part1[20] = “lat1=”;
char part2[20] = “&lon1=”;
char part3[20] = “&bat1=”;
//char *buffer;
float latitud;
float longitud;
int c;

void setup(void)
{
Serial.begin(115200);
}

void loop(void)
{
//GPS************
latitud=LGPS.get_latitude();
longitud=LGPS.get_longitude();
//LGPS.get_ns() and LGPS.get_ew() return a char type ‘-’
char ew = LGPS.get_ns();
char ns = LGPS.get_ew();

const int BUF_MAX = 64;
char buf[BUF_MAX];
const int VAL_MAX = 16;
char lat[VAL_MAX];
char lon[VAL_MAX];
//convert from FLOAT to STRING
dtostrf(latitud, 8, 6, lat);
dtostrf(longitud, 8, 6, lon);

//BATERY***************
c = LBattery.level();

//SEND DATA************
while(!Serial.available());
Serial.print(“https test, GPS Test \r\n”);
sprintf(TEST_URL, “%s%s%s%s%s%s%s%s%i”,server,part1,ew,lat,part2,ns,lon,part3,c);
Serial.flush();
https.get_handle(print_url);
https.connect(TEST_URL);
}

void print_url(char content, unsigned long len)
{
Serial.print(content);
}
//library dtstrf
******************
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
char fmt[20];
sprintf(fmt, “%%%d.%df”, width, prec);
sprintf(sout, fmt, val);
return sout;
}

Always use code tags when posting code.

Where did you find this bizarre function?

It is NOT the dtostrf() that everyone else uses. Remove this code and use the built in Arduino version of dtostrf().

//*********************library dtstrf****************************************
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
  char fmt[20];
  sprintf(fmt, "%%%d.%df", width, prec);
  sprintf(sout, fmt, val);
  return sout;
}