Skip to content

Commit

Permalink
feat(cli): Add GMT user settings (kset) in CLI #159
Browse files Browse the repository at this point in the history
jgauchia committed Nov 17, 2024
1 parent 6a02981 commit 8038ff6
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -267,6 +267,7 @@ Some extra details:
VmaxBatt custom
VminBatt custom
tempOffs custom
defGMT custom
```
**kset KEYNAME**: Set user custom settings:
14 changes: 6 additions & 8 deletions lib/gps/timezone.hpp
Original file line number Diff line number Diff line change
@@ -9,14 +9,7 @@
#ifndef TIMEZONE_HPP
#define TIMEZONE_HPP

// Set these values to the offset of your timezone from GMT

static const int32_t zone_hours = 1L;
static const int32_t zone_minutes = 0L; // usually zero
static const NeoGPS::clock_t zone_offset =
zone_hours * NeoGPS::SECONDS_PER_HOUR +
zone_minutes * NeoGPS::SECONDS_PER_MINUTE;

extern int32_t defGMT; // Default GMT offset

// Uncomment one DST changeover rule, or define your own:

@@ -51,6 +44,11 @@ static void adjustTime( NeoGPS::time_t & dt )
{
NeoGPS::clock_t seconds = dt; // convert date/time structure to seconds

// Set these values to the offset of your timezone from GMT
static const int32_t zone_minutes = 0L; // usually zero
static const NeoGPS::clock_t zone_offset = (int32_t)defGMT * NeoGPS::SECONDS_PER_HOUR +
zone_minutes * NeoGPS::SECONDS_PER_MINUTE;

#ifdef CALCULATE_DST
// Calculate DST changeover times once per reset and year!
static NeoGPS::time_t changeover;
1 change: 1 addition & 0 deletions lib/preferences/preferences-keys.h
Original file line number Diff line number Diff line change
@@ -29,4 +29,5 @@
X(KVMAX_BATT, "VmaxBatt", FLOAT) \
X(KVMIN_BATT, "VminBatt", FLOAT) \
X(KTEMP_OFFS, "tempOffs", INT) \
X(KGMT_OFFS, "defGMT", INT) \
X(KCOUNT, "KCOUNT", UNKNOWN)
2 changes: 2 additions & 0 deletions lib/settings/settings.cpp
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ uint8_t zoom = 0; // Actual Zoom Level
bool isMapRotation = true; // Map Compass Rotation
uint8_t defaultZoom = 0; // Default Zoom Value
uint8_t defBright = 255; // Default Brightness
int32_t defGMT = 1; // Default GMT offset
bool showMapCompass = true; // Compass in map screen
bool isCompassRot = true; // Compass rotation in map screen
bool showMapSpeed = true; // Speed in map screen
@@ -81,6 +82,7 @@ void loadPreferences()
speedPosY = cfg.getInt(PKEYS::KSPEED_Y, TFT_HEIGHT - 130);
isVectorMap = cfg.getBool(PKEYS::KMAP_VECTOR, false);
defBright = cfg.getUInt(PKEYS::KDEF_BRIGT, 254);
defGMT = cfg.getInt(PKEYS::KGMT_OFFS, 1);
if (isVectorMap)
{
minZoom = 1;

0 comments on commit 8038ff6

Please sign in to comment.