From 313c75ac41c328cba4f94060c8b33a8623a41a56 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 Apr 2019 12:42:33 +0200 Subject: [PATCH 1/2] board files updated to platformio espressif 1.8.0 --- src/hal/ecopower.h | 14 +++++++------- src/hal/heltec.h | 16 +++++++++++----- src/hal/heltecv2.h | 20 +++++++++++++------- src/hal/ttgofox.h | 8 ++++---- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/hal/ecopower.h b/src/hal/ecopower.h index 0ab008cb..2c6fbc1a 100644 --- a/src/hal/ecopower.h +++ b/src/hal/ecopower.h @@ -25,8 +25,8 @@ //#define HAS_BUTTON (0) // on board button -> don't use, is same as RTC_INT! // Pins for I2C interface of OLED Display -#define MY_OLED_SDA (21) -#define MY_OLED_SCL (22) +#define MY_OLED_SDA SDA +#define MY_OLED_SCL SCL #define MY_OLED_RST U8X8_PIN_NONE // Settings for on board DS3231 RTC chip @@ -36,17 +36,17 @@ #define RTC_INT GPIO_NUM_0 // // Settings for IF482 interface -//#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_3, GPIO_NUM_1 // RX, TX +#define HAS_IF482 9600, SERIAL_7E1, GPIO_NUM_3, GPIO_NUM_1 // RX, TX // Settings for DCF77 interface //#define HAS_DCF77 GPIO_NUM_14 // JP8 #13 //#define DCF77_ACTIVE_LOW 1 // Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (18) -#define LORA_CS (5) -#define LORA_MISO (19) -#define LORA_MOSI (23) +#define LORA_SCK SCK +#define LORA_CS SS +#define LORA_MISO MISO +#define LORA_MOSI MOSI #define LORA_RST (17) #define LORA_IRQ (16) #define LORA_IO1 (14) // JP8 #13 to be external wired diff --git a/src/hal/heltec.h b/src/hal/heltec.h index 7351d36a..6ec1a068 100644 --- a/src/hal/heltec.h +++ b/src/hal/heltec.h @@ -20,13 +20,19 @@ #define HAS_BUTTON KEY_BUILTIN // button "PROG" on board // Pins for I2C interface of OLED Display -#define MY_OLED_SDA (4) -#define MY_OLED_SCL (15) -#define MY_OLED_RST (16) +#define MY_OLED_SDA SDA_OLED +#define MY_OLED_SCL SCL_OLED +#define MY_OLED_RST RST_OLED // Pins for LORA chip SPI interface come from board file, we need some // additional definitions for LMIC -#define LORA_IO1 (33) -#define LORA_IO2 (32) +#define LORA_IRQ DIO0 +#define LORA_IO1 DIO1 +#define LORA_IO2 DIO2 +#define LORA_SCK SCK +#define LORA_MISO MISO +#define LORA_MOSI MOSI +#define LORA_RST RST_LoRa +#define LORA_CS SS #endif \ No newline at end of file diff --git a/src/hal/heltecv2.h b/src/hal/heltecv2.h index f0773d04..6a8dd36e 100644 --- a/src/hal/heltecv2.h +++ b/src/hal/heltecv2.h @@ -20,18 +20,24 @@ //#define BAT_MEASURE_ADC ADC2_GPIO13_CHANNEL // battery probe GPIO pin //#define BAT_VOLTAGE_DIVIDER 4 // voltage divider 220k/100k on board -//#define EXT_POWER_SW GPIO_NUM_21 // switches battery power, Vext control 0 = on / 1 = off -//#define EXT_POWER_ON 0 +#define EXT_POWER_SW Vext // switches battery power, Vext control 0 = on / 1 = off +#define EXT_POWER_ON 0 //#define EXT_POWER_OFF 1 // Pins for I2C interface of OLED Display -#define MY_OLED_SDA (4) -#define MY_OLED_SCL (15) -#define MY_OLED_RST (16) +#define MY_OLED_SDA SDA_OLED +#define MY_OLED_SCL SCL_OLED +#define MY_OLED_RST RST_OLED // Pins for LORA chip SPI interface come from board file, we need some // additional definitions for LMIC -#define LORA_IO1 (35) -#define LORA_IO2 (34) +#define LORA_IRQ DIO0 +#define LORA_IO1 DIO1 +#define LORA_IO2 DIO2 +#define LORA_SCK SCK +#define LORA_MISO MISO +#define LORA_MOSI MOSI +#define LORA_RST RST_LoRa +#define LORA_CS SS #endif diff --git a/src/hal/ttgofox.h b/src/hal/ttgofox.h index 03729ca7..03ee8d0b 100644 --- a/src/hal/ttgofox.h +++ b/src/hal/ttgofox.h @@ -35,10 +35,10 @@ //#define DCF77_ACTIVE_LOW 1 // Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) +#define LORA_SCK SCK +#define LORA_CS SS +#define LORA_MISO MISO +#define LORA_MOSI MOSI #define LORA_RST (23) #define LORA_IRQ (26) #define LORA_IO1 (33) From 2b82223d3d31742b9019cb47949d50e7a8d4caf2 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 20 Apr 2019 12:42:44 +0200 Subject: [PATCH 2/2] bugfix timesync.cpp --- src/timesync.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/timesync.cpp b/src/timesync.cpp index b6657085..88bc6aa8 100644 --- a/src/timesync.cpp +++ b/src/timesync.cpp @@ -216,11 +216,7 @@ int recv_timesync_ans(uint8_t seq_no, uint8_t buf[], uint8_t buf_len) { // adjust system time, calibrate RTC and RTC_INT pps void IRAM_ATTR setMyTime(uint32_t t_sec, uint16_t t_msec) { - time_t time_to_set = (time_t)t_sec; - - //#if (!defined GPS_INT && !defined RTC_INT) - // time_to_set++; - //#endif + time_t time_to_set = (time_t)(t_sec + 1); ESP_LOGD(TAG, "[%0.3f] Calculated UTC epoch time: %d.%03d sec", millis() / 1000.0, time_to_set, t_msec);