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 #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 snifftype_t { MAC_SNIFF_WIFI, MAC_SNIFF_BLE, MAC_SNIFF_BLE_ENS };
enum runmode_t { enum runmode_t {
RUNMODE_POWERCYCLE, RUNMODE_POWERCYCLE,

View File

@ -120,7 +120,7 @@ time_t get_gpstime(uint16_t *msec) {
t = makeTime(tm); t = makeTime(tm);
ESP_LOGD(TAG, "GPS time/date = %02d:%02d:%02d / %02d.%02d.%2d", tm.Hour, 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 // add protocol delay with millisecond precision
t += delay_ms / 1000 - 1; // whole seconds 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 // (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 // 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(); now();
calibrateTime(); 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 // swap byte order from msb to lsb, note: this is a platform dependent hack
uint32_t t = __builtin_bswap32(*(uint32_t *)(val)); uint32_t t = __builtin_bswap32(*(uint32_t *)(val));
ESP_LOGI(TAG, "Remote command: set time to %d", t); ESP_LOGI(TAG, "Remote command: set time to %d", t);
setMyTime(t, 0, _unsynced); setMyTime(t, 0, _set);
}; };
void set_flush(uint8_t val[]) { void set_flush(uint8_t val[]) {

View File

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