mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Adds MESHTASTIC_EXCLUDE_TZ option (#4423)
This commit is contained in:
parent
5b4530325f
commit
a7da3537e2
@ -257,6 +257,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MESHTASTIC_EXCLUDE_POWERMON 1
|
#define MESHTASTIC_EXCLUDE_POWERMON 1
|
||||||
#define MESHTASTIC_EXCLUDE_I2C 1
|
#define MESHTASTIC_EXCLUDE_I2C 1
|
||||||
#define MESHTASTIC_EXCLUDE_POWER_FSM 1
|
#define MESHTASTIC_EXCLUDE_POWER_FSM 1
|
||||||
|
#define MESHTASTIC_EXCLUDE_TZ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Turn off all optional modules
|
// Turn off all optional modules
|
||||||
@ -312,4 +313,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "DebugConfiguration.h"
|
#include "DebugConfiguration.h"
|
||||||
#include "RF95Configuration.h"
|
#include "RF95Configuration.h"
|
@ -256,6 +256,7 @@ uint32_t getValidTime(RTCQuality minQuality, bool local)
|
|||||||
|
|
||||||
time_t gm_mktime(struct tm *tm)
|
time_t gm_mktime(struct tm *tm)
|
||||||
{
|
{
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TZ
|
||||||
setenv("TZ", "GMT0", 1);
|
setenv("TZ", "GMT0", 1);
|
||||||
time_t res = mktime(tm);
|
time_t res = mktime(tm);
|
||||||
if (*config.device.tzdef) {
|
if (*config.device.tzdef) {
|
||||||
@ -264,4 +265,7 @@ time_t gm_mktime(struct tm *tm)
|
|||||||
setenv("TZ", "UTC0", 1);
|
setenv("TZ", "UTC0", 1);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return mktime(tm);
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -689,6 +689,7 @@ void setup()
|
|||||||
screen = new graphics::Screen(screen_found, screen_model, screen_geometry);
|
screen = new graphics::Screen(screen_found, screen_model, screen_geometry);
|
||||||
|
|
||||||
// setup TZ prior to time actions.
|
// setup TZ prior to time actions.
|
||||||
|
#if !MESHTASTIC_EXCLUDE_TZ
|
||||||
if (*config.device.tzdef) {
|
if (*config.device.tzdef) {
|
||||||
setenv("TZ", config.device.tzdef, 1);
|
setenv("TZ", config.device.tzdef, 1);
|
||||||
} else {
|
} else {
|
||||||
@ -696,6 +697,7 @@ void setup()
|
|||||||
}
|
}
|
||||||
tzset();
|
tzset();
|
||||||
LOG_DEBUG("Set Timezone to %s\n", getenv("TZ"));
|
LOG_DEBUG("Set Timezone to %s\n", getenv("TZ"));
|
||||||
|
#endif
|
||||||
|
|
||||||
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
|
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user