Merge pull request #863 from cyberman54/development

Development
This commit is contained in:
Verkehrsrot 2022-03-05 18:11:44 +01:00 committed by GitHub
commit 9a7dd6a9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 29 deletions

View File

@ -27,9 +27,6 @@ extern DRAM_ATTR bool TimePulseTick; // 1sec pps flag set by GPS or RTC
extern DRAM_ATTR unsigned long lastPPS; extern DRAM_ATTR unsigned long lastPPS;
extern hw_timer_t *ppsIRQ; extern hw_timer_t *ppsIRQ;
//void IRAM_ATTR CLOCKIRQ(void);
//void IRAM_ATTR GPSIRQ(void);
//void clock_loop(void *pvParameters);
void setTimeSyncIRQ(void); void setTimeSyncIRQ(void);
void time_init(void); void time_init(void);
bool timeIsValid(time_t const t); bool timeIsValid(time_t const t);

View File

@ -10,10 +10,6 @@
// Hardware related definitions for Heltec V1 LoRa-32 Board // 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 // 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 HAS_LORA 1 // comment out if device shall not send data via LoRa
#define CFG_sx1276_radio 1 #define CFG_sx1276_radio 1

View File

@ -10,12 +10,6 @@
// Hardware related definitions for Heltec V2 LoRa-32 Board // 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 // 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 HAS_LORA 1 // comment out if device shall not send data via LoRa
#define CFG_sx1276_radio 1 #define CFG_sx1276_radio 1

View File

@ -10,12 +10,6 @@
// Hardware related definitions for Heltec V2.1 LoRa-32 Board // 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 // 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 HAS_LORA 1 // comment out if device shall not send data via LoRa
#define CFG_sx1276_radio 1 #define CFG_sx1276_radio 1

View File

@ -12,8 +12,7 @@ void i2c_init(void) {
Wire.begin(); Wire.begin();
} }
// void i2c_deinit(void) { Wire.end(); } void i2c_deinit(void) { Wire.end(); }
void i2c_deinit(void) { Wire.~TwoWire(); }
void i2c_scan(void) { void i2c_scan(void) {

View File

@ -471,15 +471,15 @@ void setup() {
button_init(HAS_BUTTON); button_init(HAS_BUTTON);
#endif // HAS_BUTTON #endif // HAS_BUTTON
// cyclic function interrupts
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
// only if we have a timesource we do timesync // only if we have a timesource we do timesync
#if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC)) #if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC))
time_init(); time_init();
strcat_P(features, " TIME"); strcat_P(features, " TIME");
#endif // timesync #endif // timesync
// cyclic function interrupts
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
// show compiled features // show compiled features
ESP_LOGI(TAG, "Features:%s", features); ESP_LOGI(TAG, "Features:%s", features);

View File

@ -65,6 +65,7 @@ time_t get_rtctime(uint16_t *msec) {
RtcDateTime tt = Rtc.GetDateTime(); RtcDateTime tt = Rtc.GetDateTime();
t = tt.Epoch32Time(); // sec2000 -> epoch t = tt.Epoch32Time(); // sec2000 -> epoch
} }
/*
#ifdef RTC_INT #ifdef RTC_INT
// adjust time to top of next second by waiting TimePulseTick to flip // adjust time to top of next second by waiting TimePulseTick to flip
bool lastTick = TimePulseTick; bool lastTick = TimePulseTick;
@ -72,6 +73,7 @@ time_t get_rtctime(uint16_t *msec) {
}; };
t++; t++;
#endif #endif
*/
return t; return t;
} // get_rtctime() } // get_rtctime()

View File

@ -381,13 +381,16 @@ time_t mkgmtime(const struct tm *ptm) {
} }
void time_init(void) { 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) #if (defined HAS_IF482 || defined HAS_DCF77)
ESP_LOGI(TAG, "Starting clock controller..."); ESP_LOGI(TAG, "Starting clock controller...");
clock_init(); clock_init();
#endif #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
} }