kopia lustrzana https://github.com/OpenRTX/OpenRTX
Fix various warnings
rodzic
9aefde7fc7
commit
4d66d8b1af
|
@ -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 <http://www.gnu.org/licenses/> *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GPS_H
|
||||||
|
#define GPS_H
|
||||||
|
|
||||||
|
#include <state.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 */
|
|
@ -18,8 +18,8 @@
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef GPS_H
|
#ifndef INTERFACES_GPS_H
|
||||||
#define GPS_H
|
#define INTERFACES_GPS_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -67,4 +67,4 @@ bool gps_detect(uint16_t timeout);
|
||||||
*/
|
*/
|
||||||
int gps_getNmeaSentence(char *buf, const size_t maxLength);
|
int gps_getNmeaSentence(char *buf, const size_t maxLength);
|
||||||
|
|
||||||
#endif /* GPS_H */
|
#endif /* INTERFACES_GPS_H */
|
||||||
|
|
|
@ -121,4 +121,10 @@ extern state_t state;
|
||||||
*/
|
*/
|
||||||
void state_init();
|
void state_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function applies the selected timezone after reading the time from
|
||||||
|
* the RTC.
|
||||||
|
*/
|
||||||
|
void state_applyTimezone();
|
||||||
|
|
||||||
#endif /* STATE_H */
|
#endif /* STATE_H */
|
||||||
|
|
|
@ -18,14 +18,16 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <interfaces/gps.h>
|
#include <interfaces/gps.h>
|
||||||
|
#include <gps.h>
|
||||||
#include <minmea.h>
|
#include <minmea.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <state.h>
|
#include <state.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function parses a GPS NMEA sentence and updates radio state
|
* 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)) {
|
switch (minmea_sentence_id(line, false)) {
|
||||||
case MINMEA_SENTENCE_RMC:
|
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_mag = minmea_tofloat(&frame.magnetic_track_degrees);
|
||||||
state->gps_data.tmg_true = minmea_tofloat(&frame.true_track_degrees);
|
state->gps_data.tmg_true = minmea_tofloat(&frame.true_track_degrees);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// Ignore this message as we take data from RMC
|
// Ignore this message as we take data from RMC
|
||||||
|
|
|
@ -76,7 +76,7 @@ void state_init()
|
||||||
state.settings.contrast = 84;
|
state.settings.contrast = 84;
|
||||||
}
|
}
|
||||||
|
|
||||||
state_applyTimezone()
|
void state_applyTimezone()
|
||||||
{
|
{
|
||||||
if(state.time.hour + state.settings.utc_timezone >= 24)
|
if(state.time.hour + state.settings.utc_timezone >= 24)
|
||||||
state.time.hour = state.time.hour - 24 + state.settings.utc_timezone;
|
state.time.hour = state.time.hour - 24 + state.settings.utc_timezone;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <hwconfig.h>
|
||||||
#include <os.h>
|
#include <os.h>
|
||||||
#include <ui.h>
|
#include <ui.h>
|
||||||
#include <state.h>
|
#include <state.h>
|
||||||
|
@ -26,13 +27,13 @@
|
||||||
#include <interfaces/keyboard.h>
|
#include <interfaces/keyboard.h>
|
||||||
#include <interfaces/graphics.h>
|
#include <interfaces/graphics.h>
|
||||||
#include <interfaces/platform.h>
|
#include <interfaces/platform.h>
|
||||||
#ifdef HAS_GPS
|
|
||||||
#include <interfaces/gps.h>
|
|
||||||
#endif
|
|
||||||
#include <hwconfig.h>
|
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <rtx.h>
|
#include <rtx.h>
|
||||||
#include <minmea.h>
|
#include <minmea.h>
|
||||||
|
#ifdef HAS_GPS
|
||||||
|
#include <interfaces/gps.h>
|
||||||
|
#include <gps.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Mutex for concurrent access to state variable */
|
/* Mutex for concurrent access to state variable */
|
||||||
static OS_MUTEX state_mutex;
|
static OS_MUTEX state_mutex;
|
||||||
|
|
|
@ -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"
|
"$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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,10 @@ int gps_getNmeaSentence(char *buf, const size_t maxLength)
|
||||||
// Emulate GPS device by sending NMEA sentences every 1s
|
// Emulate GPS device by sending NMEA sentences every 1s
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
||||||
int len = strnlen(test_nmea_sentences[i], MAX_NMEA_LEN);
|
size_t len = strnlen(test_nmea_sentences[i], MAX_NMEA_LEN);
|
||||||
strncpy(buf, test_nmea_sentences[i], MAX_NMEA_LEN);
|
if (len > maxLength)
|
||||||
|
return -1;
|
||||||
|
strncpy(buf, test_nmea_sentences[i], maxLength);
|
||||||
i++;
|
i++;
|
||||||
i %= NMEA_SAMPLES;
|
i %= NMEA_SAMPLES;
|
||||||
return len;
|
return len;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void radio_updateCalibrationParams(const rtxStatus_t* rtxCfg)
|
||||||
puts("radio_linux: updateCalibrationParams() called");
|
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
|
// Commented to reduce verbosity on Linux
|
||||||
//printf("radio_linux: requested RSSI at freq %d, returning -100dBm\n", rxFreq);
|
//printf("radio_linux: requested RSSI at freq %d, returning -100dBm\n", rxFreq);
|
||||||
|
|
|
@ -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
|
* Internal helper function which fetches pixel at position (x, y) from framebuffer
|
||||||
* and returns it in SDL-compatible format, which is ARGB8888.
|
* 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;
|
uint32_t pixel = 0;
|
||||||
|
|
||||||
|
@ -157,7 +158,8 @@ void display_terminate()
|
||||||
SDL_Quit();
|
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;
|
PIXEL_SIZE *pixels;
|
||||||
int pitch = 0;
|
int pitch = 0;
|
||||||
|
|
|
@ -31,7 +31,7 @@ void rtc_terminate()
|
||||||
printf("rtc_shutdown()\n");
|
printf("rtc_shutdown()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtc_setTime(curTime_t t)
|
void rtc_setTime(__attribute__((unused)) curTime_t t)
|
||||||
{
|
{
|
||||||
printf("rtc_setTime(t)\n");
|
printf("rtc_setTime(t)\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ void platform_terminate()
|
||||||
printf("Platform terminate\n");
|
printf("Platform terminate\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_setBacklightLevel(uint8_t level)
|
void platform_setBacklightLevel(__attribute__((unused)) uint8_t level)
|
||||||
{
|
{
|
||||||
//printf("platform_setBacklightLevel(%u)\n", 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
|
// 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);
|
//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
|
// Commented to reduce verbosity on Linux
|
||||||
//printf("platform_ledOff()\n");
|
//printf("platform_ledOff()\n");
|
||||||
|
|
Ładowanie…
Reference in New Issue