mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 23:32:14 +02:00
gnss: don't overload the modem during upload
By instructing sendfile() to send the whole content of the assistance data at once results in a big data transfer (> 4kb) first followed by a huge amount of small transfers (64 or 128b). This "overloads" the modem which needs to process smaller chunks of data and have more time to do so (experimentation shows that 1kb need 100ms for processing, or the upload will subsequently fail). This commit sets the transfer size to 256b and increase the timeout between each transfer to 25ms.
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define BUFFER_SIZE 256
|
#define BUFFER_SIZE 256
|
||||||
#define UPLOAD_DELAY_US 10000
|
#define UPLOAD_DELAY_US 25000
|
||||||
#define UPLOAD_TIMEOUT_S 10
|
#define UPLOAD_TIMEOUT_S 10
|
||||||
#define RESCHEDULE_IN_SECS 30
|
#define RESCHEDULE_IN_SECS 30
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ static void upload_assistance_data(struct EG25Manager *manager)
|
|||||||
do {
|
do {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
/* Copy downloaded XTRA assistance data to the modem over serial */
|
/* Copy downloaded XTRA assistance data to the modem over serial */
|
||||||
ret = sendfile(manager->at_fd, manager->gnss_assistance_fd, &written_total, sb.st_size);
|
ret = sendfile(manager->at_fd, manager->gnss_assistance_fd, &written_total, BUFFER_SIZE);
|
||||||
error = errno;
|
error = errno;
|
||||||
usleep(UPLOAD_DELAY_US);
|
usleep(UPLOAD_DELAY_US);
|
||||||
} while ((!error && written_total < sb.st_size) || (ret == -1 && error == EAGAIN));
|
} while ((!error && written_total < sb.st_size) || (ret == -1 && error == EAGAIN));
|
||||||
@@ -376,13 +376,13 @@ static void finish_assistance_data_upload(struct EG25Manager *manager)
|
|||||||
|
|
||||||
/* Configure GNSS assistance clock to current system time (UTC) */
|
/* Configure GNSS assistance clock to current system time (UTC) */
|
||||||
datetime = g_date_time_new_now_utc();
|
datetime = g_date_time_new_now_utc();
|
||||||
timestring = g_date_time_format(datetime, "0,\"%Y/%m/%d,%H:%M:%S\"\r\n");
|
timestring = g_date_time_format(datetime, "0,\"%Y/%m/%d,%H:%M:%S\"");
|
||||||
g_message("Setting GNSS assistance UTC clock to: %s", timestring);
|
g_message("Setting GNSS assistance UTC clock to: %s", timestring);
|
||||||
at_append_command(manager, "QGPSXTRATIME", NULL, timestring, NULL,
|
at_append_command(manager, "QGPSXTRATIME", NULL, timestring, NULL,
|
||||||
at_process_result);
|
at_process_result);
|
||||||
|
|
||||||
/* Configure GNSS engine to use uploaded GNSS assistance data */
|
/* Configure GNSS engine to use uploaded GNSS assistance data */
|
||||||
g_snprintf(value, BUFFER_SIZE, "\"RAM:%s\"\r\n",
|
g_snprintf(value, BUFFER_SIZE, "\"RAM:%s\"",
|
||||||
manager->gnss_assistance_file);
|
manager->gnss_assistance_file);
|
||||||
g_message("Setting GNSS assistance file to: %s", value);
|
g_message("Setting GNSS assistance file to: %s", value);
|
||||||
at_append_command(manager, "QGPSXTRADATA", NULL, value, NULL,
|
at_append_command(manager, "QGPSXTRADATA", NULL, value, NULL,
|
||||||
|
Reference in New Issue
Block a user