Untitled
unknown
diff
2 years ago
6.5 kB
68
Indexable
diff --git a/libloragw/inc/loragw_spi.h b/libloragw/inc/loragw_spi.h
index 88e4530..29ac5ff 100644
--- a/libloragw/inc/loragw_spi.h
+++ b/libloragw/inc/loragw_spi.h
@@ -32,7 +32,7 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
#define LGW_SPI_SUCCESS 0
#define LGW_SPI_ERROR -1
-#define SPI_SPEED 2000000
+#define SPI_SPEED 8000000
/* -------------------------------------------------------------------------- */
/* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
diff --git a/packet_forwarder/Makefile b/packet_forwarder/Makefile
index 2325a47..e911035 100644
--- a/packet_forwarder/Makefile
+++ b/packet_forwarder/Makefile
@@ -27,7 +27,7 @@ RELEASE_VERSION := `cat ../VERSION`
CC := $(CROSS_COMPILE)gcc
AR := $(CROSS_COMPILE)ar
-CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. -I../libtools/inc
+CFLAGS := -Ofast -flto=4 -march=native -Wall -Wextra -std=c99 -Iinc -I. -I../libtools/inc
VFLAG := -D VERSION_STRING="\"$(RELEASE_VERSION)\""
### Constants for Lora concentrator HAL library
diff --git a/packet_forwarder/src/lora_pkt_fwd.c b/packet_forwarder/src/lora_pkt_fwd.c
index 53661de..9c4abb7 100644
--- a/packet_forwarder/src/lora_pkt_fwd.c
+++ b/packet_forwarder/src/lora_pkt_fwd.c
@@ -81,7 +81,7 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
#define PUSH_TIMEOUT_MS 100
#define PULL_TIMEOUT_MS 200
#define GPS_REF_MAX_AGE 30 /* maximum admitted delay in seconds of GPS loss before considering latest GPS sync unusable */
-#define FETCH_SLEEP_MS 10 /* nb of ms waited when a fetch return no packets */
+#define FETCH_SLEEP_MS 2 /* nb of ms waited when a fetch return no packets */
#define BEACON_POLL_MS 50 /* time in ms between polling of beacon TX status */
#define PROTOCOL_VERSION 2 /* v1.6 */
@@ -310,6 +310,7 @@ static void usage( void )
printf("~~~ Available options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf(" -h print this help\n");
printf(" -c <filename> use config file other than 'global_conf.json'\n");
+ printf(" -x ignored\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
}
@@ -370,8 +371,9 @@ static int parse_SX130x_configuration(const char * conf_file) {
memset(&boardconf, 0, sizeof boardconf); /* initialize configuration structure */
str = json_object_get_string(conf_obj, "com_type");
if (str == NULL) {
- MSG("ERROR: com_type must be configured in %s\n", conf_file);
- return -1;
+ MSG("ERROR: com_type must be configured in %s, assuming spi\n", conf_file);
+ boardconf.com_type = LGW_COM_SPI;
+ // return -1;
} else if (!strncmp(str, "SPI", 3) || !strncmp(str, "spi", 3)) {
boardconf.com_type = LGW_COM_SPI;
} else if (!strncmp(str, "USB", 3) || !strncmp(str, "usb", 3)) {
@@ -386,8 +388,14 @@ static int parse_SX130x_configuration(const char * conf_file) {
strncpy(boardconf.com_path, str, sizeof boardconf.com_path);
boardconf.com_path[sizeof boardconf.com_path - 1] = '\0'; /* ensure string termination */
} else {
- MSG("ERROR: com_path must be configured in %s\n", conf_file);
- return -1;
+ str = json_object_get_string(conf_obj, "spidev_path");
+ if (str != NULL) {
+ strncpy(boardconf.com_path, str, sizeof boardconf.com_path);
+ boardconf.com_path[sizeof boardconf.com_path - 1] = '\0'; /* ensure string termination */
+ } else {
+ MSG("ERROR: com_path must be configured in %s\n", conf_file);
+ return -1;
+ }
}
val = json_object_get_value(conf_obj, "lorawan_public"); /* fetch value (if possible) */
if (json_value_get_type(val) == JSONBoolean) {
@@ -1493,7 +1501,7 @@ int main(int argc, char ** argv)
float dw_ack_ratio;
/* Parse command line options */
- while( (i = getopt( argc, argv, "hc:" )) != -1 )
+ while( (i = getopt( argc, argv, "hxc:" )) != -1 )
{
switch( i )
{
@@ -1506,6 +1514,9 @@ int main(int argc, char ** argv)
conf_fname = optarg;
break;
+ case 'x':
+ // ignored
+ break;
default:
printf( "ERROR: argument parsing options, use -h option for help\n" );
usage( );
(END)
- MSG("ERROR: com_type must be configured in %s\n", conf_file);
- return -1;
+ MSG("ERROR: com_type must be configured in %s, assuming spi\n", conf_file);
+ boardconf.com_type = LGW_COM_SPI;
+ // return -1;
} else if (!strncmp(str, "SPI", 3) || !strncmp(str, "spi", 3)) {
boardconf.com_type = LGW_COM_SPI;
} else if (!strncmp(str, "USB", 3) || !strncmp(str, "usb", 3)) {
@@ -386,8 +388,14 @@ static int parse_SX130x_configuration(const char * conf_file) {
strncpy(boardconf.com_path, str, sizeof boardconf.com_path);
boardconf.com_path[sizeof boardconf.com_path - 1] = '\0'; /* ensure string termination */
} else {
- MSG("ERROR: com_path must be configured in %s\n", conf_file);
- return -1;
+ str = json_object_get_string(conf_obj, "spidev_path");
+ if (str != NULL) {
+ strncpy(boardconf.com_path, str, sizeof boardconf.com_path);
+ boardconf.com_path[sizeof boardconf.com_path - 1] = '\0'; /* ensure string termination */
+ } else {
+ MSG("ERROR: com_path must be configured in %s\n", conf_file);
+ return -1;
+ }
}
val = json_object_get_value(conf_obj, "lorawan_public"); /* fetch value (if possible) */
if (json_value_get_type(val) == JSONBoolean) {
@@ -1493,7 +1501,7 @@ int main(int argc, char ** argv)
float dw_ack_ratio;
/* Parse command line options */
- while( (i = getopt( argc, argv, "hc:" )) != -1 )
+ while( (i = getopt( argc, argv, "hxc:" )) != -1 )
{
switch( i )
{
@@ -1506,6 +1514,9 @@ int main(int argc, char ** argv)
conf_fname = optarg;
break;
+ case 'x':
+ // ignored
+ break;
default:
printf( "ERROR: argument parsing options, use -h option for help\n" );
usage( );
Editor is loading...
Leave a Comment