diff --git a/openrtx/include/gps.h b/openrtx/include/gps.h
new file mode 100644
index 00000000..46598f8a
--- /dev/null
+++ b/openrtx/include/gps.h
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
+ * Niccolò Izzo IU2KIN, *
+ * Silvano Seva IU2KWO *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, see *
+ ***************************************************************************/
+
+#ifndef GPS_H
+#define GPS_H
+
+#include
+
+/**
+ * This function perfoms the task of reading data from the GPS module,
+ * if available, enabled and ready, decode NMEA sentences and update
+ * the radio state with the retrieved data.
+ */
+void gps_taskFunc(char *line, int len, state_t *state);
+
+#endif /* GPS_H */
diff --git a/openrtx/include/interfaces/gps.h b/openrtx/include/interfaces/gps.h
index d6c486f9..9ccbabf5 100644
--- a/openrtx/include/interfaces/gps.h
+++ b/openrtx/include/interfaces/gps.h
@@ -18,8 +18,8 @@
* along with this program; if not, see *
***************************************************************************/
-#ifndef GPS_H
-#define GPS_H
+#ifndef INTERFACES_GPS_H
+#define INTERFACES_GPS_H
#include
#include
@@ -67,4 +67,4 @@ bool gps_detect(uint16_t timeout);
*/
int gps_getNmeaSentence(char *buf, const size_t maxLength);
-#endif /* GPS_H */
+#endif /* INTERFACES_GPS_H */
diff --git a/openrtx/include/state.h b/openrtx/include/state.h
index d770a14d..141770bd 100644
--- a/openrtx/include/state.h
+++ b/openrtx/include/state.h
@@ -121,4 +121,10 @@ extern state_t state;
*/
void state_init();
+/**
+ * This function applies the selected timezone after reading the time from
+ * the RTC.
+ */
+void state_applyTimezone();
+
#endif /* STATE_H */
diff --git a/openrtx/src/gps.c b/openrtx/src/gps.c
index f38a2a85..e8aa917e 100644
--- a/openrtx/src/gps.c
+++ b/openrtx/src/gps.c
@@ -18,14 +18,16 @@
***************************************************************************/
#include
+#include
#include
#include
#include
+#include
/**
* This function parses a GPS NMEA sentence and updates radio state
*/
-void gps_taskFunc(char *line, int len, state_t *state)
+void gps_taskFunc(char *line, __attribute__((unused)) int len, state_t *state)
{
switch (minmea_sentence_id(line, false)) {
case MINMEA_SENTENCE_RMC:
@@ -104,7 +106,6 @@ void gps_taskFunc(char *line, int len, state_t *state)
state->gps_data.tmg_mag = minmea_tofloat(&frame.magnetic_track_degrees);
state->gps_data.tmg_true = minmea_tofloat(&frame.true_track_degrees);
}
-
} break;
// Ignore this message as we take data from RMC
diff --git a/openrtx/src/state.c b/openrtx/src/state.c
index 243737c3..60283e66 100644
--- a/openrtx/src/state.c
+++ b/openrtx/src/state.c
@@ -76,7 +76,7 @@ void state_init()
state.settings.contrast = 84;
}
-state_applyTimezone()
+void state_applyTimezone()
{
if(state.time.hour + state.settings.utc_timezone >= 24)
state.time.hour = state.time.hour - 24 + state.settings.utc_timezone;
diff --git a/openrtx/src/threads.c b/openrtx/src/threads.c
index 158dd18e..cc8e5287 100644
--- a/openrtx/src/threads.c
+++ b/openrtx/src/threads.c
@@ -18,6 +18,7 @@
* along with this program; if not, see *
***************************************************************************/
+#include
#include
#include
#include
@@ -26,13 +27,13 @@
#include
#include
#include
-#ifdef HAS_GPS
-#include
-#endif
-#include
#include
#include
#include
+#ifdef HAS_GPS
+#include
+#include
+#endif
/* Mutex for concurrent access to state variable */
static OS_MUTEX state_mutex;
diff --git a/platform/drivers/GPS/GPS_linux.c b/platform/drivers/GPS/GPS_linux.c
index dc693618..27c04a70 100644
--- a/platform/drivers/GPS/GPS_linux.c
+++ b/platform/drivers/GPS/GPS_linux.c
@@ -36,7 +36,7 @@ char test_nmea_sentences [NMEA_SAMPLES][MAX_NMEA_LEN] = {
"$GPVTG,92.15,T,,M,0.15,N,0.28,K,A*0C"
};
-void gps_init(const uint16_t baud)
+void gps_init(__attribute__((unused)) const uint16_t baud)
{
;
}
@@ -56,7 +56,7 @@ void gps_disable()
;
}
-bool gps_detect(uint16_t timeout)
+bool gps_detect(__attribute__((unused)) uint16_t timeout)
{
return true;
}
@@ -69,8 +69,10 @@ int gps_getNmeaSentence(char *buf, const size_t maxLength)
// Emulate GPS device by sending NMEA sentences every 1s
if(i == 0)
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
- int len = strnlen(test_nmea_sentences[i], MAX_NMEA_LEN);
- strncpy(buf, test_nmea_sentences[i], MAX_NMEA_LEN);
+ size_t len = strnlen(test_nmea_sentences[i], MAX_NMEA_LEN);
+ if (len > maxLength)
+ return -1;
+ strncpy(buf, test_nmea_sentences[i], maxLength);
i++;
i %= NMEA_SAMPLES;
return len;
diff --git a/platform/drivers/baseband/radio_linux.c b/platform/drivers/baseband/radio_linux.c
index 69f094ce..b0a7c77a 100644
--- a/platform/drivers/baseband/radio_linux.c
+++ b/platform/drivers/baseband/radio_linux.c
@@ -86,7 +86,7 @@ void radio_updateCalibrationParams(const rtxStatus_t* rtxCfg)
puts("radio_linux: updateCalibrationParams() called");
}
-float radio_getRssi(const freq_t rxFreq)
+float radio_getRssi(__attribute__((unused)) const freq_t rxFreq)
{
// Commented to reduce verbosity on Linux
//printf("radio_linux: requested RSSI at freq %d, returning -100dBm\n", rxFreq);
diff --git a/platform/drivers/display/display_libSDL.c b/platform/drivers/display/display_libSDL.c
index 634b6380..ec262e00 100644
--- a/platform/drivers/display/display_libSDL.c
+++ b/platform/drivers/display/display_libSDL.c
@@ -62,7 +62,8 @@ bool inProgress; /* Flag to signal when rendering is in progress */
* Internal helper function which fetches pixel at position (x, y) from framebuffer
* and returns it in SDL-compatible format, which is ARGB8888.
*/
-uint32_t fetchPixelFromFb(unsigned int x, unsigned int y)
+uint32_t fetchPixelFromFb(__attribute__((unused)) unsigned int x,
+ __attribute__((unused)) unsigned int y)
{
uint32_t pixel = 0;
@@ -157,7 +158,8 @@ void display_terminate()
SDL_Quit();
}
-void display_renderRows(uint8_t startRow, uint8_t endRow)
+void display_renderRows(__attribute__((unused)) uint8_t startRow,
+ __attribute__((unused)) uint8_t endRow)
{
PIXEL_SIZE *pixels;
int pitch = 0;
diff --git a/platform/mcu/x86_64/drivers/rtc.c b/platform/mcu/x86_64/drivers/rtc.c
index 7a72c00e..09659d58 100644
--- a/platform/mcu/x86_64/drivers/rtc.c
+++ b/platform/mcu/x86_64/drivers/rtc.c
@@ -31,7 +31,7 @@ void rtc_terminate()
printf("rtc_shutdown()\n");
}
-void rtc_setTime(curTime_t t)
+void rtc_setTime(__attribute__((unused)) curTime_t t)
{
printf("rtc_setTime(t)\n");
}
diff --git a/platform/targets/linux/platform.c b/platform/targets/linux/platform.c
index bfbae765..31d926c6 100644
--- a/platform/targets/linux/platform.c
+++ b/platform/targets/linux/platform.c
@@ -36,7 +36,7 @@ void platform_terminate()
printf("Platform terminate\n");
}
-void platform_setBacklightLevel(uint8_t level)
+void platform_setBacklightLevel(__attribute__((unused)) uint8_t level)
{
//printf("platform_setBacklightLevel(%u)\n", level);
}
@@ -72,31 +72,30 @@ bool platform_getPttStatus()
}
-void platform_ledOn(led_t led)
+void platform_ledOn(__attribute__((unused)) led_t led)
{
- char* str;
-
- switch(led)
- {
- case 0:
- str = "GREEN";
- break;
- case 1:
- str = "RED";
- break;
- case 2:
- str = "YELLOW";
- break;
- case 3:
- str = "WHITE";
- break;
- }
// Commented to reduce verbosity on Linux
+ //char* str;
+ //switch(led)
+ //{
+ // case 0:
+ // str = "GREEN";
+ // break;
+ // case 1:
+ // str = "RED";
+ // break;
+ // case 2:
+ // str = "YELLOW";
+ // break;
+ // case 3:
+ // str = "WHITE";
+ // break;
+ //}
//printf("platform_ledOn(%s)\n", str);
}
-void platform_ledOff(led_t led)
+void platform_ledOff(__attribute__((unused)) led_t led)
{
// Commented to reduce verbosity on Linux
//printf("platform_ledOff()\n");