kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added 'packed' attribute to settings data structure. Some refactoring of settings and state code.
rodzic
35bde9bccb
commit
d0e8d15389
|
@ -30,8 +30,17 @@ typedef struct
|
|||
bool gps_enabled;
|
||||
bool gps_set_time;
|
||||
}
|
||||
settings_t;
|
||||
__attribute__((packed)) settings_t;
|
||||
|
||||
extern const settings_t default_settings;
|
||||
|
||||
static const settings_t default_settings =
|
||||
{
|
||||
"OPNRTX", // Settings valid string
|
||||
255, // Brightness
|
||||
60, // Contrast
|
||||
0, // UTC Timezone
|
||||
false, // GPS enabled
|
||||
true // GPS set time
|
||||
};
|
||||
|
||||
#endif /* SETTINGS_H */
|
||||
|
|
|
@ -113,7 +113,7 @@ enum RtxStatus
|
|||
RTX_TX
|
||||
};
|
||||
|
||||
extern state_t state;
|
||||
state_t state;
|
||||
|
||||
/**
|
||||
* This function initializes the Radio state, acquiring the information
|
||||
|
|
|
@ -26,18 +26,6 @@
|
|||
#include <interfaces/platform.h>
|
||||
#include <interfaces/nvmem.h>
|
||||
|
||||
state_t state;
|
||||
|
||||
const settings_t default_settings =
|
||||
{
|
||||
"OPNRTX", // Settings valid string
|
||||
255, // Brightness
|
||||
60, // Contrast
|
||||
0, // UTC Timezone
|
||||
false, // GPS enabled
|
||||
true // GPS set time
|
||||
};
|
||||
|
||||
void state_init()
|
||||
{
|
||||
/*
|
||||
|
@ -99,9 +87,15 @@ void state_terminate()
|
|||
void state_applyTimezone()
|
||||
{
|
||||
if(state.time.hour + state.settings.utc_timezone >= 24)
|
||||
{
|
||||
state.time.hour = state.time.hour - 24 + state.settings.utc_timezone;
|
||||
}
|
||||
else if(state.time.hour + state.settings.utc_timezone < 0)
|
||||
{
|
||||
state.time.hour = state.time.hour + 24 + state.settings.utc_timezone;
|
||||
}
|
||||
else
|
||||
{
|
||||
state.time.hour += state.settings.utc_timezone;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue