diff --git a/include/timekeeper.h b/include/timekeeper.h index 88d3c8e8..fe4dfb9e 100644 --- a/include/timekeeper.h +++ b/include/timekeeper.h @@ -27,9 +27,6 @@ extern DRAM_ATTR bool TimePulseTick; // 1sec pps flag set by GPS or RTC extern DRAM_ATTR unsigned long lastPPS; extern hw_timer_t *ppsIRQ; -//void IRAM_ATTR CLOCKIRQ(void); -//void IRAM_ATTR GPSIRQ(void); -//void clock_loop(void *pvParameters); void setTimeSyncIRQ(void); void time_init(void); bool timeIsValid(time_t const t); diff --git a/src/hal/heltec.h b/src/hal/heltec.h index 55f7332a..3546089e 100644 --- a/src/hal/heltec.h +++ b/src/hal/heltec.h @@ -10,10 +10,6 @@ // Hardware related definitions for Heltec V1 LoRa-32 Board // see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v1 -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 GPIO_NUM_21, GPIO_NUM_22 // SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND - #define HAS_LORA 1 // comment out if device shall not send data via LoRa #define CFG_sx1276_radio 1 diff --git a/src/hal/heltecv2.h b/src/hal/heltecv2.h index b6aab088..b047bdd8 100644 --- a/src/hal/heltecv2.h +++ b/src/hal/heltecv2.h @@ -10,12 +10,6 @@ // Hardware related definitions for Heltec V2 LoRa-32 Board // see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v2 -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 GPIO_NUM_4, GPIO_NUM_15 // SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND -//#define HAS_BMP180 -//#define BMP180_ADDR 0x77 - #define HAS_LORA 1 // comment out if device shall not send data via LoRa #define CFG_sx1276_radio 1 diff --git a/src/hal/heltecv21.h b/src/hal/heltecv21.h index a24d875a..9372325d 100644 --- a/src/hal/heltecv21.h +++ b/src/hal/heltecv21.h @@ -10,12 +10,6 @@ // Hardware related definitions for Heltec V2.1 LoRa-32 Board // see https://heltec-automation-docs.readthedocs.io/en/latest/esp32/wifi_lora_32/hardware_update_log.html#v2-1 -//#define HAS_BME 1 // Enable BME sensors in general -//#define HAS_BME680 GPIO_NUM_4, GPIO_NUM_15 // SDA, SCL -//#define BME680_ADDR BME680_I2C_ADDR_PRIMARY // connect SDIO of BME680 to GND -//#define HAS_BMP180 -//#define BMP180_ADDR 0x77 - #define HAS_LORA 1 // comment out if device shall not send data via LoRa #define CFG_sx1276_radio 1 diff --git a/src/i2c.cpp b/src/i2c.cpp index 9731e09d..0080dd5d 100644 --- a/src/i2c.cpp +++ b/src/i2c.cpp @@ -12,8 +12,7 @@ void i2c_init(void) { Wire.begin(); } -// void i2c_deinit(void) { Wire.end(); } -void i2c_deinit(void) { Wire.~TwoWire(); } +void i2c_deinit(void) { Wire.end(); } void i2c_scan(void) { diff --git a/src/main.cpp b/src/main.cpp index b9176b0c..e84c376a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -471,15 +471,15 @@ void setup() { button_init(HAS_BUTTON); #endif // HAS_BUTTON - // cyclic function interrupts - cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); - // only if we have a timesource we do timesync #if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC)) time_init(); strcat_P(features, " TIME"); #endif // timesync + // cyclic function interrupts + cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); + // show compiled features ESP_LOGI(TAG, "Features:%s", features); diff --git a/src/rtctime.cpp b/src/rtctime.cpp index e0142d45..50280d3b 100644 --- a/src/rtctime.cpp +++ b/src/rtctime.cpp @@ -65,6 +65,7 @@ time_t get_rtctime(uint16_t *msec) { RtcDateTime tt = Rtc.GetDateTime(); t = tt.Epoch32Time(); // sec2000 -> epoch } + /* #ifdef RTC_INT // adjust time to top of next second by waiting TimePulseTick to flip bool lastTick = TimePulseTick; @@ -72,6 +73,7 @@ time_t get_rtctime(uint16_t *msec) { }; t++; #endif +*/ return t; } // get_rtctime() diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index 3545d915..896f49ec 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -381,13 +381,16 @@ time_t mkgmtime(const struct tm *ptm) { } void time_init(void) { -#if (HAS_LORA_TIME) - timesync_init(); // create loraserver time sync task -#endif - ESP_LOGI(TAG, "Starting time pulse..."); - timepulse_init(); // starts pps and cyclic time sync + #if (defined HAS_IF482 || defined HAS_DCF77) ESP_LOGI(TAG, "Starting clock controller..."); clock_init(); #endif + +#if (HAS_LORA_TIME) + timesync_init(); // create loraserver time sync task +#endif + + ESP_LOGI(TAG, "Starting time pulse..."); + timepulse_init(); // starts pps and cyclic time sync } \ No newline at end of file