diff --git a/platformio.ini b/platformio.ini index 2fa1355..1ae92e8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,8 +10,8 @@ [env:nodemcu] ;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage -platform = https://github.com/platformio/platform-espressif8266.git -;platform = espressif8266 +;platform = https://github.com/platformio/platform-espressif8266.git +platform = espressif8266@1.7.3 board = nodemcu framework = arduino board_build.f_cpu = 80000000L diff --git a/src/main.cpp b/src/main.cpp index 52bede2..c163a20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,15 +144,17 @@ void inline lightsleep() { wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); wifi_fpm_open(); // Enables force sleep GPIO_DIS_OUTPUT(GPIO_ID_PIN(GEIGER_PIN)); - PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13); // PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO13); + //PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO13); gpio_pin_wakeup_enable(GPIO_ID_PIN(GEIGER_PIN), GPIO_PIN_INTR_LOLEVEL); wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); Serial.flush(); + delay(1); wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time // this does not work: (uint32_t)postingInterval*1000 delay(1); // go to sleep now DEBUG_MSG("[DEBUG] woken\n"); - //wifi_fpm_do_wakeup(); - wifi_fpm_close(); + //wifi_fpm_do_wakeup(); // wake from modem sleep + wifi_fpm_close(); // disable force sleep function } void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int format) { @@ -379,7 +381,9 @@ void ICACHE_FLASH_ATTR sendValues() { } + #if ESP_SDK_VERSION_NUMBER >= 0x020200 net.setInsecure(); + #endif mqttclient.begin(mqttserver, 8883, net); constexpr unsigned int retry_delay = 500; for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) { diff --git a/src/main.h b/src/main.h index 9f15701..40c1f70 100644 --- a/src/main.h +++ b/src/main.h @@ -7,6 +7,6 @@ #define DEBUG_MSG(...) #endif -#define FW_VERSION 39 +#define FW_VERSION 41 #endif /* _MAIN_H */