bugfix timekeeper

This commit is contained in:
Klaus K Wilting 2019-02-28 17:25:50 +01:00
parent c489123e06
commit 19ffae05e6
5 changed files with 27 additions and 22 deletions

View File

@ -6,7 +6,7 @@
; ---> SELECT TARGET PLATFORM HERE! <---
[platformio]
env_default = generic
;env_default = generic
;env_default = ebox
;env_default = eboxtube
;env_default = heltec
@ -16,7 +16,7 @@ env_default = generic
;env_default = ttgov21old
;env_default = ttgov21new
;env_default = ttgobeam
;env_default = ttgofox
env_default = ttgofox
;env_default = lopy
;env_default = lopy4
;env_default = fipy
@ -30,16 +30,16 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.7.32
release_version = 1.7.323
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3
debug_level = 4
; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA
upload_protocol = esptool
;upload_protocol = custom
extra_scripts = pre:build.py
keyfile = ota.conf
platform_espressif32 = espressif32@1.6.0
platform_espressif32 = espressif32@1.7.0
;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage
board_build.partitions = min_spiffs.csv
monitor_speed = 115200

View File

@ -21,24 +21,28 @@
#define BATT_FACTOR 2 // voltage divider 100k/100k on board
// GPS settings
//#define HAS_GPS 1 // use on board GPS
//#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M
//#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34
#define HAS_GPS 1 // use on board GPS
#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_12, GPIO_NUM_15 // UBlox NEO 6M
#define GPS_INT GPIO_NUM_34 // 30ns accurary timepulse, to be external wired on pcb: NEO 6M Pin#3 -> GPIO34
// Settings for on board DS3231 RTC chip
//#define HAS_RTC MY_OLED_SDA, MY_OLED_SCL // SDA, SCL
//#define RTC_INT GPIO_NUM_13 // timepulse with accuracy +/- 2*e-6 [microseconds] = 0,1728sec / day
// enable only if device has these sensors, otherwise comment these lines
// BME680 sensor on I2C bus
//#define HAS_BME SDA, SCL
//#define BME_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !!
#define HAS_BME SDA, SCL
#define BME_ADDR BME680_I2C_ADDR_PRIMARY // !! connect SDIO of BME680 to GND !!
// display (if connected)
//#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
//#define MY_OLED_SDA SDA
//#define MY_OLED_SCL SCL
//#define MY_OLED_RST U8X8_PIN_NONE
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
#define MY_OLED_SDA SDA
#define MY_OLED_SCL SCL
#define MY_OLED_RST U8X8_PIN_NONE
//#define DISPLAY_FLIP 1 // use if display is rotated
// Settings for DCF77 interface
//#define HAS_DCF77 GPIO_NUM_13
#define HAS_DCF77 GPIO_NUM_13
// Settings for IF482 interface
//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters

View File

@ -28,12 +28,13 @@
//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_12, GPIO_NUM_14 // IF482 serial port parameters
// Settings for DCF77 interface
//#define HAS_DCF77 GPIO_NUM_14
//#define DCF77_ACTIVE_LOW 1
#define HAS_DCF77 GPIO_NUM_14
#define DCF77_ACTIVE_LOW 1
// Settings for external GPS chip
//#define HAS_GPS 1 // use on board GPS
//#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_17, GPIO_NUM_16 // UBlox NEO 6M or 7M with default configuration
#define HAS_GPS 1 // use on board GPS
#define GPS_SERIAL 9600, SERIAL_8N1, GPIO_NUM_17, GPIO_NUM_16 // UBlox NEO 6M or 7M with default configuration
#define GPS_INT GPIO_NUM_13
// Pins for LORA chip SPI interface, reset line and interrupt lines
#define LORA_SCK (5)

View File

@ -66,7 +66,7 @@
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
// settings for syncing time of node with external time source
#define TIME_SYNC_INTERVAL 60 // sync time attempt each .. minutes from time source (GPS/LORA) [default = 60], comment out means off
#define TIME_SYNC_INTERVAL 2 // sync time attempt each .. minutes from time source (GPS/LORA/RTC) [default = 60], comment out means off
//#define TIME_SYNC_LORA 1 // use LORA network as time source, comment out means off [default = off]
// time zone, see https://github.com/JChristensen/Timezone/blob/master/examples/WorldClock/WorldClock.ino

View File

@ -18,7 +18,7 @@ void timeSync(void) {
xSemaphoreTake(TimePulse, pdMS_TO_TICKS(1100)); // wait for pps
t = get_gpstime(); // fetch recent time from last NEMA record
if (t) {
/ t++; // last NMEA record concerns past second, so we add one
t++; // last NMEA record concerns past second, so we add one
ESP_LOGD(TAG, "millis: %d, second: %d", millis(), second(t));
setTime(t);
#ifdef HAS_RTC
@ -107,7 +107,7 @@ void IRAM_ATTR CLOCKIRQ(void) {
xTaskNotifyFromISR(ClockTask, uint32_t(now()), eSetBits, NULL);
#if defined GPS_INT || defined RTC_INT
xSemaphoreGiveFromISR(TimePulse, &xHigherPriorityTaskWoken);
xSemaphoreGiveFromISR(TimePulse, NULL);
TimePulseTick = !TimePulseTick; // flip ticker
#endif