mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 01:42:15 +00:00
Add a Userprefs Timezone String, to be replaced in the web flasher (#4938)
* Add a Userprefs Timezone String, to be replaced in the web flasher * Use a volatile char buffer for slipstreamed strings. * More refinement
This commit is contained in:
parent
b2b60eccdb
commit
befc2ece6f
11
src/main.cpp
11
src/main.cpp
@ -1,3 +1,4 @@
|
|||||||
|
#include "../userPrefs.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#if !MESHTASTIC_EXCLUDE_GPS
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
#include "GPS.h"
|
#include "GPS.h"
|
||||||
@ -706,10 +707,16 @@ void setup()
|
|||||||
|
|
||||||
// setup TZ prior to time actions.
|
// setup TZ prior to time actions.
|
||||||
#if !MESHTASTIC_EXCLUDE_TZ
|
#if !MESHTASTIC_EXCLUDE_TZ
|
||||||
if (*config.device.tzdef) {
|
LOG_DEBUG("Using compiled/slipstreamed %s\n", USERPREFS_TZ_STRING); // important, removing this clobbers our magic string
|
||||||
|
if (*config.device.tzdef && config.device.tzdef[0] != 0) {
|
||||||
|
LOG_DEBUG("Saved TZ: %s \n", config.device.tzdef);
|
||||||
setenv("TZ", config.device.tzdef, 1);
|
setenv("TZ", config.device.tzdef, 1);
|
||||||
} else {
|
} else {
|
||||||
setenv("TZ", "GMT0", 1);
|
if (strncmp((const char *)USERPREFS_TZ_STRING, "tzpl", 4) == 0) {
|
||||||
|
setenv("TZ", "GMT0", 1);
|
||||||
|
} else {
|
||||||
|
setenv("TZ", (const char *)USERPREFS_TZ_STRING, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tzset();
|
tzset();
|
||||||
LOG_DEBUG("Set Timezone to %s\n", getenv("TZ"));
|
LOG_DEBUG("Set Timezone to %s\n", getenv("TZ"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef _USERPREFS_
|
#ifndef _USERPREFS_
|
||||||
#define _USERPREFS_
|
#define _USERPREFS_
|
||||||
|
volatile static const char USERPREFS_TZ_STRING[] = "tzplaceholder ";
|
||||||
// Uncomment and modify to set device defaults
|
// Uncomment and modify to set device defaults
|
||||||
|
|
||||||
// #define USERPREFS_EVENT_MODE 1
|
// #define USERPREFS_EVENT_MODE 1
|
||||||
|
Loading…
Reference in New Issue
Block a user