This commit is contained in:
cyberman54 2021-03-31 09:44:23 +02:00
parent b483d0279d
commit 7d401697f6
4 changed files with 6 additions and 5 deletions

View File

@ -50,7 +50,7 @@
#define _seconds() millis() / 1000.0
enum timesource_t { _gps, _rtc, _lora, _unsynced };
enum timesource_t { _gps, _rtc, _lora, _set, _unsynced };
enum snifftype_t { MAC_SNIFF_WIFI, MAC_SNIFF_BLE, MAC_SNIFF_BLE_ENS };
enum runmode_t {
RUNMODE_POWERCYCLE,

View File

@ -120,7 +120,7 @@ time_t get_gpstime(uint16_t *msec) {
t = makeTime(tm);
ESP_LOGD(TAG, "GPS time/date = %02d:%02d:%02d / %02d.%02d.%2d", tm.Hour,
tm.Minute, tm.Second, tm.Day, tm.Month, tm.Year + 1970);
tm.Minute, tm.Second, tm.Day, tm.Month, tm.Year + 1970);
// add protocol delay with millisecond precision
t += delay_ms / 1000 - 1; // whole seconds
@ -163,7 +163,8 @@ void gps_loop(void *pvParameters) {
// (only) while device time is not set or unsynched, and we have a valid
// GPS time, we trigger a device time update to poll time from GPS
if (timeSource == _unsynced && gpstime.isUpdated()) {
if ((timeSource == _unsynced || timeSource == _set) &&
gpstime.isUpdated()) {
now();
calibrateTime();
}

View File

@ -357,7 +357,7 @@ void set_time(uint8_t val[]) {
// swap byte order from msb to lsb, note: this is a platform dependent hack
uint32_t t = __builtin_bswap32(*(uint32_t *)(val));
ESP_LOGI(TAG, "Remote command: set time to %d", t);
setMyTime(t, 0, _unsynced);
setMyTime(t, 0, _set);
};
void set_flush(uint8_t val[]) {

View File

@ -12,7 +12,7 @@
static const char TAG[] = __FILE__;
// symbol to display current time source
const char timeSetSymbols[] = {'G', 'R', 'L', '?'};
const char timeSetSymbols[] = {'G', 'R', 'L', 'S', '?'};
#ifdef HAS_IF482
#if (HAS_SDS011)